]> granicus.if.org Git - php/commitdiff
Fixed bug #76755 (setcookie does not accept "double" type for expire time)
authorXinchen Hui <laruence@gmail.com>
Fri, 17 Aug 2018 05:45:43 +0000 (13:45 +0800)
committerXinchen Hui <laruence@gmail.com>
Fri, 17 Aug 2018 05:45:43 +0000 (13:45 +0800)
NEWS
ext/standard/head.c
ext/standard/tests/network/bug76755.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 940bebf2f0e35cfe7d79db5deb8c79962ea50deb..66a302e516e44d8dae778969dfa3dbbb13ce65bd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ PHP                                                                        NEWS
   . Fixed bug #76747 (Opcache treats path containing "test.pharma.tld" as a phar
     file). (Laruence)
 
+- Standard:
+  . Fixed bug #76755 (setcookie does not accept "double" type for expire time).
+    (Laruence)
+
 16 Aug 2018, PHP 7.3.0beta2
 
 - Core:
index 5e753840ccf8b20e6b443b2ba60c6b1a10d748e5..2ba68aabcf6e47db7e856050aab37daafb42acad 100644 (file)
@@ -286,7 +286,7 @@ PHP_FUNCTION(setcookie)
                                goto cleanup;
                        }
                } else {
-                       expires = Z_LVAL_P(expires_or_options);
+                       expires = zval_get_long(expires_or_options);
                }
        }
 
diff --git a/ext/standard/tests/network/bug76755.phpt b/ext/standard/tests/network/bug76755.phpt
new file mode 100644 (file)
index 0000000..361ae8a
--- /dev/null
@@ -0,0 +1,8 @@
+--TEST--
+Bug #76755 (setcookie does not accept "double" type for expire time)
+--FILE--
+<?php
+var_dump(setcookie('name', 'value', (real)(time() + 1296000)));
+?>
+--EXPECT--
+bool(true)