php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54727 ob_flush() before output_reset_rewrite_vars() results in data loss
Submitted: 2011-05-13 14:00 UTC Modified: 2011-05-23 12:43 UTC
From: mats dot lindh at gmail dot com Assigned: mike (profile)
Status: Closed Package: Output Control
PHP Version: trunk-SVN-2011-05-13 (SVN) OS: *
Private report: No CVE-ID: None
 [2011-05-13 14:00 UTC] mats dot lindh at gmail dot com
Description:
------------
The test for http://bugs.php.net/bug.php?id=26862 currently fails and results in the last echo statement (everything after ob_flush() and output_reset_rewrite_vars()) to get lost.

A variant of the issue was reintroduced after the output buffering rewrite.

This seems to happen because the output is never handled if there is no rewrite variables to process and there is no active buffer with contents. The output chars still needs to returned as handled.

The patch also contains a small change in the test to better differentiate the two echo statements.

Test script:
---------------
Based on: ext/session/tests/bug26862.phpt

<?php
session_start();
output_add_rewrite_var('var', 'value');

echo '<a href="file-first.php">link</a>';

ob_flush();

output_reset_rewrite_vars();
echo '<a href="file-second.php">link</a>';



Expected result:
----------------
<a href="file-first.php?var=value">link</a><a href="file-second.php">link</a>

Actual result:
--------------
<a href="file-first.php?var=value">link</a>

Patches

php-patch-urlscanner-bug26862-correct-v2.diff (last revision 2011-05-13 12:03 UTC by mats dot lindh at gmail dot com)
php-patch-urlscanner-bug26862-correct.diff (last revision 2011-05-13 12:02 UTC by mats dot lindh at gmail dot com)
php-patch-urlscanner-bug26862.diff (last revision 2011-05-13 12:00 UTC by mats dot lindh at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-21 20:31 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mike
 [2011-05-23 12:42 UTC] mike@php.net
Automatic comment from SVN on behalf of mike
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=311348
Log: Fix Bug #54727, a re-incarnation of #26862
 [2011-05-23 12:43 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2011-05-23 12:43 UTC] mike@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2011-05-24 07:06 UTC] mike@php.net
Automatic comment from SVN on behalf of mike
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=311375
Log: MFH: Fix Bug #54727, a re-incarnation of #26862
 [2012-04-18 09:50 UTC] laruence@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=327a87fdd9e7946d31d9f3176e8f3dac5449e7a3
Log: Fix Bug #54727, a re-incarnation of #26862
 [2012-07-24 23:41 UTC] rasmus@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=327a87fdd9e7946d31d9f3176e8f3dac5449e7a3
Log: Fix Bug #54727, a re-incarnation of #26862
 [2013-11-17 09:38 UTC] laruence@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=327a87fdd9e7946d31d9f3176e8f3dac5449e7a3
Log: Fix Bug #54727, a re-incarnation of #26862
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC