Bug #51458 [Com]: Lack of error context with nested exceptions

2011-05-16 Thread paul at annesley dot cc
Edit report at http://bugs.php.net/bug.php?id=51458edit=1

 ID: 51458
 Comment by: paul at annesley dot cc
 Reported by:nlgordon at gmail dot com
 Summary:Lack of error context with nested exceptions
 Status: Closed
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Redhat Linux
 PHP Version:5.3.2
 Assigned To:stas
 Block user comment: N
 Private report: N

 New Comment:

More specifically, this was fixed between PHP 5.3.5 and PHP 5.3.6 in the
following 

revision:





r307523 | stas | 2011-01-17 08:24:43 +1100 (Mon, 17 Jan 2011) | 2 lines

Fix bug #47143, bug #51458 - provide more useful info in bad exception
cases



It didn't seem to make it into the ChangeLog, though.


Previous Comments:

[2011-01-16 22:26:38] s...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




[2011-01-16 22:24:47] s...@php.net

Automatic comment from SVN on behalf of stas
Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=307523
Log: Fix bug #47143, bug #51458 - provide more useful info in bad
exception cases


[2011-01-09 22:37:32] sailormax at inbox dot lv

same problem with 5.2.x after 5.2.5;

I had calling unexist function in exception handler. In result PHP
returned empty page and didn't write any error in logs. Not very
comfortable debug scripts in such conditions... :/


[2010-04-01 23:15:54] nlgordon at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=51458edit=1


Bug #51458 [Com]: Lack of error context with nested exceptions

2011-01-09 Thread sailormax at inbox dot lv
Edit report at http://bugs.php.net/bug.php?id=51458edit=1

 ID: 51458
 Comment by: sailormax at inbox dot lv
 Reported by:nlgordon at gmail dot com
 Summary:Lack of error context with nested exceptions
 Status: Open
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Redhat Linux
 PHP Version:5.3.2
 Block user comment: N
 Private report: N

 New Comment:

same problem with 5.2.x after 5.2.5;

I had calling unexist function in exception handler. In result PHP
returned empty page and didn't write any error in logs. Not very
comfortable debug scripts in such conditions... :/


Previous Comments:

[2010-04-01 23:15:54] nlgordon at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=51458edit=1