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

Request #4055 Patch for Validate::multiple() and CreditCard::number()
Submitted: 2005-04-04 17:30 UTC
From: roehr at zilleon dot com Assigned: dufuz
Status: Closed Package: Validate
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-04-04 17:30 UTC] roehr at zilleon dot com
Description: ------------ Hi, I have created the following patches: [1] Validate::multiple() http://www.zilleon.de/PEAR/Validate/Validate.diff.txt http://www.zilleon.de/PEAR/Validate/Validate.php.txt This patch changes the resolving of the class/method name when using one of Validate's subpackages. Until now only the first two elements (e.g. us_ssn) were recognized. This made it impossible to use the CreditCard or IBAN classes because their call consists of three parts: Finance_CreditCard_number Finance_IBAN_validate Now the last part is used as the method name and the rest makes up the class name. To use the CreditCard package within multiple you need to declare: 'type' => 'Finance_CreditCard_number' Because I have only removed a limitation, BC should be guaranteed. [2] Validate_Finance_CreditCard::number() http://www.zilleon.de/PEAR/Validate/Finance/CreditCard.diff.txt When calling this method via Validate::multiple() the options parameter $opt is passed to Validate_Finance_CreditCard::number() as an array. Because number() is checking for !is_null() it will always process this part of the method and thereby always return false. The patch changes the check to is_string(). [3] UnitTest for Validate::multiple() http://www.zilleon.de/PEAR/Validate/tests/multiple.php.txt Thanks for having a look at this! Best regards, Torsten Roehr

Comments

 [2005-04-04 17:47 UTC] dufuz
Thanks, just tried this patch, well have you tested the multiple unit test ? Dies kinda horriblely for me :-) Well some notice errors and such but also just general failure. I'll look further into this.
 [2005-04-04 18:21 UTC] dufuz
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.