mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed bug #49700 (memory leaks in php_date.c if garbage collector is enabled)
This commit is contained in:
parent
5ec6f1e9a1
commit
e7d3ec6dee
2 changed files with 17 additions and 2 deletions
|
@ -2080,7 +2080,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
|
||||||
|
|
||||||
props = dateobj->std.properties;
|
props = dateobj->std.properties;
|
||||||
|
|
||||||
if (!dateobj->time) {
|
if (!dateobj->time || GC_G(gc_active)) {
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2223,7 +2223,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
|
||||||
|
|
||||||
props = intervalobj->std.properties;
|
props = intervalobj->std.properties;
|
||||||
|
|
||||||
if (!intervalobj->initialized) {
|
if (!intervalobj->initialized || GC_G(gc_active)) {
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
ext/date/tests/bug49700.phpt
Normal file
15
ext/date/tests/bug49700.phpt
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue