[DOC-CVS] [doc-en] master: :memo: Document `Y` format footgun (#4926)
[email protected] (homersimpsons via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: homersimpsons (homersimpsons)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2025-10-15T14:54:52+01:00
Commit: https://github.com/php/doc-en/commit/dcf89d157a7e3f7fe6e74593af09b650c3cf7fbc
Raw diff: https://github.com/php/doc-en/commit/dcf89d157a7e3f7fe6e74593af09b650c3cf7fbc.diff
:memo: Document `Y` format footgun (#4926)
Updated descriptions for `Y` format to clearly shows that 2 digit years may lead to unexpected results.
Changed paths:
M reference/datetime/datetimeimmutable/createfromformat.xml
Diff:
diff --git a/reference/datetime/datetimeimmutable/createfromformat.xml b/reference/datetime/datetimeimmutable/createfromformat.xml
index d2aeff8ad55a..2a6be6f434c6 100644
--- a/reference/datetime/datetimeimmutable/createfromformat.xml
+++ b/reference/datetime/datetimeimmutable/createfromformat.xml
@@ -169,7 +169,7 @@
</row>
<row>
<entry><literal>X</literal> and <literal>x</literal></entry>
- <entry>A full numeric representation of a year, up to 19 digits,
+ <entry>A full numeric representation of a year, <emphasis>up to</emphasis> 19 digits,
optionally prefixed by <literal>+</literal> or
<literal>-</literal></entry>
<entry>Examples: <literal>0055</literal>, <literal>787</literal>,
@@ -178,9 +178,9 @@
</row>
<row>
<entry><literal>Y</literal></entry>
- <entry>A full numeric representation of a year, up to 4 digits</entry>
- <entry>Examples: <literal>0055</literal>, <literal>787</literal>,
- <literal>1999</literal>, <literal>2003</literal></entry>
+ <entry>A full numeric representation of a year, <emphasis>up to</emphasis> 4 digits</entry>
+ <entry>Examples: <literal>25</literal> (same as <literal>0025</literal>),
+ <literal>787</literal>, <literal>1999</literal>, <literal>2003</literal></entry>
</row>
<row>
<entry><literal>y</literal></entry>