#31491 [Bgs->Opn]: Comment (/* */) parsing is also done inside strings
| From: | jeroen at unfix dot org | Date: | Tue, 11 Jan 2005 11:48:44 +0000 |
| Subject: | #31491 [Bgs->Opn]: Comment (/* */) parsing is also done inside strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-71847@lists.php.net to get a copy of this message | ||
ID: 31491
User updated by: jeroen at unfix dot org
Reported By: jeroen at unfix dot org
-Status: Bogus
+Status: Open
Bug Type: Zend Engine 2 problem
Operating System: any
PHP Version: 5.0.3
New Comment:
Compiling that works fine with GCC++, Intel C++ and Visual C++. Thus
fix the documentation on the PHP site.
Indeed, it does not compile with C, but it does with a C++ compiler. C
doesn't allow nested /* */ commenting.
Previous Comments:
------------------------------------------------------------------------
[2005-01-11 12:33:53] tony2001@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
Try to compile this:
#include <stdlib.h>
int main() {
/*
printf("*/");
*/
return 1;
}
------------------------------------------------------------------------
[2005-01-11 12:23:48] jeroen at unfix dot org
Description:
------------
Comments (/* */) are parsed wrongly. This works in most (if not all)
C-compilers, with a similar construct.
"http://www.php.net/manual/en/language.basic-syntax.comments.php"
notes:
"PHP supports 'C', 'C++' and Unix shell-style comments."
And there are two other similar bug reports (Bug #31395: incorrect
parsing of comments), and quite apparently PHP does *NOT* support C++
style comments. If it did it would not barf at the above.
Reproduce code:
---------------
<?php
/*
echo "*/";
*/
echo "Blaat\n";
?>
Expected result:
----------------
Blaat
Actual result:
--------------
--- 5.0.3 ---
$ /opt/php/5.0/bin/php tst.php
PHP Parse error: parse error, unexpected T_STRING in /tmp/tst.php on
line 6
Content-type: text/html
X-Powered-By: PHP/5.0.3
--- 4.3.10-2 (debian's php4-cli 4:4.3.10-2) ---
$ php -v
PHP 4.3.10-2 (cli) (built: Dec 19 2004 03:41:45)
$ php tst.php
Parse error: parse error, unexpected T_STRING in /tmp/tst.php on line
6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31491&edit=1