Bug #79267 [Ver->Fbk]: to much setcookie calls crashes the script
| From: | nikic@php.net | Date: | Tue, 11 Aug 2020 08:57:01 +0000 |
| Subject: | Bug #79267 [Ver->Fbk]: to much setcookie calls crashes the script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228503@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79267&edit=1
ID: 79267
Updated by: nikic@php.net
Reported by: williamdes at wdes dot fr
Summary: to much setcookie calls crashes the script
-Status: Verified
+Status: Feedback
Type: Bug
Package: Reproducible crash
Operating System: devilbox/php-fpm:7.3-mods
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I just checked this again. Running FPM behind nginx and the provided test script, I see
2020/08/11 10:51:42 [error] 82419#82419: *2 upstream sent too big header while reading response
header from upstream, client: 127.0.0.1, server: _, request: "GET /test.php HTTP/1.1",
upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
messages in the error log. After adding
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
to my nginx config, it works fine.
So this looks like a server configuration issue to me. Your web server rejects the massive HTTP
header you are sending.
Previous Comments:
------------------------------------------------------------------------
[2020-08-10 19:33:34] williamdes at wdes dot fr
Hi,
Could someone have a look into this one ?, I still reproduce it.
nikic@php.net maybe ?
Regards
------------------------------------------------------------------------
[2020-02-25 07:40:49] hennadii dot panasenko at gmail dot com
The 502 is coming from php-fpm (php-fpm is crashing)?
After a long time debug i've found that issue is coming from the method of deleting a cookie.
In my project i need to update cookie domain from parent to child. To do this, i previously delete
the cookie, and on the next line set it again with the new credentials.
Non-working code is:
setcookie('COOKIENAME', '', 0, '/', 'myhost.com', true,
false);
setcookie('COOKIENAME', 'COOKIEVALUE', 0, '/',
'sub.myhost.com', true, false);
I've found that while i'm deleting a cookie, there is no need to set any additional data,
but only name, value and zero-time. Any additional credentials are cause the 502 error. Also, no
cookie-name or cookie-value matters.
Working code is:
setcookie('COOKIENAME', '', 0);
setcookie('COOKIENAME', 'COOKIEVALUE', 0, '/',
'sub.myhost.com', true, false);
Hope, it will help.
------------------------------------------------------------------------
[2020-02-24 18:07:26] requinix@php.net
Is the 502 coming from nginx or php-fpm?
------------------------------------------------------------------------
[2020-02-24 14:51:05] hennadii dot panasenko at gmail dot com
I have Debian 9 + Nginx + PHP-FPM(7.2)
What else info do you need?
Please, ask direct questions or give me instructions what to do to help you.
------------------------------------------------------------------------
[2020-02-24 13:32:28] williamdes at wdes dot fr
Thank you for the comments, I am happy to see someone also has the same issue
> If needed, I'm ready to help to reproduce it.
Please go ahead
> With FPM I do see a "502 bad gateway", though no actual crash.
I called this a crash because I assumed that is the case or a response would be sent if the process
did end normally
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=79267
--
Edit this bug report at https://bugs.php.net/bug.php?id=79267&edit=1