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

Bug #12512 incorrect declaration of toWords() in lang.fr.php (and others!)
Submitted: 2007-11-23 15:10 UTC
From: ndeguine Assigned: ifeghali
Status: Closed Package: Numbers_Words (version 0.15.0)
PHP Version: 5.2.4 OS: Windows
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 : 17 - 9 = ?

 
 [2007-11-23 15:10 UTC] ndeguine (Nicolas Deguine)
Description: ------------ In lang.fr.php, the toWords method is defined as this : function toWords($num = 0) When I call this method, I have the following message : Strict Standards: Declaration of Numbers_Words_fr::toWords() should be compatible with that of Numbers_Words::toWords() in C:\php\PEAR\Numbers\Words\lang.fr.php on line 438. We should have this : function toWords($num = 0, $power = 0, $powsuffix = '') The previous line can solve this bug. Test script: --------------- echo $nw->toWords(100000,'fr') ;

Comments

 [2008-07-21 13:10 UTC] doconnor (Daniel O'Connor)
Oops! Not just there but one or two other places. Nice find
 [2008-11-24 14:23 UTC] doconnor (Daniel O'Connor)
I forgot to add that lots of different drivers do this differently, and the definition of Numbers_Words::toWords() vs the drivers is completely different.
 [2008-12-02 17:46 UTC] kouber (Kouber Saparev)
How can I reporoduce the bug, i.e. get the same message? Also, isn't it correct for two brother methods (i.e. extending the same parent class) to have different signatures? They're providing the same functionality, by using different approaches (recursive or not) - hence the need of particular parameters.
 [2010-02-13 21:13 UTC] cweiske (Christian Weiske)
> How can I reporoduce the bug, i.e. get the same message? Enable E_STRICT standards and run the unit tests. > Also, isn't it correct for two brother methods (i.e. extending the same parent class) > to have different signatures? They're providing the same functionality, > by using different approaches (recursive or not) - hence the need of particular parameters. No, it is not correct. They do *not* provide the same functionality because the method in the parent class has more parameters than the one in the child class. This is the main problem. OK: parent: toWords($param1, $param2) child: toWords($param1, $param2) OK: parent: toWords($param1) child: toWords($param1, $param2) NOT ok: parent: toWords($param1, $param2) child: toWords($param1)
 [2010-08-16 17:13 UTC] doconnor (Daniel O'Connor)
Oops, r302346 is for this ticket, not the other one. http://test.pear.php.net:8080/cruisecontrol/buildresults/Numbers_Words?tab=testResults There will be a few more to fix I presume
 [2010-08-20 16:05 UTC] ifeghali (Igor Feghali)
Just FYI, thats what we got today: lang.bg.php: function toWords($num = 0, $locale = null) lang.cs.php: function toWords($num, $power = 0, $powsuffix = '') lang.de.php: function toWords($num, $power = 0, $powsuffix = '') lang.dk.php: function toWords($num, $power = 0, $powsuffix = '') lang.en_100.php: function toWords($num, $power = 0, $powsuffix = '') lang.en_GB.php: function toWords($num, $power = 0, $powsuffix = '') lang.en_US.php: function toWords($num, $power = 0, $powsuffix = '') lang.es.php: function toWords($num, $power = 0) lang.es_AR.php: function toWords($num, $power = 0) lang.et.php: function toWords($num, $power = 0, $powsuffix = '') lang.fr.php: function toWords($num = 0, $locale = null) lang.fr_BE.php: function toWords($num = 0, $locale = null) lang.he.php: function toWords($num, $power = 0, $powsuffix = '') lang.hu_HU.php: function toWords($num, $power = 0, $powsuffix = '') lang.id.php: function toWords($num, $power = 0, $powsuffix = '') lang.it_IT.php: function toWords($num, $power = 0) lang.lt.php: function toWords($num, $power = 0, $powsuffix = '') lang.nl.php: function toWords($num, $power = 0, $powsuffix = '') lang.pl.php: function toWords($num, $power = 0, $powsuffix = '') lang.pt_BR.php: function toWords($num, $locale = null) lang.ru.php: function toWords($num, $gender = 1) lang.sv.php: function toWords($num, $power = 0, $powsuffix = '')
 [2010-08-20 17:17 UTC] ifeghali (Igor Feghali)
I would say this is a design flaw and we should rethink it carefully. or perhaps do something like that for each applicable driver: function toWords($num, $locale = null) { return $this->_toWords($num, $power, $powsufix); } and rename toWords to _toWords. thoughts ?
 [2010-08-20 18:53 UTC] ifeghali (Igor Feghali)
Ok thinking a bit about it, that is what I suggest (example for pt_BR driver): function toWords($num, $locale = 'pt_BR') { return parent::toWords($num, $locale); } function _toWords(specific parameters for each driver) { // this should be the old toWords() method } Number_Words::toWords() should call Driver::_toWords(). this is not going to break backwards compatibility and will make things more clear, imo. any thoughts ?
 [2010-08-20 19:48 UTC] ifeghali (Igor Feghali)
 [2010-08-23 15:58 UTC] kouber (Kouber Saparev)
Indeed, it makes sense. That solution would save us the effort to rewrite all the drivers.
 [2010-08-24 21:51 UTC] ifeghali (Igor Feghali)
-Assigned To: makler +Assigned To: ifeghali
Kouber, great, I should have it fixed by today. Best, ~IF.
 [2010-08-25 06:14 UTC] ifeghali (Igor Feghali)
-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. Should be fixed by now. hu_HU and ru will need some special attention (they are currently broken).