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

Bug #18874 adding a static element throws Fatal Error
Submitted: 2011-09-26 10:26 UTC
From: rolan Assigned: avb
Status: Closed Package: HTML_QuickForm2 (version 0.6.0)
PHP Version: 5.2.10 OS: CentOS release 5.4
Roadmaps: (Not assigned)    
Subscription  


 [2011-09-26 10:26 UTC] rolan (Rolan Yang)
Description: ------------ Seems the "= null" declaration of setName in Static.php conflicts with the Node declaration "abstract public function setName($name);" Error goes away "= null" is removed. --- /usr/local/lib/php/HTML/QuickForm2/Element/Static.php.orig 2011-09-25 23:17:42.000000000 -0400 +++ /usr/local/lib/php/HTML/QuickForm2/Element/Static.php 2011-09-25 23:17:53.000000000 -0400 @@ -132,7 +132,7 @@ * @param string|null * @return HTML_QuickForm2_Element_Static */ - public function setName($name = null) + public function setName($name) { if (null !== $name) { return parent::setName($name); Test script: --------------- $form->addElement('static','',array('style'=>'width:50px;height:20px;'),array('tagName'=>'div','forceClosingTag'=>TRUE)); Expected result: ---------------- expect it not to crash Actual result: -------------- Fatal error: Declaration of HTML_QuickForm2_Element_Static::setName() must be compatible with that of HTML_QuickForm2_Node::setName() in /usr/local/lib/php/HTML/QuickForm2/Element/Static.php on line 275

Comments

 [2011-09-26 13:20 UTC] avb (Alexey Borzov)
-Status: Open +Status: Verified -Assigned To: +Assigned To: avb
Ouch. Bad idea not to test under 5.2.x...
 [2011-09-28 19:37 UTC] avb (Alexey Borzov)
-Status: Verified +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. On a bright side, all unit tests run OK under PHP 5.2.x