Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.18

Bug #9101 PEAR_Exception::getCauseMessage() failure with a nested Exception
Submitted: 2006-10-20 07:25 UTC
From: aharvey at optimiser dot com Assigned: cellog
Status: Closed Package: PEAR (version 1.4.11)
PHP Version: 5_2 CVS-2006-10-20 OS: Linux (Ubuntu 6.06)
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 36 - 3 = ?

 
 [2006-10-20 07:25 UTC] aharvey at optimiser dot com (Adam Harvey)
Description: ------------ PEAR_Exception::__toString() throws a fatal error when the PEAR_Exception has a nested Exception. Note that a nested PEAR_Exception works, the failure only occurs when the nested exception inherits from Exception but not PEAR_Exception. Test script: --------------- <?php require_once 'PEAR/Exception.php'; try { throw new PEAR_Exception('Test exception.', new Exception('Nested exception.')); } catch (PEAR_Exception $e) { echo $e->__toString()."\n"; } ?> The patch at http://www.adamharvey.name/patches/PEAR_Exception-getCauseMessage.patch seems to fix the problem, but not being an expert on PEAR's internals, I don't know if that's actually the right solution. Expected result: ---------------- PEAR_Exception: Test exception. in /tmp/exception.php on line 7 Exception: Nested exception. in /tmp/exception.php on line 5 #0 {main} Actual result: -------------- Fatal error: Call to a member function getMessage() on a non-object in /usr/share/pear/PEAR/Exception.php on line 246 Call Stack: 0.0004 1. {main}() /tmp/exception.php:0 0.0028 2. PEAR_Exception->__toString() /tmp/exception.php:7 0.0028 3. PEAR_Exception->toText() /usr/share/pear/PEAR/Exception.php:305 0.0028 4. PEAR_Exception->getCauseMessage() /usr/share/pear/PEAR/Exception.php:365

Comments

 [2006-10-20 07:30 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-30 03:48 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!