From: Operating system: PHP version: 5.3.5 Package: *Encryption and hash functions Bug Type: Bug Bug description:Crypt() returns inconsistant results on numeric strings
Description: ------------ --- >From manual page: http://www.php.net/function.crypt#Return Values --- The crypt() function, when using MD5, returns different results if the input string is all numeric. Test script: --------------- <?php $salt = '$1$abcdefgh$'; $pass = '123'; $pass2 = '123a'; echo crypt($pass, $salt)."<br />\n"; echo crypt($pass, $salt)."<br /><br />\n"; echo crypt($pass2, $salt)."<br />\n"; echo crypt($pass2, $salt)."<br />\n"; ?> Expected result: ---------------- $1$abcdefgh$OTo2MhKVLtpE9bkEycLQf0 $1$abcdefgh$OTo2MhKVLtpE9bkEycLQf0 $1$abcdefgh$PiPnB9KJsYjPIXtoia0WK/ $1$abcdefgh$PiPnB9KJsYjPIXtoia0WK/ Actual result: -------------- $1$abcdefgh$OTo2MhKVLtpE9bkEycLQf0 $1$abcdefgh$JwVLNLvq4bwIKuyv1qm8L0 $1$abcdefgh$PiPnB9KJsYjPIXtoia0WK/ $1$abcdefgh$PiPnB9KJsYjPIXtoia0WK/ -- Edit bug report at http://bugs.php.net/bug.php?id=53743&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53743&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53743&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53743&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53743&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53743&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53743&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53743&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53743&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53743&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53743&r=support Expected behavior: http://bugs.php.net/fix.php?id=53743&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53743&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53743&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53743&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53743&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53743&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53743&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53743&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53743&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53743&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53743&r=mysqlcfg