Repository navigation
Conversation
…status Updates the previous PR to fix 18582 to actually return the correct HTTP status code, which is sent to the browser
4e87e8c to
6ba0715
Compare
|
@iluuu1994 sorry, not really familiar with c, could you pinpoint me to what the issue is here? The change is trivial but I can't see whats wrong with it (nor can I really run/debug it locally since I have nothing set up for it atm) |
|
In that case, you'd probably just want to return Line 778 in 22b5569 I.e. something like this untested code: diff --git a/ext/standard/head.c b/ext/standard/head.c
index 087ba6a3480..27d5dede597 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -384,6 +384,7 @@ PHP_FUNCTION(http_response_code)
if (SG(sapi_headers).http_status_line) {
php_error_docref(NULL, E_WARNING, "Calling http_response_code() after header('HTTP/...') has no effect");
+ goto return_current;
// If it is decided that this should have effect in the future, replace warning with
// efree(SG(sapi_headers).http_status_line);
// SG(sapi_headers).http_status_line = NULL;
@@ -401,6 +402,7 @@ PHP_FUNCTION(http_response_code)
RETURN_TRUE;
}
+return_current:
if (!SG(sapi_headers).http_response_code) {
RETURN_FALSE;
}It's a bit unclear what the correct return value is for Also, you'll have to check with Jakub whether he's actually ok with this change. I won't interfere here again. |
|
I thought about this one and it might be cleanest to just always return false and not even try to set it if it doesn't have effect anyway. It's a BC break but think it's more logical and it's not really silent so it seems more acceptable to me. It might need RFC though. As part of it I would also add a second bool parameter that would allow override of the value so it would be opt in. |
|
@kkmuffme let me know if you are happy to do RFC. As I have been requesting it, I don't mind to handle it myself if you don't have time for it. |
Updates the previous PR to fix 18582 to actually return the correct HTTP status code, which is sent to the browser