Re: hex2bin: E_WARNING is too much for odd string?
| From: | Yasuo Ohgaki | Date: | Wed, 26 Jun 2013 22:37:23 +0000 |
| Subject: | Re: hex2bin: E_WARNING is too much for odd string? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67911@lists.php.net to get a copy of this message | ||
Hi Kalle,
Thank you for notifying E_ERROR/E_WARNING mistake.
2013/6/27 Kalle Sommer Nielsen <kalle@php.net>
> We already fixed a few of those in the past, I believe when 5.3
> was shipped, we had pretty much killed all of those along when the new
> parameter parsing API was being standardized.
>
hex2bin() is PHP 5.4 function and the behavior was change by PHP 5.4.1
so that raise E_WARNING for invalid length.
> I agree that this E_WARNING is sort of serve, and we should just
return false for invalid values
I prefer returning FALSE. Raising E_WARING/E_NOTICE for all invalid hex
would work, too.
> maybe an E_NOTICE could work better here even in case something fails
> and the developer must know WHY this happened, I believe we do this in
> a few places around the core and its extensions.
Yes, there are.
We would be better to have error/exception handling guideline
for consistent behavior for future releases.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net