Re: destructors and output_buffering
| From: | Tjerk Meesters | Date: | Sun, 31 Aug 2014 04:47:54 +0000 |
| Subject: | Re: destructors and output_buffering | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76979@lists.php.net to get a copy of this message | ||
On 31 Aug, 2014, at 12:40 pm, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
>> This is just a thought; could we delay the call to
>>
zend_call_destructors ONLY IF there’s output buffering
>> taking place
>> (i.e. ob_get_level() > 0)?
>
> That wouldn't help - imagine this:
> 1. ob_start is set
> 2. shutdown is starting
> 3. ob functions shut down, call function foo
> 4. function foo creates an object of class FooBar
> 5. ob shutdown ends, all output is flushed, etc.
> 6. FooBar::__destruct is run and tries to output something
So let it output something ...
Trying to output something in a destructor after flushing the output seems rather fishy; at the same
time I’m quite aware that it’s impossible to predict what some developers would expect to happen
in such cases.
>
> That scenario still may have a problem. I'll check more into if it's
> really a big deal outputting after OB shutdown (after all, some other
> things may lead to it too) but conditioning dtor move does not solve
> this problem. If it works this way we may as well move them there
> permanently.
Yeah, I can see now how my suggestion doesn’t really need the condition then :)
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/