dmitry Tue, 20 Apr 2010 15:41:35 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298222
Log: Fixed bug #49700 (memory leaks in php_date.c if garbage collector is enabled) Bug: http://bugs.php.net/49700 (Assigned) memory leaks in php_date.c if garbage collector is enabled Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/date/php_date.c A php/php-src/branches/PHP_5_3/ext/date/tests/bug49700.phpt U php/php-src/trunk/ext/date/php_date.c A php/php-src/trunk/ext/date/tests/bug49700.phpt Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-04-20 15:29:03 UTC (rev 298221) +++ php/php-src/branches/PHP_5_3/NEWS 2010-04-20 15:41:35 UTC (rev 298222) @@ -69,6 +69,8 @@ - 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) Modified: php/php-src/branches/PHP_5_3/ext/date/php_date.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/php_date.c 2010-04-20 15:29:03 UTC (rev 298221) +++ php/php-src/branches/PHP_5_3/ext/date/php_date.c 2010-04-20 15:41:35 UTC (rev 298222) @@ -2081,7 +2081,7 @@ props = dateobj->std.properties; - if (!dateobj->time) { + if (!dateobj->time || GC_G(gc_active)) { return props; } @@ -2224,7 +2224,7 @@ props = intervalobj->std.properties; - if (!intervalobj->initialized) { + if (!intervalobj->initialized || GC_G(gc_active)) { return props; } Added: php/php-src/branches/PHP_5_3/ext/date/tests/bug49700.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug49700.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug49700.phpt 2010-04-20 15:41:35 UTC (rev 298222) @@ -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 Modified: php/php-src/trunk/ext/date/php_date.c =================================================================== --- php/php-src/trunk/ext/date/php_date.c 2010-04-20 15:29:03 UTC (rev 298221) +++ php/php-src/trunk/ext/date/php_date.c 2010-04-20 15:41:35 UTC (rev 298222) @@ -2080,7 +2080,7 @@ props = dateobj->std.properties; - if (!dateobj->time) { + if (!dateobj->time || GC_G(gc_active)) { return props; } @@ -2223,7 +2223,7 @@ props = intervalobj->std.properties; - if (!intervalobj->initialized) { + if (!intervalobj->initialized || GC_G(gc_active)) { return props; } Added: php/php-src/trunk/ext/date/tests/bug49700.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/bug49700.phpt (rev 0) +++ php/php-src/trunk/ext/date/tests/bug49700.phpt 2010-04-20 15:41:35 UTC (rev 298222) @@ -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
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php