Edit report at https://bugs.php.net/bug.php?id=60777&edit=1
ID: 60777
User updated by: giguet at ens dot fr
Reported by: giguet at ens dot fr
Summary: bug in parsing one line comment
Status: Bogus
Type: Bug
Package: *General Issues
Operating System: linux squeeze
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for your useful comments.
I thought php would have parsed until the end of line, whatever the content is.
When you comment this kind of line, it's not easy to remember
that the ?> will close the php block since it is not clear.
In my code it was a // $content = preg_replace('~<.*?>~','',$content); which
generated the problem.
Previous Comments:
------------------------------------------------------------------------
[2012-01-17 16:44:20] [email protected]
But you end the current PHP block with ?>. The parser doesn't care that the
code
in the comment would be valid.
------------------------------------------------------------------------
[2012-01-17 15:34:35] giguet at ens dot fr
In my script this is a one line comment style and it does not comment to the
end of the line. If it was the case, php would not display the ;' following ?>
------------------------------------------------------------------------
[2012-01-17 13:46:41] laruence at gmail dot com
bogus, The "one-line" comment styles only comment to the end of the line or the
current block of PHP code,
see http://www.php.net/manual/en/language.basic-syntax.comments.php
------------------------------------------------------------------------
[2012-01-17 13:40:01] giguet at ens dot fr
Description:
------------
When the two character-string ?> is present in a one-line // comment
php interprets the rest of the line as php code.
PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 08:24:40)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
Test script:
---------------
<?php
// echo '?>';
?>
Actual result:
--------------
';
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60777&edit=1