Req #41810 [Com]: Unable to catch Parse Errors
| From: | james dot dobb at gmail dot com | Date: | Sat, 15 Sep 2012 20:53:11 +0000 |
| Subject: | Req #41810 [Com]: Unable to catch Parse Errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173467@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=41810&edit=1
ID: 41810
Comment by: james dot dobb at gmail dot com
Reported by: d dot albano at gmail dot com
Summary: Unable to catch Parse Errors
Status: Not a bug
Type: Feature/Change Request
Package: *General Issues
Operating System: Linux
PHP Version: 5.2.3
Block user comment: N
Private report: N
New Comment:
I agree that this, perhaps not a bug but a missing feature needs to be addressed,
There should be a secure way of including scripts from another script and be able
to continue the calling script if an error occurs, the lack of functionality here
is causing me a major headache.....
Previous Comments:
------------------------------------------------------------------------
[2010-07-02 13:41:24] pajoye@php.net
It is not, please double read the manual about require/include_once.
------------------------------------------------------------------------
[2010-07-02 12:34:32] sneak at datavibe dot net
This classification is not bogus at all. Consider the following:
== main.php ==
<?php
$filename = sprintf("%s.php", 'myfile' );
include_once($filename);
?>
== myfile.php ==
<?php
syntax errors here !@#$%^&*()_
?>
The parsing of myfile.php must necessarily happen at main.php's RUNTIME, because
the filename is not available until sprintf() is called.
This is a bug.
------------------------------------------------------------------------
[2007-07-03 16:36:51] tony2001@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
------------------------------------------------------------------------
[2007-07-03 16:29:58] d dot albano at gmail dot com
Looking to the code looks simply to do the modification, naturally, as you said, the problem is
testing.
However i founded an eval behaviour to support my feature request: if there is a parse error
execution continues
Can be that this is a bug or an unwanted behaviour, however nothing start to work strange after that
a parse error was outputted.
So, if all works with eval why it shouldn't work correctly with normal parse errors?
Here there is some example code:
<?php
echo "BEGIN";
eval('echo "{$SYNTAX-ERROR"');
echo "END";
?>
It output
BEGIN
Parse error: syntax error, unexpected '-', expecting '}' in
C:\web\htdocs\test.php(5) : eval()'d code on line 1
END
------------------------------------------------------------------------
[2007-06-26 13:07:22] d dot albano at gmail dot com
When i said:
> If it remains in a unstable state there is serious problem somewhere
i answered to your phrase:
> After parse error the parser/compiler and whole engine may be in
unstable state
If parsing a file may put the entire engine in an unstable state there is a problem: never heard
that a parser can do this
The problem can be that the engine is written to shutdown after a parser error and this is can cause
troubles i think, but the problem is that i'm not zend/php developer :)
However i don't think that is necessary to rewrite the engine from the scracth, a feature like
this, at logic level, must follow rules followed by other errors
This afternoon i'll take a look to the parser and to the zend engine to understand how errors
are passed
Thanks a lot
Bye
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=41810
--
Edit this bug report at https://bugs.php.net/bug.php?id=41810&edit=1