Req #68219 [Opn]: Make http_response_code() also returns the text of response

From: Date: Sat, 14 Oct 2023 22:52:40 +0000
Subject: Req #68219 [Opn]: Make http_response_code() also returns the text of response
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245573@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68219&edit=1 ID: 68219 Updated by: bukka@php.net Reported by: ndschnbl at gmail dot com Summary: Make http_response_code() also returns the text of response Status: Open Type: Feature/Change Request Package: Output Control Operating System: ANY PHP Version: 5.5.17 -Assigned To: +Assigned To: bukka Block user comment: N Private report: N New Comment: I'm sorry but this does not make much sense in terms of the new return values. In any case I don't think we can change this function due to BC implication. But I will leave it open as more request to easily expose response text which I would imagine as a completely new function Previous Comments: ------------------------------------------------------------------------ [2014-10-13 18:14:03] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68219&edit=1

« previous php.bugs (#245573) next »