|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-02-12 23:02 UTC] williamdes at wdes dot fr
Description: ------------ As I reported here https://github.com/phpmyadmin/phpmyadmin/issues/15709 To many calls to the setcookie will crash the process. Reproduced on Docker devilbox/php-fpm:7.1-mods and also 7.2,7.3,8.0 php versions I am not sure that the error is not due to something else than php. Test script: --------------- <?php setcookie("goto","",1577363177,"/@phpmyadmin/a/","",false); setcookie("back","",1577363177,"/@phpmyadmin/a/","",false); for ($i=1; $i < 40; $i++) { setcookie("pmaAuth-$i","",1577363177,"/@phpmyadmin/a/","",false); } Expected result: ---------------- See 200 success Actual result: -------------- 502 bad gateway PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 14 21:00:01 2025 UTC |
I'm facing the same issue while trying to send extra one cookie using the code setcookie('GLSU', $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 0, '/' , $_SERVER['SERVER_NAME'], true, true); When I commented out one of the cookies (other, not this), all works fine. No 'buben-dances' helped to solve the issue, not changing the cookie data, nor cookie name or any other credentials. It looks like only cookie count matters. If needed, I'm ready to help to reproduce it.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.