Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-29 Thread Nikita Popov
On Sat, Jun 29, 2013 at 3:41 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: 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

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-29 Thread Lester Caine
Sherif Ramadan wrote: I see these as two separate problems. The first problem is clearly a design problem (but we can't really do much about that in the short term). One thing that came to mind when this first popped up was Why isn't the string automatically zero padded? Check my own uses I

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-28 Thread Leszek Krupiński
On 2013-06-27 03:33, Sherif Ramadan wrote: On Wed, Jun 26, 2013 at 9:05 PM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi all, I've sent pull request for PHP-5.5 branch. https://github.com/php/php-src/pull/369 It's simple 1 liner removes E_WARNING for invalid length. Are there any objections?

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-28 Thread Sherif Ramadan
On Fri, Jun 28, 2013 at 5:21 AM, Leszek Krupiński leafn...@gmail.comwrote: On 2013-06-27 03:33, Sherif Ramadan wrote: On Wed, Jun 26, 2013 at 9:05 PM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi all, I've sent pull request for PHP-5.5 branch.

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-28 Thread Yasuo Ohgaki
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

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-28 Thread Sherif Ramadan
On Fri, Jun 28, 2013 at 9:41 PM, Yasuo Ohgaki yohg...@ohgaki.net wrote: 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

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-28 Thread Yasuo Ohgaki
Hi Sherif, 2013/6/29 Sherif Ramadan theanomaly...@gmail.com If we tried to fix all of PHP's functions to either return false always or return false and raise errors always we'd have to fix every single PHP function there is since there's absolutely no consistency there as it is. We don't

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-27 Thread Tjerk Meesters
Sent from my iPhone On 27 Jun, 2013, at 11:05 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi Sherif, I would like to have consistent behavior at least within a function. 2013/6/27 Sherif Ramadan theanomaly...@gmail.com I thought you wanted to add an extra error for malformed hex,

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-27 Thread Yasuo Ohgaki
Hi Tjerk, 2013/6/27 Tjerk Meesters tjerk.meest...@gmail.com The thread started with the assertion that it raises a warning and the commits first remove the warning and then adds it again later, so isn't the whole PR a noop? :) The issue is inconsistent behavior of hex2bin against invalid

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-27 Thread Tjerk Meesters
On Fri, Jun 28, 2013 at 9:27 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi Tjerk, 2013/6/27 Tjerk Meesters tjerk.meest...@gmail.com The thread started with the assertion that it raises a warning and the commits first remove the warning and then adds it again later, so isn't the whole PR a

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-27 Thread Yasuo Ohgaki
2013/6/28 Tjerk Meesters tjerk.meest...@gmail.com Adding E_WARNING is better than removing as a result discussion, IMO. Given the sizeable number of functions that don't raise warnings, should this behaviour then be extended to those as well, e.g. base64_decode(), mb_*()? Of course,

[PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-26 Thread Yasuo Ohgaki
Typo 2013/6/27 Yasuo Ohgaki yohg...@ohgaki.net PHP 5.4: Keep current behavior PHP 5.4: Riase E_ERROR and return FALSE for invalid length. PHP 5.5: Remove E_ERROR PHP 5.4: Keep current behavior PHP 5.5: Riase E_ERROR and return FALSE for invalid length. PHP 5.6: Remove E_ERROR -- Yasuo

[PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-26 Thread Yasuo Ohgaki
Hi all, I've sent pull request for PHP-5.5 branch. https://github.com/php/php-src/pull/369 It's simple 1 liner removes E_WARNING for invalid length. Are there any objections? If not I'll merge it to PHP-5.5 and master, then update docs. -- Yasuo Ohgaki yohg...@ohgaki.net 2013/6/27 Yasuo

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-26 Thread Sherif Ramadan
On Wed, Jun 26, 2013 at 9:05 PM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi all, I've sent pull request for PHP-5.5 branch. https://github.com/php/php-src/pull/369 It's simple 1 liner removes E_WARNING for invalid length. Are there any objections? Yes, I object to removing the error in

Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string?

2013-06-26 Thread Yasuo Ohgaki
Hi Sherif, I would like to have consistent behavior at least within a function. 2013/6/27 Sherif Ramadan theanomaly...@gmail.com I thought you wanted to add an extra error for malformed hex, which I would have been fine with, but removing the error entirely? The error is useful. It informs