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

Bug #12015 filename validation rule return incorrect value
Submitted: 2007-09-09 19:12 UTC
From: tvlgiao Assigned: avb
Status: Closed Package: HTML_QuickForm (version CVS)
PHP Version: 5.2.1 OS:
Roadmaps: 3.2.10    
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:
Solve the problem : 42 - 25 = ?

 [2007-09-09 19:12 UTC] tvlgiao (Giao Trinh)
Description: ------------ please check method _ruleCheckFileName() of HTML/QuickForm/file.php php function preg_match return numeric, not really TRUE/FALSE which will be always failed in RuleRegistry::validate() it's should return boolean value. Suggestion: return preg_match($regex, $elementValue['name']) ? true : false;


 [2007-09-09 21:49 UTC] avb (Alexey Borzov)
Hmm, I don't see any particular reason for that === in RuleRegistry::validate(). Need to research whether it can be changed instead of 'filename' rule.
 [2007-09-10 01:37 UTC] tvlgiao (Giao Trinh)
Hi Alexey, please check out RuleRegistry.php method validate(): ... if ($rule->validate($value, $options) === true) { ... there is a === comparing with numeric result returned by 'filename' rule. in my case, i created a group of file elements and added rule for the whole group. and the validation didn't work right. I temporarily hacked _ruleCheckFileName() success. Thanks, Giao
 [2007-10-05 10:18 UTC] avb (Alexey Borzov)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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. _ruleCheckFilename() now casts the result of preg_match() to bool