summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <github@derickrethans.nl>2013-01-06 15:07:25 +0000
committerDerick Rethans <github@derickrethans.nl>2013-01-06 15:07:25 +0000
commit4ff088d061ed3d4e15d38d0ed3f2fd10346c634c (patch)
treec220ad37e21a0493dd872d587c7a8191afb06b81
parent9934efff5fa174b3ae87f3e6295a2fe48f7ebd6f (diff)
parentba35ae32b7e9858e6590a616c4d5c2f0020cc7ab (diff)
downloadphp-git-4ff088d061ed3d4e15d38d0ed3f2fd10346c634c.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
-rw-r--r--ext/date/php_date.c6
-rw-r--r--ext/date/tests/bug55397.phpt11
2 files changed, 16 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 1ea218651a..0394cb6a5b 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2041,7 +2041,11 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) {
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);
}
diff --git a/ext/date/tests/bug55397.phpt b/ext/date/tests/bug55397.phpt
new file mode 100644
index 0000000000..efc09b5047
--- /dev/null
+++ b/ext/date/tests/bug55397.phpt
@@ -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)