php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41773 php_strip_whitespace sends headers with errors suppressed
Submitted: 2007-06-21 22:16 UTC Modified: 2007-06-25 21:19 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: andi at splitbrain dot org Assigned:
Status: Closed Package: Output Control
PHP Version: 5.2.4-dev (200706222030) OS: Linux (Debian unstable)
Private report: No CVE-ID: None
 [2007-06-21 22:16 UTC] andi at splitbrain dot org
Description:
------------
When suppressing error output of php_strip_whitespace and trying to load a non existent file, output is started. The code below prints "not sent" on older PHP versions but prints "sent" on PHP 5.2.3-1

Reproduce code:
---------------
<?php

$foo = @php_strip_whitespace('non existent file');

if(headers_sent()){
    echo "sent\n";
}else{
    echo "not sent\n";
}


Expected result:
----------------
not sent

Actual result:
--------------
sent

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-22 22:29 UTC] andi at splitbrain dot org
Its still the same with the snapshot you linked.
 [2007-06-24 16:30 UTC] sniper@php.net
And why shouldn't the headers be sent? You're not getting any fatal error there..
 [2007-06-24 16:50 UTC] andi at splitbrain dot org
Error suppression should suppress all output including sending headers. This is crucial when cookies need to be sent later in the code. Please note that this behavior broke in 5.2.3 and was working fine before (breaking existing code).
 [2007-06-24 22:53 UTC] sniper@php.net
Did this work in 5.2.2 as you expected?
 [2007-06-25 19:57 UTC] andi at splitbrain dot org
I just verified it. The provided test code delivers the expected 'not sent' output with PHP 5.2.2, so it broke with 5.2.3
 [2007-06-25 21:19 UTC] tony2001@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC