summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-06-12 15:31:01 +0200
committerAnatol Belski <ab@php.net>2018-06-12 15:31:01 +0200
commit5f1190684f6a6e2afa2c741b204d9ad89c5fa651 (patch)
tree970f80efff0fb9e348411f1baa32d90266026f5e /ext/date
parenteb2a3c6c654a85cb8d6a4c3bf77869cb2044ad5c (diff)
parent72128294352e8b8dbbfe43f85cb5bf79a24a9332 (diff)
downloadphp-git-5f1190684f6a6e2afa2c741b204d9ad89c5fa651.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed bug #76462 Undefined property: DateInterval::$f
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/php_date.c1
-rw-r--r--ext/date/tests/bug76462.phpt16
2 files changed, 17 insertions, 0 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 1ac7ad214e..a60422b6a6 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -4279,6 +4279,7 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int
zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
+ zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
/* Fallback to read_property. */
diff --git a/ext/date/tests/bug76462.phpt b/ext/date/tests/bug76462.phpt
new file mode 100644
index 0000000000..096fa5b923
--- /dev/null
+++ b/ext/date/tests/bug76462.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #76462 Undefined property: DateInterval::$f
+--FILE--
+<?php
+$buggy = new DateInterval('P0Y');
+$buggy->f += 0.01;
+
+$ok = new DateInterval('P0Y');
+$ok->f = $ok->f + 0.01;
+
+var_dump($buggy->f);
+var_dump($ok->f);
+?>
+--EXPECT--
+float(0.01)
+float(0.01)