Hi Nikita, 2013/6/27 Nikita Popov <nikita....@gmail.com>
> 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. It's good to have uniformed error handling. Therefore, E_WARNING for 'bad chars' is alternative. hex2bin('abcZ'); // E_WARNING for invalid char hex2bin('abc'); // E_WARNING for invalid length (Users can handle errors via custom error handler) or hex2bin('abcZ'); // return FALSE since there is invalid char hex2bin('abc'); // return FALSE since it has invalid length (Users should catch errors via their validation/error handling code) I think either raising error or returning false is OK, but it's not good have(mix) both for a function. It's not mandatory, though. It would be nice if there is error/exception handling guideline for module authors for uniform error/exception handling. IMHO. Regards, -- Yasuo Ohgaki yohg...@ohgaki.net