|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62796 Third parameter for ob_start incorrectly documented
Submitted: 2012-08-11 07:59 UTC Modified: 2013-09-26 21:21 UTC
Avg. Score:3.5 ± 1.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: benrwhite at gmail dot com Assigned:
Status: Duplicate Package: Documentation problem
PHP Version: 5.4.5 OS: Archlinux (Probably all)
Private report: No CVE-ID: None
 [2012-08-11 07:59 UTC] benrwhite at gmail dot com
The manual page: states that the third parameter is set to true by default and changing it to false prevents any buffer created using this function from being erasable.

After some confusion in use of this function, I dug into the code for the master php-src branch and discovered that the function instead now seems to expect a bitwise combination of flags. The following constant definitions should probably be documented under the output handler predefined constants -

  40 #define PHP_OUTPUT_HANDLER_CLEANABLE    0x0010
  41 #define PHP_OUTPUT_HANDLER_FLUSHABLE    0x0020
  42 #define PHP_OUTPUT_HANDLER_REMOVABLE    0x0040
  43 #define PHP_OUTPUT_HANDLER_STDFLAGS             0x0070

and referred to under the documentation for the third parmeter of ob_start.

Test script:

// ******** Part 1 

echo 'A';
$test = ob_get_contents();

echo 'B';
echo $test;

// ******** Part 2 (works on 5.3)

echo 'A';
$test = ob_get_contents();
ob_end_clean(); //throws warning

echo 'B';
echo $test;

Expected result:
The first part is using undocumented flags, so undefined?
The second part should output string 'BA' according to the documentation.

Actual result:
 on 5.4.5 -
The first part outputs 'BA'
The second part outputs 'ABA'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-24 02:29 UTC] alan at roojs dot com
Not sure if this is only a documentation problem - It seems to be a BC break. - 
it breaks previously working code on upgrade.
 [2013-09-26 14:48 UTC]
Sure. In 5.4.0

See bug #64977
 [2013-09-26 21:21 UTC]
-Status: Open +Status: Duplicate
 [2013-09-26 21:21 UTC]
Marking as a dupe of bug #64977, since that has more detail.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 11:04:16 2021 UTC