|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71322 output before header() should give error
Submitted: 2016-01-09 21:42 UTC Modified: 2016-01-09 23:41 UTC
From: domains dot 30430573 at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 7.0.2 OS: Windows 7 x64
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 !
Your email address:
Solve the problem:
34 - 7 = ?
Subscribe to this entry?

 [2016-01-09 21:42 UTC] domains dot 30430573 at gmail dot com
output before header() should give error, but no warning is shown and the header is actually sent (HTTP 403, in this case)

*NOTE* I am testing this with PHP 7.0.1 via XAMPP

Test script:
echo 'Some string';
header('HTTP/1.1 403 Forbidden');

Expected result:
PHP Warning:  Cannot modify header information - headers already sent by (output started at Z:\test\file.php:2) in Z:\test\file.php on line 3

Actual result:
HTTP 1.1 403 Forbidden
Some string


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-09 23:27 UTC]
-Status: Open +Status: Feedback
 [2016-01-09 23:27 UTC]
Do you have output buffering enabled?
 [2016-01-09 23:38 UTC] domains dot 30430573 at gmail dot com
-Status: Feedback +Status: Open
 [2016-01-09 23:38 UTC] domains dot 30430573 at gmail dot com

I just changed to output_buffering=Off and the script works as it should
 [2016-01-09 23:41 UTC]
-Status: Open +Status: Not a bug
 [2016-01-09 23:41 UTC]
That would do it.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 10:01:29 2024 UTC