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

Bug #10754 Validation of large numbers broken in HTML_QuickForm_Rule_Compare
Submitted: 2007-04-17 14:33 UTC
From: patrik Assigned: avb
Status: Closed Package: HTML_QuickForm (version 3.2.7)
PHP Version: 5.1.6 OS: Ubuntu 6.10
Roadmaps: 3.2.8    

 [2007-04-17 14:33 UTC] patrik (Patrik Lermon)
Description: ------------ If this rule is created: $form->addRule(array('FromAccount', 'ToAccount'), 'You cannot transfer money to and from same account', 'compare', 'neq', 'client'); FromAccount contains "0008000231ngs0000114151" ToAccount contains "00080002310000114152" The comparision made in HTML_QuickForm_Rule_Compare will do basically this (line 77): return "00080002310000114151" != "00080002310000114152"; This will return false because PHP interprets the strings as numbers. One solution for this would be to use !== and === operators instead. Test script: --------------- // First the not equal test echo ("00080002310000114151" != "00080002310000114152" ? "TRUE" : "FALSE")."\n"; // outputs FALSE echo ("00080002310000114151" !== "00080002310000114152" ? "TRUE" : "FALSE")."\n"; // outputs TRUE (correct) // Then also the equality test php5 -r 'echo ("00080002310000114151" == "00080002310000114152" ? "TRUE" : "FALSE")."\n"; // outputs TRUE php5 -r 'echo ("00080002310000114151" === "00080002310000114152" ? "TRUE" : "FALSE")."\n"; // outputs FALSE (correct) Expected result: ---------------- The comparision works both on server and client side.


 [2007-04-17 14:44 UTC] patrik (Patrik Lermon)
 [2007-04-24 22:31 UTC] patrik (Patrik Lermon)
Yet another typo (awfully sorry). In the description it sez: FromAccount contains "0008000231ngs0000114151" That should be: FromAccount contains "00080002310000114151" (the "ngs" should be taken away)
 [2007-04-25 12:51 UTC] patrik (Patrik Lermon)
Problems alike are described in #10837
 [2007-05-29 19:28 UTC] avb (Alexey Borzov)
Yeah, the problem is indeed there.
 [2007-06-03 18:56 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.