php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #68219 Make http_response_code() also returns the text of response
Submitted: 2014-10-13 18:14 UTC Modified: 2018-08-23 00:56 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: ndschnbl at gmail dot com Assigned:
Status: Open Package: Output Control
PHP Version: 5.5.17 OS: ANY
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ndschnbl at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-13 18:14 UTC] ndschnbl at gmail dot com
Description:
------------
The http_response_code() function should return number (int) and text (string) of response. Currently only the int of the response code is output.

$http_response_headers works for streams in this way; http_response_code should also include this functionality.

Test script:
---------------
Current:

var_dump(http_response_code());

// int(200)


Suggested:

var_dump(http_response_code)());

// int(200)
// string(2) "OK"


Current: 

var_dump(http_response_code());

// int(301)


Suggested:

var_dump(http_response_code());

// int(301)
// string(17) "Moved Permanently"

Expected result:
----------------
HTTP/1.1 200 OK
HTTP/1.1 301 Moved Permanently
etc.

Actual result:
--------------
200
301

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-23 00:56 UTC] carusogabriel@php.net
-Summary: http_response_code() +Summary: Make http_response_code() also returns the text of response
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jun 03 01:01:25 2020 UTC