Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95950 invoked from network); 5 Jul 2015 20:52:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jul 2015 20:52:01 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:34892] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/65-21549-1F899955 for ; Sun, 05 Jul 2015 16:52:01 -0400 Received: by wiga1 with SMTP id a1so213279580wig.0 for ; Sun, 05 Jul 2015 13:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sWGVzHPGeAuSuJ7z50grvIB4FD2fAQ+WJIvf49ei6tA=; b=Two1uepVGrGjpB6FIoO11q8BNhFSaF+tf71wLM3GT/JjAGS49Bvod/5aHZf48EhSAN 2VoIc3lI76iWxBtjQWHNHnYgA+9DZf85ID0Gzv0vlXeZLJ5+A+JeMy3OHkJqKNWceqal zueQ6kFnDYJCxaW3334s+ga4+Lf+TCaKkbhDEcO+ABmMiDwaQvoTz3WkyMCGs/byl5B7 XDy8lxLtCaHScdOPxyUMnxEws7aefa2m2jXYfFymITtIsiViSEZlu42Y+JHf0OjUE+BX gj954mojwmGtUWAqk1F1zp9qCS+Ecxk8ssnyAIetYGItIbVK066Nts2wSpzdBCPG2a3z gMKw== MIME-Version: 1.0 X-Received: by 10.180.218.195 with SMTP id pi3mr46972085wic.71.1436129518046; Sun, 05 Jul 2015 13:51:58 -0700 (PDT) Received: by 10.27.79.200 with HTTP; Sun, 5 Jul 2015 13:51:57 -0700 (PDT) In-Reply-To: <559994AB.3090102@gmail.com> References: <1435240516.15676.7.camel@kuechenschabe> <1436127623.5633.4.camel@kuechenschabe> <559994AB.3090102@gmail.com> Date: Sun, 5 Jul 2015 22:51:57 +0200 Message-ID: To: Stanislav Malyshev Cc: =?UTF-8?Q?Johannes_Schl=C3=BCter?= , PHP internals Content-Type: multipart/alternative; boundary=001a1134ce04c654a1051a26f575 Subject: Re: [PHP-DEV] Allow exceptions in __toString() From: nikita.ppv@gmail.com (Nikita Popov) --001a1134ce04c654a1051a26f575 Content-Type: text/plain; charset=UTF-8 On Sun, Jul 5, 2015 at 10:33 PM, Stanislav Malyshev wrote: > Hi! > > >>> I can see your concern here -- however this is nothing specific to > >>> exceptions thrown from __toString(). There is are a number of ways you > >>> can end up in this situation, the two most common being: > >> > >> I summarize this a bit freely as "We already have places which are hard > >> to understand an predict, so let's add more!" > >> > > > > That, or "Let's not be hypocrites". > > I don't think the position of "let's not add more unpredictable behavior > to the engine" is adequately described as "hypocrite". We know there are > interruption problems and such in the engine, we know some of them are > hard to fix. However, adding a different class of those doesn't make it > better in any way. If we find a solution that allows us to not introduce > new unpredictable behaviors - I'm all for it, it's great. Maybe the code > that allows to throw exceptions the same way we do with errors, maybe > some way to not get unpredictable results on conversions. But we can't > just ignore it because there are other problems in the engine too. Sorry, I just find it somewhat weird that we consider some of the exceptions generated as the result of __toString calls to be okay (error handler exceptions), while others are considered to be too dangerous to allow (direct exceptions). But maybe I just approached this from the wrong direction. Instead of allowing exceptions in __toString in combination with some hardening of the VM, maybe we should just convert the recoverable fatal errors __toString currently throws to actual fatal errors? Not a huge fan of doing that, but at least it's consistent. Nikita --001a1134ce04c654a1051a26f575--