#43434 [NEW]: // style comments ending in ?> cause parsing errors

From: Date: Wed, 28 Nov 2007 05:47:59 +0000
Subject: #43434 [NEW]: // style comments ending in ?> cause parsing errors
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120159@lists.php.net to get a copy of this message
From: smp_info at yahoo dot com Operating system: Windows Vista PHP version: 5.2.5 PHP Bug Type: *Programming Data Structures Bug description: // style comments ending in ?> cause parsing errors 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 bug report at http://bugs.php.net/?id=43434&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43434&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43434&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43434&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43434&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43434&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43434&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43434&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43434&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43434&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43434&r=support Expected behavior: http://bugs.php.net/fix.php?id=43434&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43434&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43434&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43434&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43434&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43434&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43434&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43434&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43434&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43434&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43434&r=mysqlcfg

« previous php.bugs (#120159) next »