php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54639 output_add_rewrite_var can only be used once
Submitted: 2011-04-30 12:30 UTC Modified: 2018-12-30 16:40 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: fl at nyggen dot com Assigned:
Status: Open Package: Output Control
PHP Version: Irrelevant OS:
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
34 - 23 = ?
Subscribe to this entry?

 
 [2011-04-30 12:30 UTC] fl at nyggen dot com
Description:
------------
The output_add_rewrite_var can only be used once, the second time it fails.

More on this problem here: http://stackoverflow.com/questions/5822936/output-add-
rewrite-var-problems

Test script:
---------------
// outer buffer
ob_start();

print_r(ob_list_handlers());

// inner buffer 1
ob_start();
output_add_rewrite_var('var', 'value');
print_r(ob_list_handlers());
ob_end_flush();

print_r(ob_list_handlers());

// inner buffer 2
ob_start();
output_add_rewrite_var('var', 'value');
print_r(ob_list_handlers());
ob_end_flush();

print_r(ob_list_handlers());

Expected result:
----------------
Output should have been:

Array
(
    [0] => default output handler
)
Array
(
    [0] => default output handler
    [1] => URL-Rewriter
)
Array
(
    [0] => default output handler
)
Array
(
    [0] => default output handler
    [1] => URL-Rewriter
)
Array
(
    [0] => default output handler
)

Actual result:
--------------
Output is:

Array
(
    [0] => default output handler
)
Array
(
    [0] => default output handler
    [1] => URL-Rewriter
)
Array
(
    [0] => default output handler
)
Array
(
    [0] => default output handler
    [1] => default output handler
)
Array
(
    [0] => default output handler
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-26 15:07 UTC] mike@php.net
-Type: Bug +Type: Documentation Problem
 [2013-09-26 15:07 UTC] mike@php.net
Yes, this odd output handler can only be used once.
 [2018-12-30 16:40 UTC] girgias@php.net
-Package: *General Issues +Package: Output Control -PHP Version: 5.3SVN-2011-04-30 (snap) +PHP Version: Irrelevant
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 08:01:24 2019 UTC