Doc #62796 [Opn]: Third parameter for ob_start incorrectly documented

From: Date: Thu, 26 Sep 2013 14:48:17 +0000
Subject: Doc #62796 [Opn]: Third parameter for ob_start incorrectly documented
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10311@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62796&edit=1

 ID:                 62796
 Updated by:         mike@php.net
 Reported by:        benrwhite at gmail dot com
 Summary:            Third parameter for ob_start incorrectly documented
 Status:             Open
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   Archlinux (Probably all)
 PHP Version:        5.4.5
 Block user comment: N
 Private report:     N

 New Comment:

Sure. In 5.4.0

See bug #64977


Previous Comments:
------------------------------------------------------------------------
[2013-09-24 02:29:32] 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.

------------------------------------------------------------------------
[2012-08-11 07:59:23] benrwhite at gmail dot com

Description:
------------
The manual page: http://www.php.net/function.ob-start 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:
---------------
<?php

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

ob_start(null,0,PHP_OUTPUT_HANDLER_STDFLAGS);
echo 'A';
$test = ob_get_contents();
ob_end_clean();

echo 'B';
echo $test;

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

ob_start(null,0,true);
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'


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62796&edit=1


Thread (4 messages)

« previous php.doc.bugs (#10311) next »