#33081 [NEW]: T_OPEN_TAG eats whitespace

From: Date: Fri, 20 May 2005 13:53:05 +0000
Subject: #33081 [NEW]: T_OPEN_TAG eats whitespace
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79257@lists.php.net to get a copy of this message
From: jaa at interflow dot dk Operating system: FreeBSD PHP version: 5.0.4 PHP Bug Type: Zend Engine 2 problem Bug description: T_OPEN_TAG eats whitespace Description: ------------ The PHP tokenizer includes the first whitespace character after the opening php tag as a part of the opening tag. That is, the following code with one whitespace in between will be tokenized into two tokens, a start tag and a closing tag: <?php ?> While with two whitespaces in between will be tokenized into three tokens, an opening tag including one space character, a whitespace token with one space character and a closing tag: <?php ?> I hope the whitespace doesn't get lost when I submit this ;-) Reproduce code: --------------- <?php $source = "<?php ?>"; $tokens = token_get_all($source); if($tokens[1][0] == T_WHITESPACE) { print "Whitespace found\n"; } else { print "Whitespace not found\n"; } ?> Expected result: ---------------- Whitespace found Actual result: -------------- Whitespace not found -- Edit bug report at http://bugs.php.net/?id=33081&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33081&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33081&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33081&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33081&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33081&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33081&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33081&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33081&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33081&r=support Expected behavior: http://bugs.php.net/fix.php?id=33081&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33081&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33081&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33081&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33081&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33081&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33081&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33081&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33081&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33081&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33081&r=mysqlcfg

« previous php.bugs (#79257) next »