#48566 [Opn->Fbk]: set_exception_handler doesn't catch an exception created by imap_fetchstructure
ID: 48566
Updated by: jani@php.net
Reported By: e dot mortoray at ecircle dot com
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.2.9
-Assigned To:
+Assigned To: jani
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2009-06-16 07:47:58] e dot mortoray at ecircle dot com
Description:
------------
If imap_fetchstructure encounters a message which contains an invalid
sequence in a header field it somehow creates a deferred exception which
is thrown on exit and is *not* caught by the handler defined in
set_exception_handler.
I have not been able to produce an exact reproduction but I can
confirm:
-the global exception handler is normally working
-it is something that imap_fetchstructure is doing -- if I remove this
line it doesn't happen
--furthermore, it only seems to happen if one of the headers in the
email has an invalid sequence: no encoding specified and contains a
non-ascii character -- one which doesn't appear to be a valid latin1
character either
Expected result:
----------------
I'm not expecting any exception to be thrown, but if one is (due to a
class destructor exception) I'd expect it to be caught by the default
exception handler.
Actual result:
--------------
Just before PHP exits (after the script is finished) the following
error:
error_handler(): [8] Unknown: Missing parameter (errflg=3) in Unknown
at line 0
Fatal error: Exception thrown without a stack frame in Unknown on line
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48566&edit=1
Thread (2 messages)