diff options
author | Stanislav Malyshev <stas@php.net> | 2013-08-24 23:38:54 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2013-08-24 23:38:54 -0700 |
commit | c0bfccafd2b09e3772adbade33b1e47bd15fcc97 (patch) | |
tree | 2503ac81d0d508d9b46fbeb4343300713f379b94 | |
parent | a89e71397d5842e5a322378867ec571739d1c829 (diff) | |
parent | b378b0b081c2c3dd4a7aa25ce4d37bad48db752e (diff) | |
download | php-git-c0bfccafd2b09e3772adbade33b1e47bd15fcc97.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
Fix DateInterval->days value when object was created not from DateTime::diff()
-rw-r--r-- | ext/date/php_date.c | 6 | ||||
-rw-r--r-- | ext/date/tests/DateInterval_days_prop1.phpt | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index f0c9525e56..8afe47fbcc 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -4064,7 +4064,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze ALLOC_INIT_ZVAL(retval); Z_SET_REFCOUNT_P(retval, 0); - ZVAL_LONG(retval, value); + if (value != -99999) { + ZVAL_LONG(retval, value); + } else { + ZVAL_FALSE(retval); + } if (member == &tmp_member) { zval_dtor(member); diff --git a/ext/date/tests/DateInterval_days_prop1.phpt b/ext/date/tests/DateInterval_days_prop1.phpt new file mode 100644 index 0000000000..627b8f0b27 --- /dev/null +++ b/ext/date/tests/DateInterval_days_prop1.phpt @@ -0,0 +1,10 @@ +--TEST-- +Wrong var_dump(DateInterval->days) value +--FILE-- +<?php + +$interval = new DateInterval('P2Y4DT6H8M'); + +var_dump($interval->days); +--EXPECT-- +bool(false) |