Hi

On 8/1/22 14:58, G. P. B. wrote:
During review cmb noted that using an 'Error' here might not be the best
choice, as while it is likely to be a programmer error if unserializing
fails, we do not want to educate users to catch(Error).


I probably have a very different philosophy on this as I don't mind users
catching Errors, but it probably be mostly done by Framework/libraries
doing some funky stuff.

Which effectively translates into "don't catch(Error)". No rule without exception :-)

In my userland code I also have some blanket catch(Throwable) around *generic* code (i.e. arbitrary callables that can throw whatever type of throwable).
My suggested path forward would be:

For 8.2:

- Update ext/random to use the ext/date wording (I like that one best):

"Invalid serialization data for <classname> object."

- Revert the change from Exception to Error in my ext/random PR #9185.


Those make sense to me

I've already made those changes (i.e. Exception + ext/date wording). Feel free to add your approval if you agree:

https://github.com/php/php-src/pull/9185

---

For the other bits and pieces of your reply I don't have a strong opinion and I'm happy with whatever results comes out of it.

Best regards
Tim Düsterhus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to