From:             robin_fernandes at uk dot ibm dot com
Operating system: Windows
PHP version:      5CVS-2007-09-12 (snap)
PHP Bug Type:     Output Control
Bug description:  ob_start(): inconsistent behaviour with undefined callbacks

Description:
------------
ob_start() can initialize multiple output buffers in a single call using a
comma delimited list of output callbacks, as follows:
  ob_start('f,f,f');
where function f() is a defined function.

However, behaviour when passing an undefined callback is inconsistent:
  ob_start('non_existent,f');
returns false and initializes no output buffers, whereas
  ob_start('non_existent,f,f');
returns true and initializes 2 output buffers with f as a callback.

Using arrays, the behaviour is consistent. The following both return false
and initialize no output buffers:
  ob_start(array('non_existent', 'f'));
  ob_start(array('non_existent', 'f', 'f'));

Tested on Windows XP on PHP 5.2.5-dev (cli) (built: Sep 12 2007 04:04:36).

Reproduce code:
---------------
<?php
function f($str) {
  return $str;
}
function checkAndClean() {
  print_r(ob_list_handlers());
  while (ob_get_level()>0) {
    ob_end_flush();
  }
}
var_dump(ob_start(array('non_existent', 'f')));
checkAndClean();
var_dump(ob_start(array('non_existent', 'f', 'f')));
checkAndClean();
var_dump(ob_start('non_existent,f'));
checkAndClean();
var_dump(ob_start('non_existent,f,f'));  //bug: expecting false with no
output buffers. Actually returns true and initialises 2 output buffers.
checkAndClean();
?>

Expected result:
----------------
bool(false)
Array
(
)
bool(false)
Array
(
)
bool(false)
Array
(
)
bool(false)
Array
(
)

Actual result:
--------------
bool(false)
Array
(
)
bool(false)
Array
(
)
bool(false)
Array
(
)
bool(true)
Array
(
    [0] => f
    [1] => f
)

-- 
Edit bug report at http://bugs.php.net/?id=42641&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42641&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42641&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42641&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42641&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42641&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42641&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42641&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42641&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42641&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42641&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42641&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42641&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42641&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42641&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42641&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42641&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42641&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42641&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42641&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42641&r=mysqlcfg

Reply via email to