Fixed bug #55397: Comparsion of incomplete DateTime causes SIGSEGV.

This commit is contained in:
Derick Rethans 2013-01-06 13:38:22 +00:00
parent bc11e6fdbb
commit ff9c1b12ff
2 changed files with 16 additions and 1 deletions

View file

@ -2080,6 +2080,10 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
if (!o1->time || !o2->time) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object");
return 1;
}
if (!o1->time->sse_uptodate) {
timelib_update_ts(o1->time, o1->time->tz_info);
}

View file

@ -0,0 +1,11 @@
--TEST--
Bug #55397 (comparsion of incomplete DateTime causes SIGSEGV)
--INI--
--FILE--
<?php
date_default_timezone_set('Europe/Prague');
var_dump(unserialize('O:8:"DateTime":0:{}') == new DateTime);
?>
--EXPECTF--
Warning: %s: Trying to compare an incomplete DateTime object in %s on line %d
bool(false)