Re: Regression between RC1 and RC2?
| From: | Stanislav Malyshev | Date: | Thu, 13 Oct 2016 21:52:23 +0000 |
| Subject: | Re: Regression between RC1 and RC2? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96356@lists.php.net to get a copy of this message | ||
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.
--
Stas Malyshev
smalyshev@gmail.com