ID: 47920 Updated by: ras...@php.net Reported By: odarcan at gmail dot com Status: Bogus Bug Type: Feature/Change Request Operating System: all PHP Version: 5.3.0RC1 New Comment:
The parser isn't line-oriented though. This is perfectly valid, for example: $a = $b = $c = 0; but this isn't: $a = 1 $b = $c = 0; Here we get "syntax error, unexpected T_VARIABLE" when it hits the $b there which is perfectly correct. Throwing an error that assumes something that isn't there, a ';' at the end of the first line in this example, doesn't make any sense. All we can do is throw an error when we hit something that doesn't fit in the grammar. That is how all parsers work. They match text to a grammar and throw an error when it doesn't match. Trying to make the error handler guess how the code could be modified to make it valid is much too hard and error-prone. Previous Comments: ------------------------------------------------------------------------ [2009-04-08 18:39:27] odarcan at gmail dot com i suggest you rethink this is a feature request. if all lines end with ; except for one.. and php is about to give a syntax error for the next line, you can be damn sure that a ; is missing. submit=send ------------------------------------------------------------------------ [2009-04-08 17:59:40] johan...@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 That's not that easy, you might also miss a "+" or something completely different. ------------------------------------------------------------------------ [2009-04-08 02:44:07] odarcan at gmail dot com Description: ------------ the Parse error: syntax error, unexpected T_VARIABLE in C:\Lighty\HTDOCS\3.php on line 58 to: "You forgot a ';' dear user!" Reproduce code: --------------- <?php $a=5 $b=4; Expected result: ---------------- You forgot a ';' dear user! Actual result: -------------- Parse error: syntax error, unexpected T_VARIABLE in C:\Lighty\HTDOCS\3.php on line 58 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47920&edit=1