#34782 [NEW]: token_get_all gives wrong result

From: Date: Fri, 07 Oct 2005 16:06:54 +0000
Subject: #34782 [NEW]: token_get_all gives wrong result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86203@lists.php.net to get a copy of this message
From: linus at mccabe dot nu Operating system: Linux & Windows PHP version: 5.0.5 PHP Bug Type: Scripting Engine problem Bug description: token_get_all gives wrong result Description: ------------ This is bug 29761, I'd like to see it reopened. (it might also be 33093, not sure) Create the two php files in 'reproduce code'. Point your browser to 'test.php'. First time you should get the expected result, second the actual result. If you have many apache threads, you might need to refresh a few times until the error occurs. I've tested and reproduced this on: * Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5 * Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 (yes, error.php is supposed to have a parser error) thanks for your time /Linus Reproduce code: --------------- error.php: <?php print('abc' ; ?> test.php: <?php header('Content-Type: text/plain'); $first = token_get_all('<?php $a=$b;'); print_r($first); require('error.php'); ?> Expected result: ---------------- Array ( [0] => Array ( [0] => 366 [1] => <?php ) [1] => Array ( [0] => 309 [1] => $a ) [2] => = [3] => Array ( [0] => 309 [1] => $b ) [4] => ; ) <br /> <b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br /> Actual result: -------------- Array ( [0] => < [1] => ? [2] => Array ( [0] => 307 [1] => php ) [3] => Array ( [0] => 369 [1] => ) [4] => Array ( [0] => 309 [1] => $a ) [5] => = [6] => Array ( [0] => 309 [1] => $b ) [7] => ; ) <br /> <b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br /> -- Edit bug report at http://bugs.php.net/?id=34782&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34782&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34782&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34782&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34782&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34782&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34782&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34782&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34782&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34782&r=support Expected behavior: http://bugs.php.net/fix.php?id=34782&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34782&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34782&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34782&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34782&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34782&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34782&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34782&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34782&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34782&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34782&r=mysqlcfg

« previous php.bugs (#86203) next »