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  
Comments Add Comment Add patch


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 : 45 - 14 = ?

 
 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!