php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38202 weird javascript mangling
Submitted: 2006-07-25 07:33 UTC Modified: 2006-08-15 12:17 UTC
From: franz at fholzinger dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.2 OS: LINUX Red Hat
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: franz at fholzinger dot com
New email:
PHP Version: OS:

 

 [2006-07-25 07:33 UTC] franz at fholzinger dot com
Description:
------------
same as bug #7293 weird javascript mangling

Same bug here with PHP 4.3.11.

See files
http://fholzinger.com/development/error_for_negative.zip
which are part of TYPO3 4.0 and the tt_products 2.5.0 shop system extension.

This error happens only when I e.g. add the following lines in PHP to JavaScript.

 for (var l=8; l>1; l--)	{
    	b = l;
   }

This make the generated JavaScript broken.

for (var k=0; k<len; k="" sboptionsk1="new" optioncccategory2k0="" ccategory2k="" for="" var="" l="">1; l--)	{
       	b = l;
       }

The for some lines above get bad now. Without the lines above this has worked fine however.

The line before them are in the PHP string which will generate the JavaScript:

for (var k=0; k<len; k++) {
       sb.options[k+1] = new Option(c[c[category][2][k]][0], c[category][2][k]);
        }

I works however when I change the loop above to


 for (var l=8; l<15; l++)	{
    	b = l;
   }


Regards,

Franz Holzinger

Reproduce code:
---------------
	$code .= '

for (var k=0; k<len; k++) {
	sb.options[k+1] = new Option(c[c[category][2][k]][0], c[category][2][k]);
}
for (var l=8; l>1; l--)	{
	b = l;
}'
...

Expected result:
----------------
The JavaScript output of the webbrowser shall be the text string from above.

Actual result:
--------------
The loop above get broken.

for (var k=0; k<len; k="" sboptionsk1="new" optioncccategory2k0="" ccategory2k="" for="" var="" l="">1; l--)	{
       	b = l;
       }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-25 07:36 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2006-08-15 12:17 UTC] franz at fholzinger dot com
I agree.

http://bugs.typo3.org/view.php?id=1477
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 12:01:33 2025 UTC