php.net |  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
Votes:1
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.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
---
From manual page: http://www.php.net/function.date
---

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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

| 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] <http://php.net/manual/en/functions.internal.php>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC