php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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:

     <?
     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 :-)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-10 19:34 UTC] helly@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 27 16:01:27 2024 UTC