On 26 November 2012 15:46, Casper Langemeijer <langemei...@php.net> wrote:
> Hmm.. I suppose It's up to me to make a strong (if possible watertight) plea > for the old way. I will try: > > 1. I don't think my patch impacts the efficiency of php_output_clean(). It > adds a single if with a binary compare. True: this causes output to get > piped through the output handler, but the output handler callback function > could be smart enough to back off when the PHP_OUTPUT_HANDLER_CLEAN bit is > set in the second parameter of the callback. > > 2. Current behaviour is *not* according the documentation. ob_start() > documentation states: " An optional output_callback function may be > specified. This function takes a string as a parameter and should return a > string. The function will be called when the output buffer is flushed (sent) > or **cleaned** (with ob_flush(), ob_clean() or similar function) or when the > output buffer is flushed to the browser at the end of the request. When > output_callback is called, it will receive the contents of the output buffer > as its parameter and is expected to return a new output buffer as a result, > which will be sent to the browser." (*-emphasis mine) Which emphasizes the fact, that implementation and documentation differed quite a bit. The ob_clean note was obviously added in 2008 [1] [2], when the new output code was sleeping in the PHP6 branch. > > Current behaviour differs: > On calling ob_end_clean() or ob_clean(), output_callback is called, but > *without* the contents of the output buffer as its parameter. > > 3. Implementing my patch will never break anything. The output will be > passed to the callback, but anything returned by it *will* be discarded. > > 4. If you are not going to pass the contents of the output buffer on > ob_end_clean() or ob_clean() to the callback function, Why would you call > the callback anyway? I guess I got your argument now :) I'll have a look. Thanks for spending your time to make PHP better. [1] http://svn.php.net/viewvc/phpdoc/en/trunk/reference/outcontrol/functions/ob-start.xml?r1=246628&r2=268496 [2] https://bugs.php.net/bug.php?id=44150 -- Regards, Mike -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php