Hi, > -----Original Message----- > From: Andrea Faulds [mailto:a...@ajf.me] > Sent: Monday, October 17, 2016 8:08 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] Regression between RC1 and RC2? > > Hi Stas, > > 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. > > > > 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. > FYI the patch is now reverted also in the dev branches. The ticket https://bugs.php.net/bug.php?id=73067 is re-opened, as the discussion is continued.
Regards Anatol -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php