Skip to content

Commit c0bfcca

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix DateInterval->days value when object was created not from DateTime::diff()
2 parents a89e713 + b378b0b commit c0bfcca

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ext/date/php_date.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4064,7 +4064,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
40644064
ALLOC_INIT_ZVAL(retval);
40654065
Z_SET_REFCOUNT_P(retval, 0);
40664066

4067-
ZVAL_LONG(retval, value);
4067+
if (value != -99999) {
4068+
ZVAL_LONG(retval, value);
4069+
} else {
4070+
ZVAL_FALSE(retval);
4071+
}
40684072

40694073
if (member == &tmp_member) {
40704074
zval_dtor(member);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Wrong var_dump(DateInterval->days) value
3+
--FILE--
4+
<?php
5+
6+
$interval = new DateInterval('P2Y4DT6H8M');
7+
8+
var_dump($interval->days);
9+
--EXPECT--
10+
bool(false)

0 commit comments

Comments
 (0)