Re: Re: [RFC] Allow throwing exceptions from __toString()
| From: | Matteo Beccati | Date: | Wed, 15 May 2019 19:46:12 +0000 |
| Subject: | Re: Re: [RFC] Allow throwing exceptions from __toString() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105720@lists.php.net to get a copy of this message | ||
On 15/05/2019 21:00, Nikita Popov wrote:
Thanks Nikita that's much clearer to me now. I'm not as concerned as this is much different from "bad things will happen" ;) Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/While checking every single string conversion certainly puts you on thesafe side, leaving out these checks will usually only result in some unneeded computation and possibly redundant warnings. The main thing you should watch out for are operations modifying persistent structures such as databases. Not explicitly handling exceptions from __toString() will not cause segfaults or memory corruption if you don't do anything. It only means that your function call will not abort at the earliest possible opportunity. If you have functions modifying persistent datastores it's a good idea to review them to make sure you handle exceptions right away, but otherwise I wouldn't be overly concerned.