|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76755 setcookie does not accept "double" type for expire time
Submitted: 2018-08-16 23:01 UTC Modified: -
From: amagamedov at sslco dot com Assigned:
Status: Closed Package: HTTP related
PHP Version: Next Minor Version OS: Windows Server 2008 RC2
Private report: No CVE-ID: None
 [2018-08-16 23:01 UTC] amagamedov at sslco dot com
I don't really know if it's an issue in php 7.3.0 beta 1, but it used to work on php 7.2, 7.1, 7.0, 5.6 and 5.5.

This function call:

setcookie('name', 'value', (real)(time() + 1296000));

returns "false" and generates a warning: "Expiry date cannot have a year greater than 9999" when called in PHP 7.3.0 beta 1

If I change (real) to (int) it works fine:

setcookie('name', 'value', (int)(time() + 1296000));

Test script:
var_dump(setcookie('name', 'value', (real)(time() + 1296000)));

Expected result:

Actual result:
Warning: Expiry date cannot have a year greater than 9999



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-17 05:46 UTC]
Automatic comment on behalf of
Log: Fixed bug #76755 (setcookie does not accept "double" type for expire time)
 [2018-08-17 05:46 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 22:01:27 2024 UTC