php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69404 PHP_OUTPUT_HANDLER_FLUSHABLE only affects ob_flush()
Submitted: 2015-04-09 06:44 UTC Modified: 2024-01-07 14:03 UTC
From: tstarling@php.net Assigned: girgias (profile)
Status: Closed Package: Output Control
PHP Version: 5.5Git-2015-04-09 (Git) OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 - 30 = ?
Subscribe to this entry?

 
 [2015-04-09 06:44 UTC] tstarling@php.net
Description:
------------
According to the manual, ob_get_flush() and ob_end_flush() should fail if PHP_OUTPUT_HANDLER_FLUSHABLE was not given during ob_start(). That seems like a sensible policy, but the flag is only checked during ob_flush().

I noticed this bug while reading output.c, I don't actually use those functions.

Test script:
---------------
<?php
ob_start(null, 0, PHP_OUTPUT_HANDLER_REMOVABLE);
print "x\n";
var_dump(ob_get_flush());


Expected result:
----------------
PHP Notice:  ob_get_flush(): failed to flush buffer of default output handler (0) in ob_get_flush.php on line 4
bool(false)
x

Actual result:
--------------
x
string(2) "x
"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-09 07:31 UTC] laruence@php.net
-Assigned To: +Assigned To: mike
 [2015-04-13 15:01 UTC] mike@php.net
-Summary: ob_get_flush() and ob_end_flush() do not check PHP_OUTPUT_HANDLER_FLUSHABLE +Summary: PHP_OUTPUT_HANDLER_FLUSHABLE only affects ob_flush() -Status: Assigned +Status: Open -Type: Bug +Type: Documentation Problem -Assigned To: mike +Assigned To:
 [2015-04-13 15:01 UTC] mike@php.net
Actually none of these is a "flush" as in ob_flush(), where the output buffer stays on the stack.

Both ob_get_flush() and ob_end_flush() actually finish the output buffer/handler.

Naming of the userland API is ambiguous, but you can see in the output.c sources, that both of these functions actually call php_output_end() and not php_output_flush().

Reclassifying as "Doc Bug", wrt PHP_OUTPUT_HANDLER_FLUSHABLE only affects ob_flush().

Thanks anyway!
 [2015-06-30 23:19 UTC] tstarling@php.net
Could you possibly add tests for the PHP_OUTPUT_HANDLER_* flags? It would make it much easier for me to figure out what they're meant to do.
 [2016-03-09 15:33 UTC] mike@php.net
See also bug #71486
 [2024-01-07 14:03 UTC] girgias@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: girgias
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC