ID: 31491 Updated by: [EMAIL PROTECTED] Reported By: jeroen at unfix dot org -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: any PHP Version: 5.0.3 New Comment:
Duplicate to #31395. Previous Comments: ------------------------------------------------------------------------ [2005-01-11 13:00:41] jeroen at unfix dot org One cannot nest C comments, so that is clearly incorrect ;) ------------------------------------------------------------------------ [2005-01-11 12:56:14] [EMAIL PROTECTED] The docs clearly say: "You should be careful not to nest 'C' style comments, which can happen when commenting out large blocks." (c) http://www.php.net/manual/en/language.basic-syntax.comments.php ------------------------------------------------------------------------ [2005-01-11 12:48:43] jeroen at unfix dot org 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. ------------------------------------------------------------------------ [2005-01-11 12:33:53] [EMAIL PROTECTED] 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
