From: mikec at resnet dot net dot nz Operating system: Linux and Win32 PHP version: 5.3CVS-2008-05-02 (snap) PHP Bug Type: Scripting Engine problem Bug description: T_OPEN_TAG doesn't match <?php without any trailing characters
Description: ------------ First noticed when including a file containing only "<?php", without a trailing new line character. I expected this would output nothing, but instead it outputted "<?php" to the browser. This only occurs with 'short_open_tag' set to 'off', when set to 'on' including the same file outputs nothing, as expected. The tokenizer expects a character after the long open tag, I suggest that this be extended to check for the end of the input too. Reproduce code: --------------- var_dump(ini_get('short_open_tag')); print_r(token_get_all('<?php')); print_r(token_get_all('<?')); Expected result: ---------------- string(0) "" Array ( [0] => Array ( [0] => 368 [1] => <?php [2] => 1 ) ) Array ( [0] => Array ( [0] => 311 [1] => <? [2] => 1 ) ) Actual result: -------------- string(0) "" Array ( [0] => Array ( [0] => 311 [1] => <? [2] => 1 ) [1] => Array ( [0] => 311 [1] => php [2] => 1 ) ) Array ( [0] => Array ( [0] => 311 [1] => <? [2] => 1 ) ) -- Edit bug report at http://bugs.php.net/?id=44889&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44889&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44889&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44889&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44889&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44889&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44889&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44889&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44889&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44889&r=support Expected behavior: http://bugs.php.net/fix.php?id=44889&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44889&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44889&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44889&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44889&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44889&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44889&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44889&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44889&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44889&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44889&r=mysqlcfg