From: Johannes Schlüter Date: Thu, 25 Jun 2009 15:07:36 +0000 (+0000) Subject: MFH: Fixed bug #48678 (DateInterval segfaults when unserialising (Ilia) X-Git-Tag: php-5.3.0~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63543769246a323ddc011126830e2f03f55a39c7;p=php MFH: Fixed bug #48678 (DateInterval segfaults when unserialising (Ilia) --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 230f1a5b0c..f55115be21 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2213,6 +2213,10 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) props = intervalobj->std.properties; + if (!intervalobj->initialized) { + return props; + } + #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ MAKE_STD_ZVAL(zv); \ ZVAL_LONG(zv, intervalobj->diff->f); \ diff --git a/ext/date/tests/bug48678.phpt b/ext/date/tests/bug48678.phpt new file mode 100644 index 0000000000..bf349412ba --- /dev/null +++ b/ext/date/tests/bug48678.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #48678 DateInterval segfaults when unserialising +--FILE-- + 3 + [m] => 6 + [d] => 4 + [h] => 12 + [i] => 30 + [s] => 5 + [invert] => 0 + [days] => 0 +) +DateInterval Object +( + [y] => 3 + [m] => 6 + [d] => 4 + [h] => 12 + [i] => 30 + [s] => 5 + [invert] => 0 + [days] => 0 +)