Bug #78509 [Opn->Nab]: Calling time() with parameter(s) returns NULL
| From: | girgias@php.net | Date: | Sat, 07 Sep 2019 15:04:37 +0000 |
| Subject: | Bug #78509 [Opn->Nab]: Calling time() with parameter(s) returns NULL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222623@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78509&edit=1
ID: 78509
Updated by: girgias@php.net
Reported by: gvre at gvre dot gr
Summary: Calling time() with parameter(s) returns NULL
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
-Operating System: Linux
+Operating System:
-PHP Version: 7.3Git-2019-09-07 (Git)
+PHP Version: 7.3
Block user comment: N
Private report: N
New Comment:
This is not a bug on PHP's side, moreover this will throw an ArgumentCountError as of PHP 8.
[1]
[1] https://wiki.php.net/rfc/consistent_type_errors
Previous Comments:
------------------------------------------------------------------------
[2019-09-07 12:25:24] gvre at gvre dot gr
Description:
------------
Calling the "time()" function with a parameter works fine in PHP <= 7.2.x and returns
an int. In PHP 7.3, it returns NULL and produces a "Warning: time() expects exactly 0
parameters, 1 given" message instead.
https://3v4l.org/OT21N
https://github.com/php/php-src/blob/php-7.3.0/ext/date/php_date.c#L1775
I know that passing a parameter to time() is wrong, but I think it could produce a warning and
return the value in PHP 7.3 (and 7.4 maybe), since it works fine in 7.2 and is common in C to call
it that way.
I did not find anything related to deprecation pages, so it may be useful to document this behavior
as deprecated in case you decide to keep it as is.
Test script:
---------------
<?php
var_dump(time(null));
Expected result:
----------------
The current Unix timestamp.
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78509&edit=1