[PEAR-BUG] Bug #20962 [Com]: MDB2_Error constructor is calling undefined function PEAR_Error().

[email protected] ("[email protected]") Fri, 9 Oct 2015 20:35:32 +0100 (BST)
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=20962&edit=1

 ID:               20962
 Comment by:       [email protected]
 Reported By:      justin dot rebelo at gmail dot com
 Summary:          MDB2_Error constructor is calling undefined function
                    PEAR_Error().
 Status:           Open
 Type:             Bug
 Package:          MDB2
 Operating System: Debian linux
 Package Version:  2.5.0b5
 PHP Version:      5.6.13
 Roadmap Versions: 
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2015-10-09 20:01:47] jrebelo

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

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20962&edit=1