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

From: Date: Sat, 11 Aug 2012 07:59:23 +0000
Subject: Doc #62796 [NEW]: Third parameter for ob_start incorrectly documented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8726@lists.php.net to get a copy of this message
From:             benrwhite at gmail dot com
Operating system: Archlinux (Probably all)
PHP version:      5.4.5
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Third parameter for ob_start incorrectly documented

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 bug report at https://bugs.php.net/bug.php?id=62796&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=62796&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=62796&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=62796&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=62796&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62796&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=62796&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=62796&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=62796&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=62796&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=62796&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=62796&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=62796&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=62796&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=62796&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=62796&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62796&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=62796&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=62796&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=62796&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=62796&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=62796&r=mysqlcfg



Thread (4 messages)

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