ID: 47445 Updated by: der...@php.net Reported By: niall dot ocallaghan at gmail dot com -Status: Open +Status: Bogus Bug Type: mcrypt related Operating System: Windows Vista Ultimate SP1 PHP Version: 5.2CVS-2009-02-19 (snap) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You are cutting off data while decrypting in same cases because you trip and chop data in: $input = trim(chop(base64_decode($input))); This could remove bytes that the decryption requires. Previous Comments: ------------------------------------------------------------------------ [2009-02-21 11:12:58] fel...@php.net I can reproduce it on Linux. {"fg_class_name":"Match","fg_client_api":"d26ec6a426b128c7001a7292a2ad1c0929cd64d7","fg_client_id":1,"fg_direction":"desc","fg_extras":{"GameWeekId":"1"},"fg_method_name":"getMatches","fg_page":1,"fg_request_time":"0.25800200 1235003390","fg_sort":2,"fg_hash":"4e5746e21919d087c69642898b5e46452ce�."P�- ------------------------------------------------------------------------ [2009-02-19 01:44:14] niall dot ocallaghan at gmail dot com Description: ------------ When attempting to encrypt a JSON encoded string using a secret key, I get inconsistent results depending on the data and the key I used. I have managed to recreate this and believe it is an issue with the mcrypt module. The JSON string is 303 characters in length, and simply by changing on character from a 6 to a 7, it fixes the problem. I have included a URL for reproducing this error Reproduce code: --------------- http://78.137.160.50/fcl/bug.txt Please note in the above code I have given two example strings. The first does not work (and is a reproduction of this bug), the second does. They are identical strings except for the character at position 297. I changed the 6 to a 7 and it fixes the problem Expected result: ---------------- I expect to see a decrypted value of the string. Actual result: -------------- I see 99% of the string has been decrypted however the last few characters are corrupt. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47445&edit=1