|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74224 output_add_rewrite_var always starts a new output buffer
Submitted: 2017-03-08 13:47 UTC Modified: 2018-06-14 10:35 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: bernd dot jaenichen at questback dot com Assigned:
Status: Wont fix Package: Output Control
PHP Version: 5.6.30 OS: openSUSE 13.2 (i586)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: bernd dot jaenichen at questback dot com
New email:
PHP Version: OS:


 [2017-03-08 13:47 UTC] bernd dot jaenichen at questback dot com
From manual page:

If ob_start() has already been called and output_add_rewrite_var() is called after that it leads to ob_get_level() == 2.

Manual states that this should be the case only if no buffering is active.

Bug is reproducable in CLI as well as CGI mode.

Test script:

echo "Fill buffer\n";

output_add_rewrite_var('someParam', 1);

echo "Level: " . ob_get_level() . "\n";

echo ob_get_clean();

Expected result:
Fill buffer
Level: 1

Actual result:
Fill buffer
Level: 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-14 17:59 UTC]
According to <>, the behavior has been
changed as of PHP 5.4.0 which may have been done deliberately, in
which case this would be a documentation problem.
 [2018-06-14 10:35 UTC]
-Status: Open +Status: Wont fix
 [2018-06-14 10:35 UTC]
You said:

> Manual states that this should be the case only if no buffering is active.

Did you mean this note from the manual?

>> Note: Calling this function will implicitly start output buffering if it is not active already. 

You're right, it could be interpreted that way. 
Unfortunately I didn't interpret it that way 10 years ago when rewriting the output layer.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 13:01:29 2024 UTC