|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77064 Return type is contradictory
Submitted: 2018-10-26 06:22 UTC Modified: 2021-04-07 16:43 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: fabian dot picone at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
49 - 43 = ?
Subscribe to this entry?

 [2018-10-26 06:22 UTC] fabian dot picone at gmail dot com
From manual page:

This doc has something that does not match.

The description of the method is "public string DateTimeImmutable::format ( string $format )".

But the return value is documented as "Returns the formatted date string on success or FALSE on failure." .

What is correct now, is the return a string or mixed?

My tests showed up to result in string, could not break it to receive bool.

So is this internally casted to string? Then you should adapt the return documentation.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-26 08:05 UTC]
-Package: PHP Language Specification +Package: Date/time related
 [2018-10-26 08:05 UTC]
::format() returns FALSE, if an argument has an incompatible
type[1], or if the DateTimeImmutable instance has not been
properly initialized[2].

Regarding the return type declaration, see

[1] <>
[2] <>
 [2021-04-07 16:43 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-04-07 16:43 UTC]
This ticket is obsolete as of PHP 8.0.0, where the method no
longer returns false.  The documentation has already been updated.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Apr 22 00:01:23 2021 UTC