Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96397 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28068 invoked from network); 17 Oct 2016 19:33:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Oct 2016 19:33:43 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:44796] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/34-00450-59725085 for ; Mon, 17 Oct 2016 15:33:41 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id 6AB34784A00; Mon, 17 Oct 2016 21:33:38 +0200 (CEST) Received: from w530phpdev (p54A771FC.dip0.t-ipconnect.de [84.167.113.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id 2B2C77849FE; Mon, 17 Oct 2016 21:33:36 +0200 (CEST) To: "'Andrea Faulds'" , References: <010701d2218e$b2e12d60$18a38820$@belski.net> <002001d22223$23363300$69a29900$@belski.net> <025201d2259a$21e542f0$65afc8d0$@belski.net> <8d5a4bf7-3766-ae3c-400c-40b17df33a83@gmail.com> <23.53.00450.07315085@pb1.pair.com> In-Reply-To: <23.53.00450.07315085@pb1.pair.com> Date: Mon, 17 Oct 2016 21:33:32 +0200 Message-ID: <03a201d228ad$5aa5e340$0ff1a9c0$@belski.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQItOLydTqT+dIGA3YBv5mmFOlapewMWylwtAqhC8kICT73digIfoWNeAggouZUCTaNu1wJG0vmpAxAH+yoBscSI9J9KgZxQ Content-Language: en-us Subject: RE: [PHP-DEV] Regression between RC1 and RC2? From: anatol.php@belski.net ("Anatol Belski") Hi, > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Monday, October 17, 2016 8:08 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] Regression between RC1 and RC2? >=20 > Hi Stas, >=20 > Stanislav Malyshev wrote: > > Hi! > > > >>> So the problem basically is that in PHP 7.0 both print_r and > >>> var_dump directly print to output. This means that by the time the > >>> exception is thrown, we've already written output. This makes it > >>> unclear how exactly the exception should be handled. Is it okay to > >>> just print everything and handle the exception afterward? This = seems odd to > me -- if an operation fails it shouldn't do anything. > > > > This sounds nice in theory, in practice often impossible. I.e. if = you > > already started printing and then some dependency fails, then you = get > > half-printed output. That's fine IMHO. Exception is not a normal > > condition, so you get result which is not normal. > > > >>> In PHP 7.1 I've rewritten print_r() to use an internal buffer, so = we > >>> could handle this case completely gracefully. The same change = could > >>> be implemented for var_dump(). With this approach we'd only print > >>> anything if no exception occurred. > > > > This is ok, but I don't think it's required. If you've got in > > exception in conversion, all bets are off, any result that passes a > > low sanity margin IMHO is ok - including both printing whatever > > happened before the exception and not printing anything. > > >=20 > I also think that the exception firing mid-output isn't all that = unreasonable. If you > were to implement var_dump() or print_r() yourself in userland, and = didn't > explicitly handle this case, you'd get the same result, I imagine. >=20 FYI the patch is now reverted also in the dev branches. The ticket = https://bugs.php.net/bug.php?id=3D73067 is re-opened, as the discussion = is continued. Regards Anatol