|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66789 date() - hasn't warning if pass on second param bool or null type
Submitted: 2014-02-27 11:32 UTC Modified: 2016-06-14 16:21 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: e dot romanov88 at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Documentation problem
PHP Version: 5.4.25 OS: SentOS
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.
Bug Type:
From: e dot romanov88 at gmail dot com
New email:
PHP Version: OS:


 [2014-02-27 11:32 UTC] e dot romanov88 at gmail dot com
From manual page:

If a non-numeric value is used for timestamp, FALSE is returned and an E_WARNING level error is emitted. - 

date('Y-m-d H:i:s', null) or date('Y-m-d H:i:s', false) - hasn't warning, and function return reusult like date('Y-m-d H:i:s', 0);

Test script:
echo date('Y-m-d H:i:s', null);

Expected result:
PHP Warning:  date() expects parameter 2 to be long, null given.

Actual result:
"1970-01-01 03:00:00"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-14 16:21 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2016-06-14 16:21 UTC]
That behavior is already documented for built-in functions

| If the parameters given to a function are not what it expects,
| such as passing an array where a string is expected, the return
| value of the function is undefined.

It would be distracting to document this for each built-in
function explicitly.

[1] <>
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 00:01:23 2020 UTC