php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26507 ob_end_flush behaviour change
Submitted: 2003-12-02 18:56 UTC Modified: 2003-12-02 22:46 UTC
From: michael at tapinternet dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.4 OS: debian linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael at tapinternet dot com
New email:
PHP Version: OS:

 

 [2003-12-02 18:56 UTC] michael at tapinternet dot com
Description:
------------
ob_end_flush used to completely trim all output that had been collected, including whitespace at the end of previously included files.  That's not happening after an upgrade to PHP 4.3.4 (from 4.3.1).  

EXAMPLE:
test.php
<?
$foo='';
?>
     <--- note whitespace here



bar.php
<?
include('test.php');
ob_end_flush();
header("Content-type: application/ms-word");
echo "foobar";
?>

'foobar' will have a linebreak *before* it, even though the ob_end_flush() function has been called.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-02 22:27 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP does not trim output.
 [2003-12-02 22:46 UTC] michael at tapinternet dot com
I worded this wrong, I'm sorry,

Dang - I made the whole thing wrong.

It's not the 'flush' one it's ob_end_clean().


EXAMPLE:
test.php
<?
$foo='';
?>
     <--- note whitespace here

bar.php
<?
include('test.php');
ob_end_clean();
header("Content-type: application/ms-word");
echo "foobar";
?>

-----------------
'foobar' will have a linebreak *before* it, even though the
ob_end_flush() function has been called.
-----------------

Please reconsider the above issue.  ob_end_clean() (this is what's in the code which was causing us problems after the upgrade) has changed behaviour.  

I've not made myself clear on this, and that's my fault.  EVERYTHING has ob_start() at the top of the controller file, so the example files *only* have the ob_end_clean() in them when needed.  This *should* be clearing out everything that's been collected in the output buffer up to that point.  Previous versions apparently dealt with the whitespace in any include()d files as well, but this latest version (4.3.4) is breaking where earlier versions (4.3.1 and below) worked.

If this behaviour has changed here, what else may have changed as well?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC