#46305 [Opn->Bgs]: Exception handler not invoked when using -r command line option
| From: | jani@php.net | Date: | Tue, 21 Apr 2009 10:34:38 +0000 |
| Subject: | #46305 [Opn->Bgs]: Exception handler not invoked when using -r command line option | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136073@lists.php.net to get a copy of this message | ||
ID: 46305
Updated by: jani@php.net
Reported By: jbq at caraldi dot com
-Status: Open
+Status: Bogus
Bug Type: CGI related
Operating System: *
PHP Version: 5CVS-2008-10-24
New Comment:
Like said in manual page for CLI: "Note: This option is meant for a
very basic stuff." http://php.net/cli
What you're doing isn't basic.
Previous Comments:
------------------------------------------------------------------------
[2008-10-15 15:42:56] jbq at caraldi dot com
Description:
------------
When using the "-r" or "-run" command-line option to execute code, a
custom exception handler is not invoked.
Reproduce code:
---------------
$ cat command_line_exception_handler.php
<?
function handler($e) {
print "Caught exception " . $e->getMessage() . "\n";
}
set_exception_handler("handler");
throw new Exception("Hello, World!");
Expected result:
----------------
$ php command_line_exception_handler.php
Caught exception Hello, World!
$ php -r "require 'command_line_exception_handler.php';"
Caught exception Hello, World!
Actual result:
--------------
$ php command_line_exception_handler.php
Caught exception Hello, World!
$ php -r "require 'command_line_exception_handler.php';"
Fatal error: Uncaught exception 'Exception' with message 'Hello,
World!' in /home/jbq/command_line_exception_handler.php:6
Stack trace:
#0 Command line code(1): require()
#1 {main}
thrown in /home/jbq/command_line_exception_handler.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46305&edit=1