Fixed bug #49700 (memory leaks in php_date.c if garbage collector is enabled)

This commit is contained in:
Dmitry Stogov 2010-04-20 15:41:35 +00:00
parent 5ec6f1e9a1
commit e7d3ec6dee
2 changed files with 17 additions and 2 deletions

View file

@ -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;
}

View file

@ -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