PHP 4.0 Bug #9320 Updated: ?> is always the last (even in strings!!!)

From: Date: Sat, 17 Feb 2001 18:13:02 +0000
Subject: PHP 4.0 Bug #9320 Updated: ?> is always the last (even in strings!!!)
Groups: php.dev 
Request: Send a blank email to php-dev+get-46795@lists.php.net to get a copy of this message
ID: 9320 User Update by: goba@php.net Status: Bogus Bug Type: Scripting Engine problem Description: ?> is always the last (even in strings!!!) It is bug, bug and bug!!! See the manual : | The "one-line" comment styles actually only | comment to the end of the line or the current | block of PHP code, whichever comes first. The thing echoed should not mean the end of the block: 1: <?php 2: #echo "<?php echo 'test'; ?>"; 3: ?> The block starts on line 1 and ends on line 3. I think we can agree on this. BUT: the PHP parser thinks that the end of code is on line 2, but this is just one thing echoed, and not meant to be parsed by this PHP parser... The end of block is on line 3. This is not documented! Previous Comments: --------------------------------------------------------------------------- [2001-02-17 13:02:28] derick@php.net This is not a bug, but documented behaviour. --------------------------------------------------------------------------- [2001-02-17 12:14:46] goba@php.net See this code: <?php echo "<?php echo 'test'; ?>"; ?> This works good. And prints: <?php echo 'test'; ?> which it should print. Then using a comment: <?php #echo "<?php echo 'test'; ?>"; ?> This prints: "; ?> The ?> is recognized in the string, although it should not be recognized I think!!! This is a problem if you generate php pages, as Smarty does for expample... (phpinsider.com) --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=9320

« previous php.dev (#46795) next »