|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8233 # and // don't work as comment, whereas /*..*/ do
Submitted: 2000-12-13 10:30 UTC Modified: 2000-12-13 15:34 UTC
From: stefan dot peer at tiwag dot co dot at Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: Linux Kernel 2.2.14, Apache 1.3.
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: stefan dot peer at tiwag dot co dot at
New email:
PHP Version: OS:


 [2000-12-13 10:30 UTC] stefan dot peer at tiwag dot co dot at
Hi, I had a problem commenting out code fragments.
The problem within the following lines is the single-line comment //
# as comment seems to have the same problem whereas /* ... */ works fine.

if( preg_match( "/(.*?)ELEMENT_(\d+)\{(.*?)\}((<.*?>)+)/", $template_lines[$j], $matched) ){ 
    //preg_match("/(.*?)ELEMENT_LAST\{(.*?)\}((<.*?>)+)/", $template_lines[$j], $matched)
    $debug_msg .= "Matched /(.*?)ELEMENT_(\d+)\{(.*?)\}((<.*?>)+)/ within X";
    $iterations = $matched[2];
These lines bring up the errormessage "Parse error: parse error in includes/ on line 408", where 408 is the last line of the file.

I am not sure, whether this has to do with commenting out regular expressions.
By the way, I'm using Apache 1.3.14, SuSE 6.4 Linux and I've compiled php with the following switches:
./configure --with-apache=/root/apache/apache_1.3.14 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-13 14:22 UTC]
Note from Chris Newbill <>
I don't have the ability to update bugs, but I can duplicate this problem.

If you escape ?> in your commented line it should work fine.  ie \?\>

You can reproduce this with the following simple script. (it only happens in
logical blocks.)


if (true) {
// ?>


By contrast this script (outside of a logical block)


Would actually print "?>" to the screen


 [2000-12-13 15:34 UTC]
The "one-line" comment styles actually only comment to the
end of the line or the current block of PHP code, whichever
comes first.

The parser sees ?> as the end of the block of PHP code.
The function call is not being interpreted, so the engine
does not know what context it is running under.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 06:01:23 2020 UTC