go to bug id or search bugs for
setcookie() will happily produce expires times with years greater than 4 digits in length. This violates various RFC's and can also lead to unexpectedly hung scripts (especially on 64-bit).
This works fine on 32-bit, but will keep the script looping effectively forever formatting the date as GMT on 64-bit.
setcookie('test', 'testing', PHP_INT_MAX);
Sample patch: http://evilcode.net/sjg/php5.2.6-setcookie-head.c.patch
This may not be the right place for this, as there are probably other violators as well. A more general/generic fix may be in order.
Date output should be trimmed to the end of year 9999, possibly a warning presented.
Add a Patch
Add a Pull Request
The formatting is actually a bug... I've started optimizing the algorithm but haven't finished yet.
IMHO, it should emit a warning and return FALSE, magically limiting the value is clearly the wrong thing.
Something like the following patch may help in the meanwhile..
Automatic comment from SVN on behalf of iliaa
Log: Fixed bug #45141 (setcookie will output expires years of >4 digits).
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.