On 04/08/2012 01:36 PM, Nikita Popov wrote:
Fix bug #61660: bin2hex(hex2bin($data)) != $data

If the input data has an odd length a warning is thrown and false is returned.


+++ b/ext/standard/tests/strings/bug61660.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #61660: bin2hex(hex2bin($data)) != $data
+--FILE--
+<?php
+
+var_dump(hex2bin('123'));
+
+?>
+--EXPECTF--
+Warning: hex2bin(): Hexadecimal input string must have an even length in %s on 
line %d
+bool(false)



I didn't follow the IRC discussion on this, but why are we now
discriminating against odd length values?  There is nothing in the doc
to indicate they can't be used, so this might cause some breakage for
what gain?  From a purely mathematical standpoint 'A' (for example) is
a hexadecimal number of odd length.  Why can't this be accepted?

Chris

--
Email: christopher.jo...@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to