From:             
Operating system: Redhat Linux
PHP version:      5.3.2
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:Lack of error context with nested exceptions

Description:
------------
In short, if you thrown an exception from within the exception handler, you
get an uninformative error message with no contextual information.  It
makes sense for this case to be a fatal error.  We don't want to get
recursive throwing of exceptions and spiral to our death.



If you create an exception in the error handler without throwing it, it has
the correct info about where it was created. This is enough to figure out
where the error is coming from.  It is at least far more informative and
gives you a starting place in a potentially complex code base.



>From my quick look at the code in Zend/zend_exceptions.c:94 where this
originates.  It looks like the exception is there, and that would have
file/line num info.

Test script:
---------------
<?php



set_exception_handler("exceptionHandler");



function exceptionHandler($excp)

{

        throw new Exception("Error 2");

}



throw new Exception("Error 1");

Expected result:
----------------
Fatal Error: Error 2

Actual result:
--------------
Fatal error: Exception thrown without a stack frame in Unknown on line 0

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

Reply via email to