From 336e9579515994e76784d40fbfbbd762f7cc21fe Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 20 Apr 2010 15:41:35 +0000 Subject: [PATCH] Fixed bug #49700 (memory leaks in php_date.c if garbage collector is enabled) --- NEWS | 2 ++ ext/date/php_date.c | 4 ++-- ext/date/tests/bug49700.phpt | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ext/date/tests/bug49700.phpt diff --git a/NEWS b/NEWS index 1841663245..02e29d4d81 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,8 @@ PHP NEWS - Fixed bug #50358 (Compile failure compiling ext/phar/util.lo). (Felipe) - Fixed bug #49778 (DateInterval::format("%a") is always zero when an interval is created from an ISO string). (Derick) +- Fixed bug #49700 (memory leaks in php_date.c if garbage collector is + enabled). (Dmitry) - Fixed bug #49576 (FILTER_VALIDATE_EMAIL filter needs updating) (Rasmus) - Fixed bug #49429 (odbc_autocommit doesn't work). (Felipe) - Fixed bug #49234 (mysqli_ssl_set not found). (Andrey) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 0cc86feeb7..07cfcec2fb 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2081,7 +2081,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) props = dateobj->std.properties; - if (!dateobj->time) { + if (!dateobj->time || GC_G(gc_active)) { return props; } @@ -2224,7 +2224,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) props = intervalobj->std.properties; - if (!intervalobj->initialized) { + if (!intervalobj->initialized || GC_G(gc_active)) { return props; } diff --git a/ext/date/tests/bug49700.phpt b/ext/date/tests/bug49700.phpt new file mode 100644 index 0000000000..a347052593 --- /dev/null +++ b/ext/date/tests/bug49700.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #49700 (memory leaks in php_date.c if garbage collector is enabled) +--INI-- +date.timezone=GMT +--FILE-- + +--EXPECT-- +OK -- 2.40.0