PHP 4.0 Bug #8321: insert of double quotes in javascript
| From: | jbourguignon at ecritel dot net | Date: | Tue, 19 Dec 2000 13:56:20 +0000 |
| Subject: | PHP 4.0 Bug #8321: insert of double quotes in javascript | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-41866@lists.php.net to get a copy of this message | ||
From: jbourguignon@ecritel.net
Operating system: Redhat linux 6.0
PHP version: 4.0.3pl1
PHP Bug Type: *Session related
Bug description: insert of double quotes in javascript
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@smokyracle 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
--
Edit Bug report at: http://bugs.php.net/?id=8321&edit=1