note 64110 added to function.set-exception-handler
| From: | mc-php-doco at oak dot homeunix dot org | Date: | Fri, 07 Apr 2006 16:41:20 +0000 |
| Subject: | note 64110 added to function.set-exception-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107529@lists.php.net to get a copy of this message | ||
This seems not to work when calling the PHP binary with the '-r' flag.
For example, if I run it like this:
php -r '
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "\n";
}
set_exception_handler("exception_handler");
throw new Exception("Uncaught Exception");
echo "Not Executed\n";
'
Or if I place it in a file and run it like this:
php -r 'include "./tmp.php";'
I get a stack trace instead of having the function 'exception_handler' called. If run it
like this:
php tmp.php
It works fine.
(Why run code from '-r'? Sometimes it's useful to add stuff around the include like
calls to microtime for benchmarks, or to include a library and then call a few functions from the
library, all in an ad-hoc way without having to create new files.)
PHP versions 5.1.2 and 5.0.4.
----
Server IP: 64.71.164.2
Probable Submitter: 198.144.201.110
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.set-exception-handler.php
Edit -- http://master.php.net/note/edit/64110
Del: integrated -- http://master.php.net/note/delete/64110/integrated
Del: useless -- http://master.php.net/note/delete/64110/useless
Del: bad code -- http://master.php.net/note/delete/64110/bad+code
Del: spam -- http://master.php.net/note/delete/64110/spam
Del: non-english -- http://master.php.net/note/delete/64110/non-english
Del: in docs -- http://master.php.net/note/delete/64110/in+docs
Del: other reasons-- http://master.php.net/note/delete/64110
Reject -- http://master.php.net/note/reject/64110
Search -- http://master.php.net/manage/user-notes.php