Skip to content

Add missing 8.0.0 changelog for datetime functions no longer returning false#5461

Open
KentarouTakeda wants to merge 1 commit intophp:masterfrom
KentarouTakeda:add-datetime-false-return-changelog
Open

Add missing 8.0.0 changelog for datetime functions no longer returning false#5461
KentarouTakeda wants to merge 1 commit intophp:masterfrom
KentarouTakeda:add-datetime-false-return-changelog

Conversation

@KentarouTakeda
Copy link
Copy Markdown
Contributor

In PHP 7.x, several datetime functions returned false on parameter parsing failure. PHP 8.0 changed this to throw TypeError instead (per RFC: Consistent type errors for internal functions).

This changelog entry was already documented for
DateTimeZone::listIdentifiers/timezone_identifiers_list, but was missing from the following functions:

  • date()
  • gmdate()
  • localtime()
  • getdate()
  • date_parse()
  • date_parse_from_format()
  • date_sun_info()

Functions that still return false from their own logic (e.g. strtotime(), mktime(), date_create()) are not included, as the parameter parsing change is not observable in their return types.

The issue also requests reverting the return value description to mention false, but the old text was inaccurate (non-numeric strings were coerced to 0, not rejected) and was intentionally removed in #2130.

Closes #5460

Copy link
Copy Markdown
Contributor

@jordikroon jordikroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, just some minor nits since exceptionname is preferred for throwables.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure, but throws a
<classname>TypeError</classname> instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<classname>TypeError</classname> instead.
<exceptionname>TypeError</exceptionname> instead.

…g false

In PHP 7.x, several datetime functions returned `false` on parameter
parsing failure. PHP 8.0 changed this to throw `TypeError` instead
(per RFC: Consistent type errors for internal functions).

This changelog entry was already documented for
`DateTimeZone::listIdentifiers`/`timezone_identifiers_list`, but was
missing from the following functions:

- `date()`
- `gmdate()`
- `localtime()`
- `getdate()`
- `date_parse()`
- `date_parse_from_format()`
- `date_sun_info()`

Functions that still return `false` from their own logic (e.g.
`strtotime()`, `mktime()`, `date_create()`) are not included, as the
parameter parsing change is not observable in their return types.

The issue also requests reverting the return value description to
mention `false`, but the old text was inaccurate (non-numeric strings
were coerced to `0`, not rejected) and was intentionally removed in
phpGH-2130.

Closes php#5460
@KentarouTakeda KentarouTakeda force-pushed the add-datetime-false-return-changelog branch from 969c786 to 0316846 Compare April 4, 2026 11:24
@KentarouTakeda
Copy link
Copy Markdown
Contributor Author

Thanks for the review! Good catch — I've updated all occurrences to use <exceptionname> as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The date function document contains errors or is missing information.

2 participants