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

Request #6898 Change if empty() then true behavior of Validate_US::phoneNumber()
Submitted: 2006-02-22 23:47 UTC
From: nhyde at bigdrift dot com Assigned: davidc
Status: Closed Package: Validate_US (version 0.5.2)
PHP Version: 4.4.1 OS: RH 9
Roadmaps: 0.5.3    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2007-12-12 19:43 UTC
Package:
Bug Type:
Summary:
From: nhyde at bigdrift dot com
New email:
PHP Version: Package Version: OS:

 

 [2006-02-22 23:47 UTC] nhyde at bigdrift dot com (Nathan Hyde)
Description: ------------ Remove the functionality of phoneNumber where if the $number is empty, ($number = ''), the validation method returns true. Justification: If we're validating a phoneNumber, the input should be a string or number with a min number of characters, as the regular expression expects. NULL is certainly not a valid phone number. My thought being that if I'm attempting to actually validate an input, the value should at least resemble what I'm looking for. Test script: --------------- <?php $aValues = array('ph'=>''); $aResult = Validate::multiple($aValues,array('ph'=>array('type'=>'US_phonenumber')); if (true == $aResult['ph'] && '' == $aValues['ph']) { echo 'Doh, empty string!'; } else { echo 'No number = Not a phone number.'; } ?> Expected result: ---------------- No number = Not a phone number. Due to lines 302-304 of US.php the method returns true. Actual result: -------------- Doh, empty string!

Comments

 [2006-04-02 08:59 UTC] davidc (David Coallier)
This bug has been fixed in CVS. 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.