#23160 [Opn->Bgs]: Commenting *?>* fails

From: Date: Fri, 11 Apr 2003 00:34:36 +0000
Subject: #23160 [Opn->Bgs]: Commenting *?>* fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37543@lists.php.net to get a copy of this message
ID: 23160 Updated by: helly@php.net Reported By: spoon at nexdot dot net -Status: Open +Status: Bogus Bug Type: Output Control Operating System: Windows XP Pro SP1 PHP Version: 5CVS-2003-04-10 (dev) 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 We must end the script part with ?>. We must do it because we ill be compatible to xml by doing so. Previous Comments: ------------------------------------------------------------------------ [2003-04-10 19:06:51] spoon at nexdot dot net ('type of bug' may be wrong, just sounded right) When you comment ?> such as: //?> PHP sees it as the ending of a script. I _assume_ this is correctly done, since: <? phpinfo(); //blah?> is valid code. (unless i am wrong, and //?> is either supposed to be parsed as commented/invalid, then it's only another instance where the bug occurs :-) BUT, when commenting (with //) something that includes ?> ANYWHERE, it still ends the script (which i also _assume_ is wrong, becuase of the circumstances of the comment). Such as, in my case: preg_match('/<.*?>/',$file,$match); commented for testing purposes: //preg_match('/<.*?>/',$file,$match); The above (commented preg_match) will end the script, and everything below is treated as non-php and displayed to browser/stdout. This should NOT be happening, since regexp's (as an example) can potentialy contain this combination of characters (?>). I have tested it with these string, and the bug exists: Inside of text to be commented: //sd;lfksdl;fk;sdf?>sd;fkljskl;dfj Inside of a function to be commented: //preg_match('/<.*?>/',$file,$match); As the only item in a comment: //?> Now, using /* ?> */ (or any of the strings mentioned above) correctly is parsed as a comment. I have not checked other commenting methods (to tell you the truth, im not sure if there are more ways, these are the only two i ever use :-) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23160&edit=1

« previous php.bugs (#37543) next »