View | Details | Raw Unified | Return to bug 122717
Collapse All | Expand All

(-)pecl-APC/files/patch-apc_main.c (-11 / +4 lines)
Lines 1-29 Link Here
1
#
1
--- apc_main.c.orig	2008-03-29 05:33:51.000000000 +0100
2
# Fix FD leak to PHP4 (from pecl-APC CVS)
2
+++ apc_main.c	2008-04-22 14:05:40.000000000 +0200
3
#
3
@@ -279,7 +279,9 @@
4
--- apc_main.c	2008/03/29 06:38:40	3.103.2.3
5
+++ apc_main.c	2008/03/31 14:14:12	3.103.2.4
6
@@ -279,7 +279,11 @@
7
     apc_cache_release(apc_cache, cache_entry);
4
     apc_cache_release(apc_cache, cache_entry);
8
 
5
 
9
     /* cannot free up cache data yet, it maybe in use */
6
     /* cannot free up cache data yet, it maybe in use */
10
-    
7
-    
11
+   
8
+   
12
+#ifndef ZEND_ENGINE_2 
13
+    zend_llist_del_element(&CG(open_files), h, compare_file_handles); /* We leak fds in PHP 4 without this hack */
9
+    zend_llist_del_element(&CG(open_files), h, compare_file_handles); /* We leak fds in PHP 4 without this hack */
14
+#endif 
15
+
10
+
16
     h->type = ZEND_HANDLE_FILENAME;
11
     h->type = ZEND_HANDLE_FILENAME;
17
 
12
 
18
     return NULL;
13
     return NULL;
19
@@ -351,6 +355,11 @@
14
@@ -351,6 +353,9 @@
20
             reset_opened_path = 1;
15
             reset_opened_path = 1;
21
         }
16
         }
22
         zend_hash_add(&EG(included_files), h->opened_path, strlen(h->opened_path)+1, (void *)&dummy, sizeof(int), NULL);
17
         zend_hash_add(&EG(included_files), h->opened_path, strlen(h->opened_path)+1, (void *)&dummy, sizeof(int), NULL);
23
+
18
+
24
+#ifndef ZEND_ENGINE_2 
25
+        zend_llist_add_element(&CG(open_files), h); /* We leak fds in PHP 4 without this hack */
19
+        zend_llist_add_element(&CG(open_files), h); /* We leak fds in PHP 4 without this hack */
26
+#endif
27
+
20
+
28
         apc_stack_push(APCG(cache_stack), cache_entry);
21
         apc_stack_push(APCG(cache_stack), cache_entry);
29
         op_array = cached_compile(h, type TSRMLS_CC);
22
         op_array = cached_compile(h, type TSRMLS_CC);

Return to bug 122717