|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23160 Commenting *?>* fails
Submitted: 2003-04-10 19:06 UTC Modified: 2003-04-10 19:34 UTC
From: spoon at nexdot dot net Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5CVS-2003-04-10 (dev) OS: Windows XP Pro SP1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: spoon at nexdot dot net
New email:
PHP Version: OS:


 [2003-04-10 19:06 UTC] 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:


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:


commented for testing purposes:


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:
Inside of a function to be commented:
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 :-)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-10 19:34 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

We must end the script part with ?>. We must do it because we ill be compatible to xml by doing so.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 08:01:28 2024 UTC