From: lars at larswolter dot de Operating system: Windows PHP version: 5.0.0 PHP Bug Type: mcrypt related Bug description: mdecrypt not working anymore
Description: ------------ Just changed from php4 to php5. Now mcrypt decryption does not work anymore. The function returns the encrypted data instead of the decrypted. The testcode is the example from the mdecrypt_generic function documentation. using php.ini-recommended and only changed the following display_errors = On display_startup_errors = On extensions_dir = ... loaded extra modules: gd2, mbstring, mcrypt, mysql, exif Reproduce code: --------------- <?php $key = 'this is a very long key...'; $plain_text = 'very important data'; $td = mcrypt_module_open('des', '', 'ecb',''); $key = substr($key, 0, mcrypt_enc_get_key_size($td)); $iv_size = mcrypt_enc_get_iv_size($td); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); if (mcrypt_generic_init($td, $key, $iv) != -1) { $c_t = mcrypt_generic($td, $plain_text); mcrypt_generic_deinit($td); mcrypt_generic_init($td, $key, $iv); $p_t = mdecrypt_generic($td, $c_t); mcrypt_generic_deinit($td); mcrypt_module_close($td); } if (strncmp($p_t, $plain_text, strlen($plain_text)) == 0) echo "ok"; else echo "error"; ?> Expected result: ---------------- the result should be: ok Actual result: -------------- the result is: error -- Edit bug report at http://bugs.php.net/?id=29172&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29172&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29172&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29172&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29172&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29172&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29172&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29172&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29172&r=support Expected behavior: http://bugs.php.net/fix.php?id=29172&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29172&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29172&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29172&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29172&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29172&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29172&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29172&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29172&r=float