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
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: andi at splitbrain dot org
New email:
PHP Version: OS:

 

 [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: Tue Dec 03 17:01:29 2024 UTC