#42641 [Opn->Asn]: ob_start(): inconsistent behaviour with undefined callbacks
| From: | jani@php.net | Date: | Tue, 18 Sep 2007 12:28:30 +0000 |
| Subject: | #42641 [Opn->Asn]: ob_start(): inconsistent behaviour with undefined callbacks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117643@lists.php.net to get a copy of this message | ||
ID: 42641
Updated by: jani@php.net
Reported By: robin_fernandes at uk dot ibm dot com
-Status: Open
+Status: Assigned
Bug Type: Output Control
Operating System: Windows
PHP Version: 5CVS-2007-09-12 (snap)
-Assigned To:
+Assigned To: mike
New Comment:
Mike, can you backport the stuff to PHP_5_3 once it's opened?
Previous Comments:
------------------------------------------------------------------------
[2007-09-14 10:07:18] robin_fernandes at uk dot ibm dot com
OK. On this subject, I think I'm running into a few other output
buffering issues which seem to be fixed in the php6 snaps. Some of these
are illustrated by tests in HEAD that fail on php5 snaps, e.g.
http://lxr.php.net/source/php-src/tests/output/ob_017.phpt
. Should I
raise bugs against php5, or is there a plan to backport some output
buffering code from HEAD to php5?
------------------------------------------------------------------------
[2007-09-13 19:05:24] mike@php.net
This undocumented behaviour does not exist in any way in HEAD any
longer. The implementation seemed questionable, as an array as
parameter usually indicates a method callback.
------------------------------------------------------------------------
[2007-09-13 09:22:07] jani@php.net
Yeah, now that I took a closer look I can see there's something like
this implemented..I wonder when/why. :)
Please don't open documentation issue yet.
------------------------------------------------------------------------
[2007-09-12 14:06:29] robin_fernandes at uk dot ibm dot com
Hi,
Thanks for your reply. As documentation isn't always complete/up to
date, I looked at the implementation of ob_start() to understand its
behaviour.
The code in the 5.2 version of php_ob_init() in output.c splits strings
on ',' and attempts to process each part seaparately (line 485). For
arrays, if a pair does not represent a method, a comment explicitly
states "init all array elements recursively" (line 516).
The prototype in the 5.2 code currently looks like this:
bool ob_start([ string|array user_function [, int chunk_size [, bool
erase]]])
The following testcase shows this behaviour in action:
http://pastebin.com/f4f15a025
Regarding tuning up the error message display params, I'm currently
using: error_reporting = E_ALL | E_STRICT / display_errors = 1 . Would
you expect see warnings/notices with my testcase?
I'll happily raise a documentation bug to ensure this is covered.
Alternatively, perhaps the fact that this behaviour is available is
itself a bug? Note that this is raised against php5 (not 6 where the
output buffering implementation seems to be a bit different).
------------------------------------------------------------------------
[2007-09-12 11:17:04] jani@php.net
Let's start with the prototype for this function:
bool ob_start ( [callback $output_callback [, int $chunk_size [, bool
$erase]]] )
The first parameter is "callback" type, so it expects either a string
(function name) or array (object, method).
More information about "callback" pseudo-type:
http://www.php.net/callback
I don't know where you got the idea that you can pass multiple
callbacks in there. It's not said to work like that anywhere in the
manual at least. :)
Please fix your example script accordingly (and tune up your
display_errors / error_reporting levels..).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/42641
--
Edit this bug report at http://bugs.php.net/?id=42641&edit=1