[php-src] Issue #9200: setcookie has an obsolete expires date format
| From: | GuySartorelli | Date: | Sat, 30 Jul 2022 05:26:53 +0000 |
| Subject: | [php-src] Issue #9200: setcookie has an obsolete expires date format | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242079@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9200
Author: GuySartorelli
### Description
setcookie() gives an expires date format that is non-standard as per
[MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#permanent_cookie) and
[HTTP RFC 2616](https://www.rfc-editor.org/rfc/rfc2616#page-20) - the latter of which explicitly
refers to the format PHP's setcookie() outputs as "obsolete".
The following code:
```php
<?php
setcookie('expires-format-test', 'test', strtotime('now + 1 minute'));
```
Resulted in this header output:
Set-Cookie | expires-format-test=test; expires=Sat, 30-Jul-2022 05:12:54 GMT;
Max-Age=60
But I expected this header output instead:
Set-Cookie | expires-format-test=test; expires=Sat, 30 Jul 2022 05:12:54 GMT;
Max-Age=60
### PHP Version
PHP 8.0.21
### Operating System
_No response_