Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96325 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59457 invoked from network); 12 Oct 2016 11:00:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2016 11:00:46 -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.213.182 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.213.182 mail-yb0-f182.google.com Received: from [209.85.213.182] ([209.85.213.182:33762] helo=mail-yb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/71-41968-CD71EF75 for ; Wed, 12 Oct 2016 07:00:45 -0400 Received: by mail-yb0-f182.google.com with SMTP id e20so18345899ybb.0 for ; Wed, 12 Oct 2016 04:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=x7QxuvNOWP+Fm6e/57tz5Qfz6y6dqg7OlfDRSGSbYXw=; b=IvkHb5Nvlbe1uUoyOmXLS2VcTVPhA/5A/HcfhGkMzzSQFpvDWUa8kHUqZ5RMU8kCy+ ZLb3i5iK0GfQ3UEVCDzKtLj44Knplq5oYI6mPvDDdS6SAzZdvDYL/VTs9AUBg6Ve/TVi qFGAQzHupCcK0pgRiWiPG6RWvwDEAqCqWN9FBFnAsFX/oU/IQGpfBOf+oAKNb7nqZVkn 7sbVUUeNr0so89fGnSMeuLBJ8th7k7CUe+oFd2AVieZSnClzhGXPVogJCuVZA4Es8AL2 PH13a7NEHCivCUnAbtJ/fTKfrJ86oI8bRRxL8QMtEc7MCS+Nr7TkTFLcf5JZ0hD14ICJ MyUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=x7QxuvNOWP+Fm6e/57tz5Qfz6y6dqg7OlfDRSGSbYXw=; b=P6Xu96Zz3MJhorVwxeZutP/Tqe3MToK/qYBmPtMYqfxvq0DZGQJg9QrgW/h/eQyLL6 cPM15ACiIeiv9Gv1pqt2yiFRmycq0Rn/SXa4AkpXAAFin9eJELoDq+B6vZsRjpG/gfPw AbeA60uUn36u1FgCjvvLa2SQD/4pQMK5CFldVaQF/iPEfB3O3pwiY6R7bKOzNEpMYeHW lKjf5pCy1DYW9uQfWN1SqmRzeLtsZP5oOADx8otrFYI1eWUu9DXoeLiv0bjDjMTe8Kox xohgaud+CUKiFDXMqc/j+6UiquImer76GJAAeer+W4DqCSAPoC+0RknjmW7kwJXpsKJx 7CEw== X-Gm-Message-State: AA6/9Rnp4FepUg/TxPBAifIb6f9Ubi1EcdnFOhcyB3He0+S//hfoIRqR9HImUoGrvfSiNn5YdOz2Pi1FxlpO/w== X-Received: by 10.37.163.195 with SMTP id e61mr345825ybi.81.1476270041677; Wed, 12 Oct 2016 04:00:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.219.12 with HTTP; Wed, 12 Oct 2016 04:00:40 -0700 (PDT) In-Reply-To: <002001d22223$23363300$69a29900$@belski.net> References: <010701d2218e$b2e12d60$18a38820$@belski.net> <002001d22223$23363300$69a29900$@belski.net> Date: Wed, 12 Oct 2016 13:00:40 +0200 Message-ID: To: Anatol Belski Cc: Xinchen Hui , Davey Shafik , Derick Rethans , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=f403045c05f86d448a053ea8e7fe Subject: Re: [PHP-DEV] Regression between RC1 and RC2? From: nikita.ppv@gmail.com (Nikita Popov) --f403045c05f86d448a053ea8e7fe Content-Type: text/plain; charset=UTF-8 On Sun, Oct 9, 2016 at 1:49 PM, Anatol Belski wrote: > Hi Hui, > > > -----Original Message----- > > From: Xinchen Hui [mailto:laruence@php.net] > > Sent: Sunday, October 9, 2016 8:06 AM > > To: Anatol Belski > > Cc: Davey Shafik ; Nikita Popov ; > > Derick Rethans ; PHP Developers Mailing List > > > > Subject: Re: [PHP-DEV] Regression between RC1 and RC2? > > > > Hey: > > > > On Sun, Oct 9, 2016 at 2:06 AM, Anatol Belski > wrote: > > > > > Hi, > > > > > > > -----Original Message----- > > > > From: me@daveyshafik.com [mailto:me@daveyshafik.com] On Behalf Of > > > > Davey Shafik > > > > Sent: Friday, October 7, 2016 10:05 PM > > > > To: Nikita Popov > > > > Cc: Derick Rethans ; PHP Developers Mailing List > > > > > > > > Subject: Re: [PHP-DEV] Regression between RC1 and RC2? > > > > > > > > Yes, we should not mask the exception. The behavior in 7.0/7.1.0RC1 > > > > is > > > much > > > > better IMO. > > > > > > > > (As seen here: https://3v4l.org/EJpD4#v700) > > > > > > > > - Davey > > > > > > > > On Fri, Oct 7, 2016 at 12:52 PM, Nikita Popov > > > wrote: > > > > > > > > > On Fri, Oct 7, 2016 at 9:31 PM, Derick Rethans > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > I was looking at Xdebug for PHP 7.1, and I ran into the > > > > > > following > > > > > > inconsistency: > > > > > > > > > > > > https://3v4l.org/tHteN > > > > > > > > > > > > I first thought that Xdebug was messing up, but it seems like > > > > > > it's different behaviour in PHP itself. As I clearly return an > > > > > > array from __debugInfo, I don't think the new result is the > correct one. > > > > > > > > > > > > cheers, > > > > > > Derick > > > > > > > > > > > > > > > > This is due to https://github.com/php/php-src/commit/ > > > > > 2d8ab51576695630a7471ff829cc5ea10becdc0f, which landed in PHP-7.0 > > > > > as > > > > well. > > > > > The problem is that __debugInfo currently is not able to handle > > > > > exceptions gracefully. I think we should revert this change for > > > > > now as it hides the fact that the underlying cause of the error is > > > > > an > > > exception. > > > > > > > > As far as I understand the bug #73067, it was about avoiding the fatal > > > error, not about avoiding the exception. Please correct if I'm wrong. > > > But given this, the fatal error still persists while the exception is > removed. > > > It looks like it's doing the exact reversed to what one would expect - > > > no fatal error and the exception can be catched. > > > > > > I see that it's not yet released in 7.0, so I would prefer to revert > > > this in the release, at least. Hui, Nikita, do you think it's possible > > > to improve this for 7.0 in a follow up? I would revert in 7.0.12 and > > > there'll be room to fix it in the dev branch till 7.0.13. Otherwise > > > I'd suggest to revert to the previous behavior in 7.0+ and do a fix in > > > an appropriate higher branch. > > > > > The real problem is: > > > > we are expecting __debugInfo always returns array, but it doesn't if > > exception is threw. > > > > so, if we keep the exception, then we need inserts checks for > exception (no > > array) after every debugInfo is called, or, make a FATAL error like the > way I did > > > In the link sent from Derick https://3v4l.org/tHteN it's to see, that the > other behavior is affected. In that case, the exception is thrown from the > core, not from the user space, while __debuginfo() properly returns an > array. This is the behavior, that patch to #73067 indirectly affects. > > > however, I think latter is better, but maybe we could improve the > fatal error > > message: > > > > " Fatal error, __debugInfo must return an array, but an exception > with " msg" > > is threw" > > > Yeah, that would be good, so the exception information is not lost. IMHO, > if we could get rid of the fatal error completely, it'd be more user > friendly. In that case the execution could continue, when exception is > catched. From the performance POV, it's anyway some additional effort, > either zend_clear_exception() or if(EG(exception)). But, if user chooses to > call __debuginfo(), it's clearly not performance oriented anyway. > > If having exception instead of fatal is not viable for safety reasons (or > whatever), I'd take your suggestion to extend the fatal message with the > exception text. Since the exception is not catchable in that case anyway, > we'll at least keep the useful information. > > Thanks > > anatol > 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. 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. Nikita --f403045c05f86d448a053ea8e7fe--