Re: Re: hex2bin: E_WARNING is too much for odd string?

From: Date: Sat, 29 Jun 2013 01:41:10 +0000
Subject: Re: Re: hex2bin: E_WARNING is too much for odd string?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-68014@lists.php.net to get a copy of this message
Hi Sherif, The problem is that current code 'returns false for invalid hex' while it 'returns false and E_WARNING for invalid length'. We may choose behavior for invalid inputs - return false always - return false and raise E_WARNING always Mixing them up is not good, especially in the same function. IMHO. PHP has enough inconsistency. We should try to remove inconsistency much as possible. Besides the change will not break code as long as it is used as it should be. Considering the use case of hex2bin(), it will not handle external inputs in most cases. Therefore, it's better to raise errors invalid inputs. Do you prefer not to raise errors? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#68014) next »