summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2018-08-17 13:45:43 +0800
committerXinchen Hui <laruence@gmail.com>2018-08-17 13:45:43 +0800
commitd61ff37f45de803ec45dd7f722bf4b51c3b0be02 (patch)
tree12566977143729825c449e0b4f8c759dacdc9e88
parent2aa3733daa25838946b976ed567e2ba2d1700a42 (diff)
downloadphp-git-d61ff37f45de803ec45dd7f722bf4b51c3b0be02.tar.gz
Fixed bug #76755 (setcookie does not accept "double" type for expire time)
-rw-r--r--NEWS4
-rw-r--r--ext/standard/head.c2
-rw-r--r--ext/standard/tests/network/bug76755.phpt8
3 files changed, 13 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 940bebf2f0..66a302e516 100644
--- 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:
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 5e753840cc..2ba68aabcf 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -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
index 0000000000..361ae8a1a8
--- /dev/null
+++ b/ext/standard/tests/network/bug76755.phpt
@@ -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)