From: Operating system: Debian Linux PHP version: 5.4.1RC1 Package: Unknown/Other Function Bug Type: Bug Bug description:bin2hex(hex2bin($data)) != $data
Description: ------------ If you try to apply bin2hex on the result of hex2bin, when the length of the initial data is an odd number, the resulting data are not the same as the original. $ php -v PHP 5.4.1RC1 (cli) (built: Apr 6 2012 13:31:16) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies This is the original Debian package present in sid on the 7th April 2012 Test script: --------------- <?php $data = '12345'; var_dump($data, bin2hex(hex2bin($data))); // outputs : // string(5) "12345" // string(4) "1234" Expected result: ---------------- The output should be the same. (ie 12345 both times) Actual result: -------------- string(5) "12345" string(4) "1234" -- Edit bug report at https://bugs.php.net/bug.php?id=61660&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61660&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61660&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61660&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61660&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61660&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61660&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61660&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61660&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61660&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61660&r=support Expected behavior: https://bugs.php.net/fix.php?id=61660&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61660&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61660&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61660&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61660&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61660&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61660&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61660&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61660&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61660&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61660&r=mysqlcfg