[Pkg-php-commits] [php/debian-sid] Cherry pick fix for memory leak in date when gc is enabled
Raphael Geissert
geissert at debian.org
Sat May 1 19:21:42 UTC 2010
---
debian/patches/series | 1 +
debian/patches/upstream/date_mem_leak.patch | 46 +++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
create mode 100644 debian/patches/upstream/date_mem_leak.patch
diff --git a/debian/patches/series b/debian/patches/series
index 7f8c1fc..2313b90 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -58,3 +58,4 @@ upstream/pdo_reset_error_beginTransaction.patch
upstream/define_json_error_utf8.patch
upstream/SplFileInfo_getPathName_parent.patch
upstream/gc_memory_leak.patch
+upstream/date_mem_leak.patch
diff --git a/debian/patches/upstream/date_mem_leak.patch b/debian/patches/upstream/date_mem_leak.patch
new file mode 100644
index 0000000..cc0645e
--- /dev/null
+++ b/debian/patches/upstream/date_mem_leak.patch
@@ -0,0 +1,46 @@
+Description: Fix memory leak in date if the gc is enabled
+Origin: http://svn.php.net/viewvc?view=revision&revision=298222
+Last-Update: 2010-05-01
+
+Index: php/ext/date/php_date.c
+===================================================================
+--- php.orig/ext/date/php_date.c
++++ php/ext/date/php_date.c
+@@ -2081,7 +2081,7 @@ static HashTable *date_object_get_proper
+
+ 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_proper
+
+ props = intervalobj->std.properties;
+
+- if (!intervalobj->initialized) {
++ if (!intervalobj->initialized || GC_G(gc_active)) {
+ return props;
+ }
+
+Index: php/ext/date/tests/bug49700.phpt
+===================================================================
+--- /dev/null
++++ php/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
--
1.6.5
More information about the Pkg-php-commits
mailing list