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

Bug #19153 Wrong Parameters for Exception
Submitted: 2011-12-21 20:33 UTC
From: jonez Assigned: danielc
Status: Analyzed Package: PEAR
PHP Version: 5.3.7 OS: Debian Squeeze
Roadmaps: 1.10.0    
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 : 13 - 8 = ?

 
 [2011-12-21 20:33 UTC] jonez (Jeff MacDonald)
Description: ------------ PHP Warning: PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions in /usr/share/php/PEAR.php on line 894 PHP Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in /usr/share/php/PEAR.php(895) : eval()'d code on line 1

Comments

 [2011-12-21 21:56 UTC] till (Till Klampaeckel)
-Roadmap Versions: +Roadmap Versions: 0.8.0
Do you have a stack trace? (Enable xdebug to get one) I'm not sure where this is coming from. There's two issues in one. I'm not even sure if this is from HTTP_Session2 code or if this is your error handler around it.
 [2011-12-21 21:56 UTC] till (Till Klampaeckel)
-Assigned To: +Assigned To: till
 [2011-12-21 22:15 UTC] jonez (Jeff MacDonald)
I am not able to reliably trigger this issue.
 [2011-12-22 03:29 UTC] jonez (Jeff MacDonald)
I went through and modified most of the files in the package to use raiseError() instead of 'throw', but that did not resolve the issue. I am testing another of my sites, and I consistently get a WSOD when trying to use the package. When I comment out my calls into the package, the site displays normally.
 [2011-12-23 23:49 UTC] till (Till Klampaeckel)
-Package: HTTP_Session2 +Package: MDB2 -Roadmap Versions: 0.8.0 +Roadmap Versions:
Assigning this bug to MDB2 since I can't fix it in HTTP_Session2.
 [2011-12-23 23:51 UTC] jonez (Jeff MacDonald)
The issue is the way MDB2 uses Error objects. It does not pass a "message" parameter, which PEAR's error handler is expecting.
 [2011-12-24 01:23 UTC] danielc (Daniel Convissor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: danielc
This was happening when taking a PEAR_Error object returned by MDB2::raiseError() and passing it back to PEAR::raiseError(). When PEAR::raiseError() receives an object, it mistakenly assumes the destination/wrapper error_object's constructor has a $message parameter. MDB2_Error::__construct() does not, so the $code parameter's value was getting passed to the $mode parameter and mayhem ensued due to unexpected modes of operation. This has been fixed by adding reflection to PEAR::raiseError() in commit 6cbc32b6cf79094fb267621ed2090567eca41bd4.
 [2011-12-24 01:27 UTC] danielc (Daniel Convissor)
-Package: MDB2 +Package: PEAR
 [2014-05-29 12:28 UTC] cweiske (Christian Weiske)
-Roadmap Versions: +Roadmap Versions: 1.9.5
 [2014-06-03 01:10 UTC] cweiske (Christian Weiske)
(commit hash of david's commit after my re-import is 6d10feff7b97d2f6e65396f5a1fa6dab22871824) This bug cannot be fixed in 1.9.5 with reflection since that release will still be PHP4-compatible.
 [2014-06-03 01:16 UTC] cweiske (Christian Weiske)
The best way would be to fix MDB2_Error instead of adding special handling to PEAR_Error, but that breaks BC.
 [2014-06-03 01:26 UTC] cweiske (Christian Weiske)
-Roadmap Versions: 1.9.5 +Roadmap Versions: 1.10.0
 [2014-06-07 03:12 UTC] cweiske (Christian Weiske)
-Status: Closed +Status: Analyzed