#43434 [Opn->Bgs]: // style comments ending in ?> cause parsing errors

From: Date: Wed, 28 Nov 2007 08:24:03 +0000
Subject: #43434 [Opn->Bgs]: // style comments ending in ?> cause parsing errors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120163@lists.php.net to get a copy of this message
ID: 43434 Updated by: derick@php.net Reported By: smp_info at yahoo dot com -Status: Open +Status: Bogus Bug Type: *Programming Data Structures Operating System: Windows Vista PHP Version: 5.2.5 New Comment: 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 ?> marks the end of a PHP block, even when prepended with // Previous Comments: ------------------------------------------------------------------------ [2007-11-28 05:47:58] smp_info at yahoo dot com Description: ------------ Any slash style comment (//) that ends with ?> will produce a parse error. With /* */ style comments, this does not happen. Have not tested with # style comments. Reproduce code: --------------- <?php //this line ends with ?> echo 'hello'; ?> and <?php class test { //this comment ends with ?> public function hello() { echo 'hello'; } } $test = new test(); $test->hello(); ?> Expected result: ---------------- I expect both examples to echo the word "hello". Actual result: -------------- First example: "echo 'hello'; ?>" is printed to the screen. Second example: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in C:\Apache2\Apache2\htdocs\crap\bug.php on line 5 On a real-world example where I encounted the problem, I got a Parse error: unexpected $end So the errors vary. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43434&edit=1

« previous php.bugs (#120163) next »