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

Request #13024 abstract __toString() useless and inconsistent
Submitted: 2008-01-31 15:52 UTC
From: mansion Assigned:
Status: Wont fix Package: HTML_Common2 (version 2.0.0beta1)
PHP Version: Irrelevant OS: OSX
Roadmaps: (Not assigned)    
Subscription  


 [2008-01-31 15:52 UTC] mansion (Bertrand Mansion)
Description: ------------ __toString() is declared as abstract in HTML_Common2. Its declaration doesn't follow PHP5's own declaration and therefore limits its possibilities, for example accepting parameters. It is allowed by PHP5 to do __toString($param = null). Your declaration doesn't allow this. Is it possible to have __toString() removed from HTML_Common2 in order to implement renderers for HTML_QuickForm2. Thanks.

Comments

 [2008-07-21 18:05 UTC] avb (Alexey Borzov)
Most probably we won't need parameters for __toString() to implement QF2 renderers. Also having parameters for a method that usually does not accept those violates the principle of least surprise...
 [2008-10-13 15:02 UTC] doconnor (Daniel O'Connor)
This is currently causing fatal errors when trying to run the pear wide test suite. You say: "Most probably we won't need parameters for __toString() to implement QF2 renderers." but the current CVS for HTML_Quickform2 it is: public function __toString(HTML_QuickForm2_Renderer $renderer) { $html[] = sprintf('<form%s>', $this->getAttributes(true) ); $html[] = parent::__toString($renderer); $html[] ='</form>'; return implode(self::getOption('linebeak'), $html); } ... so which is it?
 [2008-10-13 15:07 UTC] doconnor (Daniel O'Connor)
Attached patch swaps us from a fatal error to a E_STRICT
 [2008-10-16 17:23 UTC] avb (Alexey Borzov)
Changed signature of HTML_QuickForm2::__toString(), no more E_FATAL.