doc-en icon indicating copy to clipboard operation
doc-en copied to clipboard

setcookie() datetime format change in 8.2 is undocumented

Open ReedyBear opened this issue 3 years ago • 1 comments

In php 8.1 and below, the cookie expires datetime format sent to the browser is D, d-M-Y H:i:s e. In php 8.2, it is D, d M Y H:i:s e

This is discussed in issue https://github.com/php/php-src/issues/9200

This change is not documented in setcookie() or php 8.2 backward incompatible changes

ReedyBear avatar Dec 08 '22 22:12 ReedyBear

Hmm, I'm not sure this change is really worth to be documented. After all, the setcookie() documentation already mentions RFC 6265, and we're still conforming to that.

What's your particular use-case to consider this a breaking change?

cmb69 avatar Dec 09 '22 14:12 cmb69

In a test, I'm making a request using curl & receive a cookie. I parse the 'expires' datetime string from the cookie. The php 8.2 upgrade broke this, and now I have extra logic so the test is backward compatabile. So now I date_create_from_format('D, d-M-Y H:i:s e', $cookie_expires_value) & if that returns false, I date_create_from_format with the 8.2 format 'D, d M Y H:i:s e'.

On 12/9/22 8:30 AM, "Christoph M. Becker" @.***> wrote:

Hmm, I'm not sure this change is really worth to be documented. After all, the |setcookie()| documentation already mentions RFC 6265, and we're still conforming to that.

What's your particular use-case to consider this a breaking change?

— Reply to this email directly, view it on GitHub https://github.com/php/doc-en/issues/2049#issuecomment-1344378166, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAPAIAIDX2EOFVGN6ONPI3WMM7ATANCNFSM6AAAAAASYVV224. You are receiving this because you authored the thread.Message ID: @.***>

ReedyBear avatar Jan 06 '23 18:01 ReedyBear

Okay, let's document it then; it's not hard to do, and may save others some time.

cmb69 avatar Jan 06 '23 18:01 cmb69