php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fabian dot picone at gmail dot com
New email:
PHP Version: OS:

 

 [2018-10-26 06:22 UTC] fabian dot picone at gmail dot com
Description:
------------
---
From manual page: https://php.net/datetime.format
---

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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-26 08:05 UTC] cmb@php.net
-Package: PHP Language Specification +Package: Date/time related
 [2018-10-26 08:05 UTC] cmb@php.net
::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
<http://news.php.net/php.doc/969386834>ff.

[1] <https://github.com/php/php-src/blob/php-7.3.0RC4/ext/date/php_date.c#L3170-L3172>
[2] <https://github.com/php/php-src/blob/php-7.3.0RC4/ext/date/php_date.c#L3174>
 [2021-04-07 16:43 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-04-07 16:43 UTC] cmb@php.net
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: Fri Apr 23 06:01:24 2021 UTC