#33081 [Opn->Bgs]: T_OPEN_TAG eats whitespace

From: Date: Fri, 20 May 2005 14:59:01 +0000
Subject: #33081 [Opn->Bgs]: T_OPEN_TAG eats whitespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79267@lists.php.net to get a copy of this message
ID: 33081 Updated by: derick@php.net Reported By: jaa at interflow dot dk -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: FreeBSD PHP Version: 5.0.4 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2005-05-20 15:53:04] jaa at interflow dot dk 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 this bug report at http://bugs.php.net/?id=33081&edit=1

« previous php.bugs (#79267) next »