Re: com php-src: Fix bug #61660: bin2hex(hex2bin($data)) != $data: NEWS ext/standard/string.c ext/standard/tests/strings/bug61660.phpt

From: Date: Mon, 09 Apr 2012 18:50:23 +0000
Subject: Re: com php-src: Fix bug #61660: bin2hex(hex2bin($data)) != $data: NEWS ext/standard/string.c ext/standard/tests/strings/bug61660.phpt
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-68701@lists.php.net to get a copy of this message
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.jones@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/

« previous php.cvs (#68701) next »