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

Bug #12650 Prevent Division by zero warning/errors
Submitted: 2007-12-10 07:44 UTC
From: ctj951 Assigned: kguest
Status: Closed Package: Crypt_RC4 (version 1.0.2)
PHP Version: 4.4.7 OS: Mac OS X 10.4
Roadmaps: (Not assigned)    
Subscription  


 [2007-12-10 07:44 UTC] ctj951 (Chad Jones)
Description: ------------ I took the RC4 script I just downloaded and added the code suggested in the package itself. After running I get a lot of messages like the following: Warning: Division by zero in /Users/ctj951/Desktop/Crypt_RC4-1.0.2/Crypt_RC4-1.0.2/Rc4.php on line 103 The script still seems to work and seems to print the correct result. But I get tons of these messages. WHY? How can this be fixed? Is there something wrong with the program? Why are we dividing by zero? I hope this isn't considered "normal" behavior. Other then that the script "seems" to work. Test script: --------------- I add the code below (the exact code suggested in the package itself) to the bottom file and ran the complete PHP file $key = "pear"; $message = "PEAR rulez!"; $rc4 = new Crypt_RC4; $rc4->key($key); echo "Original message: $message <br>\n"; $rc4->crypt($message); echo "Encrypted message: $message <br>\n"; $rc4->decrypt($message); echo "Decrypted message: $message <br>\n"; Expected result: ---------------- No divide by zero warnings Actual result: -------------- Here is the output after running: %php Rc4.php --- Original message: PEAR rulez! <br> **following line is printed exactly 256 times: Warning: Division by zero in ~/Desktop/Crypt_RC4-1.0.2/Crypt_RC4-1.0.2/Rc4.php on line 103 Encrypted message: ?]??E(V?|? <br> **following line is printed exactly 256 times: Warning: Division by zero in ~/Desktop/Crypt_RC4-1.0.2/Crypt_RC4-1.0.2/Rc4.php on line 103 Decrypted message: PEAR rulez! <br>

Comments

 [2008-04-06 09:52 UTC] doconnor (Daniel O'Connor)
Change request: make use of guard methods to prevent divide by zero occuring.
 [2009-02-09 04:34 UTC] kguest (Ken Guest)
-Type: Feature/Change Request +Type: Bug
changing bug type as preventing division by zero is more than a "nice to have" type of feature request.
 [2009-02-09 05:03 UTC] kguest (Ken Guest)
-Assigned To: +Assigned To: kguest
 [2009-02-09 05:03 UTC] kguest (Ken Guest)
-Status: Assigned +Status: Closed
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. after installing the package from CVS, this behaviour is no longer evident.