#20814 [NEW]: reproducable, freaky parse error in 'here document' structure

From: Date: Wed, 04 Dec 2002 17:04:39 +0000
Subject: #20814 [NEW]: reproducable, freaky parse error in 'here document' structure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26636@lists.php.net to get a copy of this message
From: kumar@chicagomodular.com Operating system: several PHP version: 4.2.3 PHP Bug Type: Scripting Engine problem Bug description: reproducable, freaky parse error in 'here document' structure I've tested this on PHP 4.2.3 for OSX, Open BSD, Linux... If you leave any whitespace after the closing tag of a here document structure (not sure if that's what it is called, like in Perl) a parse error will occur but never for the correct line. This seems like a bug to me because a semi- colon should terminate the code allowing the programmer to put comments or whatever after the semi-colon. Here is an example: $variable = "variable"; $someVariable = <<<hereDocument <html> <body> <b>text text $variable testing here document</b> </body> </html> hereDocument; // closing comment or just whitespace echo $someVariable; After the closing "hereDocument;" if you leave any whitespace (other than a carriage return) or text, a parse error is generated but the line number never leads you to the right place. This can be very confusing if you are working on a large class (like I was) and you left a tab or space after a closing tag. I'm not sure how consciously supported the here document structure is but this is worth addressing since here documents can be very useful for storing large variables containing HTML code with double and single quotes, for example. While I'm submitting this bug, I might as well point -- Edit bug report at http://bugs.php.net/?id=20814&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20814&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20814&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20814&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20814&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20814&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20814&r=support Expected behavior: http://bugs.php.net/fix.php?id=20814&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20814&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20814&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20814&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20814&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20814&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20814&r=isapi

« previous php.bugs (#26636) next »