Re: hex2bin: E_WARNING is too much for odd string?
| From: | Nikita Popov | Date: | Wed, 26 Jun 2013 19:40:02 +0000 |
| Subject: | Re: hex2bin: E_WARNING is too much for odd string? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67907@lists.php.net to get a copy of this message | ||
On Wed, Jun 26, 2013 at 9:21 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi all,
>
> hex2bin raises E_WARNING for odd length hex strings from PHP 5.4.1.
> http://jp2.php.net/manual/en/function.hex2bin.php
> However, just returning FALSE is easier for programmers.
>
Why is it easier? If you pass an odd length string to hex2bin you have
malformed input, which is usually a bug on the programmers side. Not having
a warning would make the issue harder to debug.
Nikita