php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amagamedov at sslco dot com
New email:
PHP Version: OS:

 

 [2018-08-16 23:01 UTC] amagamedov at sslco dot com
Description:
------------
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:
----------------
bool(true)

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

bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-17 05:46 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d61ff37f45de803ec45dd7f722bf4b51c3b0be02
Log: Fixed bug #76755 (setcookie does not accept "double" type for expire time)
 [2018-08-17 05:46 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 11 06:01:30 2024 UTC