Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105720 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51821 invoked from network); 15 May 2019 22:40:16 -0000 Received: from unknown (HELO box.beccati.com) (176.9.123.236) by pb1.pair.com with SMTP; 15 May 2019 22:40:16 -0000 Received: from authenticated-user (box.beccati.com [176.9.123.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by box.beccati.com (Postfix) with ESMTPSA id E866320030C; Wed, 15 May 2019 21:46:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1557949574; bh=5OYQGrXmrwasDntJbpJRDiXiwJKdxd5F1/8wRHsPVAA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fCaYfMv8CZaqgFywR5s/nUVcT5JKygMQkx3flHgj/bUwzFVu8wUiZPFw20AVSHOp/ Gtpr25pTHhprwHuWnw/dzgx8SWfP2iyzVY5AzdZyatRzY0jJiWJ4e5EkG5zfL8jj/V BggpZYwh6a3dYBatMiSVC7ThwYOvpNIs25b31ghdebv/sqaSqYU7Wzk9U3YiNXCgOx +MIs3DlvOiZcNJVVu8+wkkGZ/bFEfONitUiIYzfla5ASxHpI3q24dvus/Fb2j+7Q00 Q9BcqnOUD9IzSyZswBxF2+Uy+SimOdZVJ0dY2Ait5z0YoG5kmY9CGkA2fCGYdx2L2B Qb4zCIv1mpPdQ== To: Nikita Popov Cc: Dan Ackroyd , PHP internals References: <916eb56a-3336-9e65-0f70-f1557975544d@beccati.com> <79b7d381-e56e-441b-3436-d6f2024704c6@gmx.de> <0ee156e3-9e72-4ae0-417e-a506def5447f@beccati.com> Message-ID: Date: Wed, 15 May 2019 21:46:12 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: [RFC] Allow throwing exceptions from __toString() From: php@beccati.com (Matteo Beccati) On 15/05/2019 21:00, Nikita Popov wrote: >> While checking every single string conversion certainly puts you on the > safe 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. 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/