Skip to content

The date function document contains errors or is missing information. #5460

@mecaota

Description

@mecaota

Affected page

https://php.net/function.date

Current issue

The date function was defined in the documentation as returning "a string or false" until 2022, but from 2023 onwards, the description has been changed to "a string only". This is likely due to the introduction of nullability in PHP 8, but there is no mention of this change in the version history or in the section on return values, which is extremely unhelpful.

If it used to return false in PHP 7 and earlier, that should have been noted.

Suggested improvement

Please revert to the previous description of the return value: "Returns a formatted date string. If a non-numeric value is used for timestamp, false is returned and an E_WARNING level error is emitted." Also, if the behavior is different in PHP8, please add a note stating "This behavior occurs in PHP7 and earlier."

Furthermore, please include this change in the Changelog.

Additional context (optional)

2022-12-17 weyback machines archieve: https://web.archive.org/web/20221215104026/https://www.php.net/manual/en/function.date.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions