Edit report at https://bugs.php.net/bug.php?id=80279&edit=1
ID: 80279
Updated by: [email protected]
Reported by: php-bugs at allenjb dot me dot uk
Summary: DateTime::format / date_format: Mismatch between
signature and "return values"
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Date/time related
Operating System: n/a
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This has been fixed in the meantime:
<https://github.com/php/doc-en/commit/34188f8256bdc6f0e6e1965c2be94247997165b6>
Previous Comments:
------------------------------------------------------------------------
[2020-10-23 21:27:49] [email protected]
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] <<https://3v4l.org/2jto0>>
[2] <https://www.php.net/manual/en/functions.internal.php>
------------------------------------------------------------------------
[2020-10-23 20:27:02] php-bugs at allenjb dot me dot uk
Description:
------------
---
From manual page: https://php.net/datetime.format
---
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80279&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.