PHP 4.0 Bug #8233 Updated: # and // don't work as comment, whereas /*..*/ do
| From: | joey@php.net | Date: | Wed, 13 Dec 2000 20:34:26 +0000 |
| Subject: | PHP 4.0 Bug #8233 Updated: # and // don't work as comment, whereas /*..*/ do | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-41216@lists.php.net to get a copy of this message | ||
ID: 8233
Updated by: joey
Reported By: stefan.peer@tiwag.co.at
Old-Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
http://www.php.net/manual/language.basic-syntax.comments.php
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.
Previous Comments:
---------------------------------------------------------------------------
[2000-12-13 14:22:51] jmoore@php.net
Note from Chris Newbill <cnewbill@onewest.net>
------------------------------------------
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.)
<?php
if (true) {
// ?>
}
?>
By contrast this script (outside of a logical block)
<?php
//?>
?>
Would actually print "?>" to the screen
Chris
---------------------------------------------------------------------------
[2000-12-13 10:30:08] stefan.peer@tiwag.co.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];
break;
}
These lines bring up the errormessage "Parse error: parse error in includes/functions.inc 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
--with-mysql=/usr/local/mysql
--with-config-file-path=/usr/lib
--with-pdflib=/usr/lib/libpdf.so
--with-gdbm=/usr/lib/libgdbm.so
--enable-ftp
--enable-filepro
--with-java=/usr/lib/java
--with-ldap
--with-openssl=/usr/local/openssl
--enable-sysvsem
--enable-sysvshm
--enable-track-vars
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8233