Re: Results of testing ZF against PHP 5.4.0RC1
| From: | Ilia Alshanetsky | Date: | Fri, 18 Nov 2011 13:08:28 +0000 |
| Subject: | Re: Results of testing ZF against PHP 5.4.0RC1 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56392@lists.php.net to get a copy of this message | ||
I agree with Stas' point there is really no need to force people do
the while (ob_get_level()) ob_end_clean(); loop or "force" people to
use the @ob_end_clean(); to avoid notices. If there are no buffers to
clear it should be a noop, without any notices being raised.
On Fri, Nov 18, 2011 at 12:04 AM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
>> First of all, ob_clean() and ob_end_clean() will raise the same
>> notice even in PHP 5.3. It seems inconsistent to me to treat these
>> three differently, so in that regard, PHP 5.4 is actually fixing
>> behavior (although arguably the other way to approach the problem is
>> to remove the notice from all three of them).
>
> I don't think ob_end_clean() should produce notices, otherwise it leads
> to needless boilerplate code like:
>
> if(ob_get_evel()>0) ob_end_clean();
>
> while you could just write ob_end_clean() and be done with it.
> ob_clean() is trickier since it's supposed to leave buffer in place, but
> for functions that are supposed to remove the buffer warning doesn't add
> any value, only makes people write uglier code.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>