diff options
author | Dmitry Stogov <dmitry@php.net> | 2010-04-20 15:41:35 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2010-04-20 15:41:35 +0000 |
commit | 336e9579515994e76784d40fbfbbd762f7cc21fe (patch) | |
tree | d624f57c5ee6ad4f97de9c2cbc62e18964d53a6d | |
parent | 5aedea717917628b93ebf9f5f767dd5d17f898b3 (diff) | |
download | php-git-336e9579515994e76784d40fbfbbd762f7cc21fe.tar.gz |
Fixed bug #49700 (memory leaks in php_date.c if garbage collector is enabled)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/date/php_date.c | 4 | ||||
-rw-r--r-- | ext/date/tests/bug49700.phpt | 15 |
3 files changed, 19 insertions, 2 deletions
@@ -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-- +<?php +gc_enable(); +$objs = array(); +$objs[1] = new DateTime(); +gc_collect_cycles(); +unset($objs); +echo "OK\n"; +?> +--EXPECT-- +OK |