|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80279 DateTime::format / date_format: Mismatch between signature and "return values"
Submitted: 2020-10-23 20:27 UTC Modified: 2020-10-23 21:27 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: php-bugs at allenjb dot me dot uk Assigned:
Status: Open Package: Date/time related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-10-23 20:27 UTC] php-bugs at allenjb dot me dot uk
From manual page:

The signature says this function always returns string. The documentation also mentions (and I've confirmed) that unrecognized values (eg 'f') are returned 'as-is'.

The Return Values section however says the function may "return FALSE on failure".

I can't think of any circumstances in which this function would fail. I've glanced at the php-src code and think it probably should never return false, but would like someone more familiar with the code to confirm.

If the function may return FALSE, in addition to fixing the signature return type, could the Return Values section be expanded to give an example of when this function may fail.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-23 21:27 UTC]
-Package: Documentation problem +Package: Date/time related
 [2020-10-23 21:27 UTC]
The date_format() function and its method aliases return false
only in case of unsupported argument types[1], and only prior to
PHP 8.0.0.  Note that unsupported argument types are documented to
yield *undefined* return values[2], so this may not even something
we want to document explicitly for each function, although that
usually changes with PHP 8, where unsupported argument types by
convention should result in a TypeError.

[1] <<>>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 14:01:24 2021 UTC