Bug #77155 [Com]: Location header no longer coexists with status 201

From: Date: Fri, 16 Nov 2018 15:39:39 +0000
Subject: Bug #77155 [Com]: Location header no longer coexists with status 201
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217988@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77155&edit=1 ID: 77155 Comment by: marnick dot leau at gmail dot com Reported by: marnick dot leau at gmail dot com Summary: Location header no longer coexists with status 201 Status: Feedback Type: Bug Package: Other web server Operating System: Linux PHP Version: 7.2.12 Assigned To: cmb Block user comment: N Private report: N New Comment: cgi-fcgi Previous Comments: ------------------------------------------------------------------------ [2018-11-15 16:45:20] cmb@php.net > I use php in lighttpd, is fastcgi the answer you need? Not quite. What does php_sapi_name() return (likely either cgi-fcgi or fpm-fcgi). ------------------------------------------------------------------------ [2018-11-15 16:31:14] marnick dot leau at gmail dot com I use php in lighttpd, is fastcgi the answer you need? Your example is 303, have you tried 201? I suppose it could be a lighttpd issue too, but lighttpd's changelog doesn't mention anything like this either, and php has a history of being bossy about Location+status, so I started here... ------------------------------------------------------------------------ [2018-11-15 13:43:29] cmb@php.net Related To: Bug #76961 ------------------------------------------------------------------------ [2018-11-15 13:19:10] cmb@php.net header('Location: http://example.com/', true, 303); works for me with latest PHP-7.2 and the built-in webserver. Which SAPI do you use? ------------------------------------------------------------------------ [2018-11-14 19:26:24] marnick dot leau at gmail dot com Description: ------------ In the selected version and some previous ones going back a few weeks or months (not sure which exact versions), a change was apparently made to the Location header mechanism. Test script: --------------- http_response_code(201); header('HTTP/1.1 201 Created', true, 201); header('Location: foobar', true, 201); http_response_code(201); header('HTTP/1.1 201 Created', true, 201); Expected result: ---------------- It's supposed to be possible to set the Location header and have a status 3** OR 201. At the very least php's own docs confirm this: https://secure.php.net/manual/en/function.header.php Actual result: -------------- Setting the Location header results in a 302 no matter what I try to the contrary. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77155&edit=1

« previous php.bugs (#217988) next »