#23160 [NEW]: Commenting *?>* fails
| From: | spoon at nexdot dot net | Date: | Fri, 11 Apr 2003 00:06:51 +0000 |
| Subject: | #23160 [NEW]: Commenting *?>* fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-37542@lists.php.net to get a copy of this message | ||
From: spoon at nexdot dot net
Operating system: Windows XP Pro SP1
PHP version: 5CVS-2003-04-10 (dev)
PHP Bug Type: Output Control
Bug description: Commenting *?>* fails
('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 bug report at http://bugs.php.net/?id=23160&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23160&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23160&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23160&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23160&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23160&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23160&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23160&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23160&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23160&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23160&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23160&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23160&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23160&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23160&r=gnused