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

Bug #20968 Incorrect call to __construct() from PEAR()
Submitted: 2015-10-16 15:31 UTC
From: edlman Assigned: cweiske
Status: Closed Package: PEAR (version 1.10.0)
PHP Version: Irrelevant OS: Linux
Roadmaps: 1.10.1    

 [2015-10-16 15:31 UTC] edlman (Martin Edlman)
Description: ------------ I encountered infinite loop because of incorrect call to __construct() from PEAR(). There is $this->__construct($error_class); called from PEAR($error_class) but it should be self::__construct($error_class); Otherwise is can create infinite loops, see test script and actual result Test script: --------------- <?php // HTML_Template_Sigma is a PEAR package MyObj extends HTML_Template_Sigma { public function __construct($root = null, $cache = null) { parent::__construct($root, $cache); // other init stuff } } new MyObj("/template/root/dir/", "/templare/cache/dir"); ?> Expected result: ---------------- Initialization of the object without loop Actual result: -------------- 1. parent::__construct() in MyObj::__construct() actually calls HTML_Template_Sigma($root, $cache) as HTML_Template_Sigma doesn't use __construct() constructor (I reported it to them). 2. Constructor HTML_Template_Sigma() then calls $this->PEAR() 3. PEAR($error_class = null) calls $this->__construct($error_class) but instead of calling its own __construct it calls MyObj::__construct() which creates infinite loop.


 [2015-10-16 15:31 UTC] edlman (Martin Edlman)
 [2015-10-17 15:58 UTC] cweiske (Christian Weiske)
-Status: Open +Status: Closed -Assigned To: +Assigned To: cweiske
Thanks for your patch! I've merged it into git stable; will be in PEAR 1.10.1.