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

Bug #20962 MDB2_Error constructor is calling undefined function PEAR_Error().
Submitted: 2015-10-10 00:01 UTC
From: jrebelo Assigned: danielc
Status: Closed Package: MDB2 (version 2.5.0b5)
PHP Version: 5.6.13 OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


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 + 22 = ?

 
 [2015-10-10 00:01 UTC] jrebelo (Justin Rebelo)
Description: ------------ File: MDB2.php. Line: 978. $this->PEAR_Error() is an invalid call because PEAR.php has been upgraded and the PEAR_Error class now defines the ::__construct() constructor instead of ::PEAR_Error() constructor. If MDB2 tries to throw an MDB2_Error, this causes a fatal php error: Call to undefined method MDB2_Error::PEAR_Error() in /usr/share/php/MDB2.php on line 978 Test script: --------------- <?php require_once('MDB2.php'); $error = new MDB2_Error('test'); echo "Hello"; Expected result: ---------------- It should print "Hello" to the console when run on the shell. Actual result: -------------- PHP Fatal error: Call to undefined method MDB2_Error::PEAR_Error() in /usr/share/php/MDB2.php on line 978 PHP Stack trace: PHP 1. {main}() /home/username/test.php:0 PHP 2. MDB2_Error->__construct() /home/username/test.php:3 Fatal error: Call to undefined method MDB2_Error::PEAR_Error() in /usr/share/php/MDB2.php on line 978 Call Stack: 0.0003 222376 1. {main}() /home/username/test.php:0 0.0088 1004416 2. MDB2_Error->__construct() /home/username/test.php:3

Comments

 [2015-10-10 00:35 UTC] jrebelo (Justin Rebelo)
I think the simple and hopefullly correct fix here is to replace the $this->PEAR_Error() call with parent::__construct(). I am not sure on exactly how patches are meant to be formatted for submission, though.
 [2015-10-10 00:48 UTC] jrebelo (Justin Rebelo)
 [2015-10-13 20:27 UTC] jrebelo (Justin Rebelo)
-Operating System: Debian linux +Operating System: Irrelevant
 [2015-11-21 18:39 UTC] danielc (Daniel Convissor)
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: danielc
Upgrade your PEAR install. Commit 64782496 re-added the PEAR_Error() method. None the less, I'll change the MDB2 code to use __construct().
 [2015-11-23 07:48 UTC] danielc (Daniel Convissor)
-Status: Analyzed +Status: Closed
Fix committed.