Doc #66789 [Opn->Nab]: date() - hasn't warning if pass on second param bool or null type
| From: | cmb@php.net | Date: | Tue, 14 Jun 2016 16:21:33 +0000 |
| Subject: | Doc #66789 [Opn->Nab]: date() - hasn't warning if pass on second param bool or null type | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13524@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66789&edit=1
ID: 66789
Updated by: cmb@php.net
Reported by: e dot romanov88 at gmail dot com
Summary: date() - hasn't warning if pass on second param bool
or null type
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: SentOS
PHP Version: 5.4.25
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[2014-02-27 11:32:09] 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"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66789&edit=1