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

Bug #9084 Validate_ES::dni wrong use of function arguments
Submitted: 2006-10-18 22:09 UTC
From: jabi at irontec dot com Assigned: doconnor
Status: Closed Package: Validate_ES (version 0.5.1)
PHP Version: 4.4.4 OS: GNU/Linux
Roadmaps: (Not assigned)    
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 : 28 + 7 = ?

 
 [2006-10-18 22:09 UTC] jabi at irontec dot com (Javier Infante)
Description: ------------ The Validate::dni function has two conditionals which i think are wrong: if (!Validate::string($number, VALIDATE_NUM, 8, 8)) { return false; } if (!Validate::string($letra, VALIDATE_ALPHA)) { return false; } The function will return false anyway thanks to the checks below those 2 conditions, but the sintax for the Validate::string method is not correctly written. Test script: --------------- They should be something like this: if (!Validate::string($number, array('format'=>VALIDATE_NUM,'min_length'=>8,'max_length'=>8))) { return false; } if (!Validate::string($letra, array("format"=>VALIDATE_ALPHA_UPPER))) { return false; } or in case the character extraction is more like this: $letra = strtoupper(substr($dni, -1)); // Line 59 if (!Validate::string($letra, array("format"=>VALIDATE_ALPHA))) { return false; } This way the function will return false when they are suppoused to, and it may accept lower case letters (more user friendly in my opinion)

Comments

 [2006-10-18 23:09 UTC] jabi at irontec dot com
The bug is in the Validate_ES class, not in Validate
 [2008-05-24 07:42 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!