php.net |  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
Votes:1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
---
From manual page: http://www.php.net/function.output-add-rewrite-var
---

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:
---------------
<?PHP
ob_start();

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-14 17:59 UTC] cmb@php.net
According to <https://3v4l.org/oIpdo>, 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] mike@php.net
-Status: Open +Status: Wont fix
 [2018-06-14 10:35 UTC] mike@php.net
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 Dec 21 16:01:28 2024 UTC