note 99891 added to function.eval
| From: | php at rijkvanwel dot nl | Date: | Mon, 13 Sep 2010 14:41:16 +0000 |
| Subject: | note 99891 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172510@lists.php.net to get a copy of this message | ||
To catch a parse error in eval()'ed code with a custom error handler, use error_get_last() (PHP
>= 5.2.0).
<?php
$return = eval( 'parse error' );
if ( $return === false && ( $error = error_get_last() ) ) {
myErrorHandler( $error['type'], $error['message'], $error['file'],
$error['line'], null );
// Since the "execution of the following code continues normally", as stated in the
manual,
// we still have to exit explicitly in case of an error
exit;
}
?>
----
Server IP: 213.249.64.162
Probable Submitter: 82.93.68.91
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/99891
Del: integrated -- https://master.php.net/note/delete/99891/integrated
Del: useless -- https://master.php.net/note/delete/99891/useless
Del: bad code -- https://master.php.net/note/delete/99891/bad+code
Del: spam -- https://master.php.net/note/delete/99891/spam
Del: non-english -- https://master.php.net/note/delete/99891/non-english
Del: in docs -- https://master.php.net/note/delete/99891/in+docs
Del: other reasons-- https://master.php.net/note/delete/99891
Reject -- https://master.php.net/note/reject/99891
Search -- https://master.php.net/manage/user-notes.php