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 | e7d3ec6dee56adcadee72b9991f828f34fe4938c (patch) | |
tree | fbb83e5d48fab2ab0f2ac69c8c347c08c2c8c06d | |
parent | 5ec6f1e9a10cf58f93eb3c2fd219c4345a940ad8 (diff) | |
download | php-git-e7d3ec6dee56adcadee72b9991f828f34fe4938c.tar.gz |
Fixed bug #49700 (memory leaks in php_date.c if garbage collector is enabled)
-rw-r--r-- | ext/date/php_date.c | 4 | ||||
-rw-r--r-- | ext/date/tests/bug49700.phpt | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 27025c096e..48b000272e 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2080,7 +2080,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; } @@ -2223,7 +2223,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 |