#48566 [NEW]: set_exception_handler doesn't catch an exception created by imap_fetchstructure

From: Date: Tue, 16 Jun 2009 07:47:58 +0000
Subject: #48566 [NEW]: set_exception_handler doesn't catch an exception created by imap_fetchstructure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138352@lists.php.net to get a copy of this message
From:             e dot mortoray at ecircle dot com
Operating system: Linux
PHP version:      5.2.9
PHP Bug Type:     Scripting Engine problem
Bug description:  set_exception_handler doesn't catch an exception created by
imap_fetchstructure

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 bug report at http://bugs.php.net/?id=48566&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=48566&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=48566&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=48566&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=48566&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48566&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=48566&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=48566&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=48566&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=48566&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=48566&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=48566&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=48566&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=48566&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=48566&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48566&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48566&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=48566&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=48566&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=48566&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=48566&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=48566&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#138352) next »