Date: 12/19/00
- Next message: Andi Gutmans: "Re: [PHP-DEV] Re: [PHP-QA] convention about function naming II"
- Previous message: André Langhorst: "Re: [PHP-DEV] http://bugs.php.net/bugs.php?id=5350"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 8321
User Update by: jbourguignon <email protected>
Status: Open
Bug Type: *Session related
Description: insert of double quotes in javascript
I forgot something : when performed in Apache environment, a reload "fixes" the problem, ie the second call to the page is correct.
This problem appeared with a MM_preloadimage()//v3 function inserted by dreamweaver so I guess others could meet the same problem. I got a javascript error as the code was broken by the intruding quotes.
I "solved" my problem by renaming my array abc instead of a, meaning that the variable declaration is taken into account because an abc[i]; string is quoted execpt if declared in the script.
Nota : I checked that the problem disappears when the page is a plain html file (index.html).
Jerome
Previous Comments:
---------------------------------------------------------------------------
[2000-12-19 08:56:20] jbourguignon <email protected>
Hi,
When compiling php with --enable-trans-sid I get a rather strange behaviour :
double quotes are inserted in javascript (between <script> and </script>)
Here's my page :
<html>
<head>
<script language="Javascript">
function MM_preloadImages()
{
var d=document;
if(d.images)
{
if(!d.MM_p) d.MM_p=new Array();
var a = MM_preloadImages.arguments;
var i;
var j = d.MM_p.length;
for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0)
{
d.MM_p[j]=new Image;
d.MM_p[j++].src=a[i];
}
toto=a[i];
}
}
to=a[i];
to<a[i];
to=a[j];
to=b[i];
to=a;
to=a[2];
to=a[];
to=a[2]
to = a[ 2 ] ;
to=a[ ];
to=b[]
to=b
to=ab
to ab;
to=b ;
</script>
oto=a[i];
</head>
<body onload="javascript:toto=a[2];">
titi
a[i];
</body>
</html>
All the to=... are here cos I tried to find out which "rule" the bug followed. It looks it has sthg to do with the "=" sign but I'm not positive :)
Here's the result once parsed by PHP (this one was a command line one but we got the same with an Apache buil-in version)
[root <email protected> php-4.0.3pl1]# ./php index.php
X-Powered-By: PHP/4.0.3pl1
Set-Cookie: PHPSESSID=18f7e65b019e224a86c02c036ff0bc8a; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html
<html>
<head>
<script language="Javascript">
function MM_preloadImages()
{
var d=document;
if(d.images)
{
if(!d.MM_p) d.MM_p=new Array();
var a = MM_preloadImages.arguments;
var i;
var j = d.MM_p.length;
for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0)
{
d.MM_p[j]=new Image;
d.MM_p[j++].src="a[i];"
}
toto="a[i];"
}
}
to="a[i];"
to<a[i];
to="a[j];"
to="b[i];"
to="a;"
to="a[2];"
to="a[];"
to="a[2]"
to = "a[" 2 ] ;
to="a[" ];
to="b[]"
to="b"
to="ab"
to ab;
to="b" ;
</script>
oto=a[i];
</head>
<body onload="javascript:toto=a[2];">
titi
a[i];
</body>
</html>
I really don't think it's a feature :)
Thank you
Jerome
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8321
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andi Gutmans: "Re: [PHP-DEV] Re: [PHP-QA] convention about function naming II"
- Previous message: André Langhorst: "Re: [PHP-DEV] http://bugs.php.net/bugs.php?id=5350"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

