Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromphp/php-src

Commitff9c1b1

Browse files
committed
Fixed bug #55397: Comparsion of incomplete DateTime causes SIGSEGV.
1 parentbc11e6f commitff9c1b1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎ext/date/php_date.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,11 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
20792079
instanceof_function(Z_OBJCE_P(d2),date_ce_dateTSRMLS_CC)) {
20802080
php_date_obj*o1=zend_object_store_get_object(d1TSRMLS_CC);
20812081
php_date_obj*o2=zend_object_store_get_object(d2TSRMLS_CC);
2082-
2082+
2083+
if (!o1->time|| !o2->time) {
2084+
php_error_docref(NULLTSRMLS_CC,E_WARNING,"Trying to compare an incomplete DateTime object");
2085+
return1;
2086+
}
20832087
if (!o1->time->sse_uptodate) {
20842088
timelib_update_ts(o1->time,o1->time->tz_info);
20852089
}

‎ext/date/tests/bug55397.phpt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #55397 (comparsion of incomplete DateTime causes SIGSEGV)
3+
--INI--
4+
--FILE--
5+
<?php
6+
date_default_timezone_set('Europe/Prague');
7+
var_dump(unserialize('O:8:"DateTime":0:{}') ==newDateTime);
8+
?>
9+
--EXPECTF--
10+
Warning: %s: Trying to compare an incomplete DateTime object in %s on line %d
11+
bool(false)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp