php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52351 Cannot send http status code without set new header raw
Submitted: 2010-07-15 20:02 UTC Modified: 2010-07-15 20:08 UTC
From: giorgio dot liscio at email dot it Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 5.3.2 OS: all? Windows xp x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giorgio dot liscio at email dot it
New email:
PHP Version: OS:

 

 [2010-07-15 20:02 UTC] giorgio dot liscio at email dot it
Description:
------------
hi, if i want only to send an http status code in php with the function header()
i must specify something on the first parameter otherwise the header is not sent

i want only to set 404 status code.. but none of those works

header("", TRUE, 404);
header(NULL, TRUE, 404);

but i need to use

header("X-Totally-Useless: true", TRUE, 404);

is this a bug?

thank you



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-15 20:08 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2010-07-15 20:08 UTC] rasmus@php.net
As documented at http://php.net/header, you would do it like this:

header("HTTP/1.0 404 Not Found");
 [2010-07-15 20:21 UTC] giorgio dot liscio at email dot it
hi rasmus it's an honor to talk with you :)

header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found");

you don't think that this is actually hard to manage?

in plus, it is implemented in user space when it is already implemented by php

i don't like this

to make writing these things to the user increases the risk of bugs / incompatibilities with clients
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 22 20:03:39 2021 UTC