|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-01-17 13:40 UTC] 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:
--------------
';
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 14:00:01 2025 UTC |
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.