From 10aea07a14325aa0bfb5fe75ddcf19432c6e2c64 Mon Sep 17 00:00:00 2001 From: Dragan Dosen Date: Tue, 2 Sep 2008 22:06:32 +0200 Subject: [PATCH] New PHP5 APC - version 3.0.19, using PHP5 5.2.0-8+etch11, 20060613+lfs. --- CHANGELOG | 8 ++++- LICENSE | 2 +- apc.c | 6 ++-- apc.h | 4 +-- apc.php | 4 +-- apc_cache.c | 21 ++--------- apc_cache.h | 8 ++--- apc_compile.c | 63 +++++++++++++++++++++------------ apc_compile.h | 4 +-- apc_debug.c | 4 +-- apc_fcntl.c | 4 +-- apc_fcntl.h | 4 +-- apc_fcntl_win32.c | 4 +-- apc_futex.c | 4 +-- apc_futex.h | 4 +-- apc_globals.h | 7 ++-- apc_lock.h | 4 +-- apc_main.c | 37 +++++++++++--------- apc_main.h | 4 +-- apc_mmap.c | 4 +-- apc_php.h | 7 ++-- apc_pthreadmutex.c | 4 +-- apc_pthreadmutex.h | 4 +-- apc_rfc1867.c | 4 +-- apc_sem.c | 4 +-- apc_sem.h | 4 +-- apc_shm.c | 4 +-- apc_shm.h | 4 +-- apc_signal.c | 4 +-- apc_signal.h | 4 +-- apc_sma.c | 5 ++- apc_sma.h | 4 +-- apc_spin.c | 4 +-- apc_spin.h | 4 +-- apc_stack.c | 4 +-- apc_stack.h | 4 +-- apc_zend.c | 4 +-- apc_zend.h | 4 +-- debian/changelog | 7 ++++ pgsql_s_lock.c | 4 +-- pgsql_s_lock.h | 4 +-- php_apc.c | 19 +++++----- php_apc.h | 4 +-- tests/apc_003.phpt | 99 +++++++++++++++++++++++----------------------------- 44 files changed, 212 insertions(+), 201 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c140244..ee26c27 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +3.0.19: 2008-05-14 +- Move expunge callback groundwork to 3.1 (Rasmus) +- Fix fd-leak (Gopal) +- Fix double-free on builtin functions (Gopal) +- Initial PHP 5.3 support (Gopal) + 3.0.18: 2008-03-28 - Revert memleak patch (Gopal) - Fix for bug #13504 (David Fraser) @@ -7,7 +13,7 @@ - Fix apc_add() cache expunge bug (Rasmus) - Added parameter to apc_fetch to determine success/failure when fetching booleans (shire) - Fix misc. memleaks (shire) - + 3.0.16: 2007-12-26 - Fix for longstanding cache-full crash (Christian Seiler) http://news.php.net/php.pecl.dev/4951 for the details diff --git a/LICENSE b/LICENSE index 8d3fa07..25662b2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -------------------------------------------------------------------- The PHP License, version 3.01 -Copyright (c) 1999 - 2006 The PHP Group. All rights reserved. +Copyright (c) 1999 - 2008 The PHP Group. All rights reserved. -------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without diff --git a/apc.c b/apc.c index 14fc3ea..6dd668d 100644 --- a/apc.c +++ b/apc.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -29,7 +29,7 @@ */ -/* $Id: apc.c,v 3.18.2.1 2008/03/25 18:04:53 gopalv Exp $ */ +/* $Id: apc.c,v 3.18.2.3 2008/05/13 15:48:48 gopalv Exp $ */ #include "apc.h" #include /* for POSIX regular expressions */ @@ -273,7 +273,7 @@ char** apc_tokenize(const char* s, char delim) /* similar to php_stream_stat_path */ #ifdef ZEND_ENGINE_2 #define APC_URL_STAT(wrapper, filename, pstatbuf) \ - ((wrapper)->wops->url_stat((wrapper), (filename), 0, (pstatbuf), NULL TSRMLS_CC)) + ((wrapper)->wops->url_stat((wrapper), (filename), PHP_STREAM_URL_STAT_QUIET, (pstatbuf), NULL TSRMLS_CC)) #else #define APC_URL_STAT(wrapper, filename, pstatbuf) \ ((wrapper)->wops->url_stat((wrapper), (filename), (pstatbuf) TSRMLS_CC)) diff --git a/apc.h b/apc.h index d71036e..92182ae 100644 --- a/apc.h +++ b/apc.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -29,7 +29,7 @@ */ -/* $Id: apc.h,v 3.14.2.1 2008/03/25 18:04:53 gopalv Exp $ */ +/* $Id: apc.h,v 3.14.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_H #define APC_H diff --git a/apc.php b/apc.php index 3b45aae..dee11cd 100644 --- a/apc.php +++ b/apc.php @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -22,7 +22,7 @@ */ -$VERSION='$Id: apc.php,v 3.68.2.1 2008/03/25 18:04:53 gopalv Exp $'; +$VERSION='$Id: apc.php,v 3.68.2.2 2008/05/11 18:57:00 rasmus Exp $'; ////////// READ OPTIONAL CONFIGURATION FILE //////////// if (file_exists("apc.conf.php")) include("apc.conf.php"); diff --git a/apc_cache.c b/apc_cache.c index 62d5f8b..a837871 100644 --- a/apc_cache.c +++ b/apc_cache.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -28,7 +28,7 @@ */ -/* $Id: apc_cache.c,v 3.145.2.2 2008/03/25 18:24:57 gopalv Exp $ */ +/* $Id: apc_cache.c,v 3.145.2.4 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_cache.h" #include "apc_lock.h" @@ -54,8 +54,6 @@ #define key_equals(a, b) (a.inode==b.inode && a.device==b.device) /* }}} */ -static void apc_cache_expunge(apc_cache_t* cache, size_t size); - /* {{{ hash */ static unsigned int hash(apc_cache_key_t key) { @@ -265,7 +263,6 @@ apc_cache_t* apc_cache_create(int size_hint, int gc_ttl, int ttl) for (i = 0; i < num_slots; i++) { cache->slots[i] = NULL; } - cache->expunge_cb = apc_cache_expunge; return cache; } @@ -307,21 +304,9 @@ void apc_cache_clear(apc_cache_t* cache) /* }}} */ /* {{{ apc_cache_expunge */ -static void apc_cache_expunge(apc_cache_t* cache, size_t size) +void apc_cache_expunge(apc_cache_t* cache, time_t t) { int i; - time_t t; - TSRMLS_FETCH(); - -#if PHP_API_VERSION < 20041225 -#if HAVE_APACHE && defined(APC_PHP4_STAT) - t = ((request_rec *)SG(server_context))->request_time; -#else - t = time(0); -#endif -#else - t = sapi_get_request_time(TSRMLS_C); -#endif if(!cache) return; diff --git a/apc_cache.h b/apc_cache.h index a36c46f..8b6f399 100644 --- a/apc_cache.h +++ b/apc_cache.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_cache.h,v 3.46.2.2 2008/03/25 18:24:57 gopalv Exp $ */ +/* $Id: apc_cache.h,v 3.46.2.4 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_CACHE_H #define APC_CACHE_H @@ -309,8 +309,6 @@ struct cache_header_t { }; /* }}} */ -typedef void (*apc_expunge_cb_t)(T cache, size_t n); - /* {{{ struct definition: apc_cache_t */ struct apc_cache_t { void* shmaddr; /* process (local) address of shared cache */ @@ -319,12 +317,12 @@ struct apc_cache_t { int num_slots; /* number of slots in cache */ int gc_ttl; /* maximum time on GC list for a slot */ int ttl; /* if slot is needed and entry's access time is older than this ttl, remove it */ - apc_expunge_cb_t expunge_cb; /* cache specific expunge callback to free up sma memory */ }; /* }}} */ extern apc_cache_info_t* apc_cache_info(T cache, zend_bool limited); extern void apc_cache_free_info(apc_cache_info_t* info); +extern void apc_cache_expunge(apc_cache_t* cache, time_t t); extern void apc_cache_unlock(apc_cache_t* cache); extern zend_bool apc_cache_busy(apc_cache_t* cache); extern zend_bool apc_cache_write_lock(apc_cache_t* cache); diff --git a/apc_compile.c b/apc_compile.c index 7627a55..112bb40 100644 --- a/apc_compile.c +++ b/apc_compile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -28,7 +28,7 @@ */ -/* $Id: apc_compile.c,v 3.87.2.4 2008/03/28 21:05:14 rasmus Exp $ */ +/* $Id: apc_compile.c,v 3.87.2.8 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_compile.h" #include "apc_globals.h" @@ -100,7 +100,7 @@ static zval* my_copy_zval(zval*, const zval*, apc_malloc_t, apc_free_t); static znode* my_copy_znode(znode*, znode*, apc_malloc_t, apc_free_t); static zend_op* my_copy_zend_op(zend_op*, zend_op*, apc_malloc_t, apc_free_t); static zend_function* my_copy_function(zend_function*, zend_function*, apc_malloc_t, apc_free_t); -static zend_function_entry* my_copy_function_entry(zend_function_entry*, zend_function_entry*, apc_malloc_t, apc_free_t); +static zend_function_entry* my_copy_function_entry(zend_function_entry*, const zend_function_entry*, apc_malloc_t, apc_free_t); static zend_class_entry* my_copy_class_entry(zend_class_entry*, zend_class_entry*, apc_malloc_t, apc_free_t); static HashTable* my_copy_hashtable_ex(HashTable*, HashTable*, ht_copy_fun_t, ht_free_fun_t, int, apc_malloc_t, apc_free_t, ht_check_copy_fun_t, ...); #define my_copy_hashtable( dst, src, copy_fn, free_fn, holds_ptr, allocate, deallocate) \ @@ -108,8 +108,8 @@ static HashTable* my_copy_hashtable_ex(HashTable*, HashTable*, ht_copy_fun_t, ht static HashTable* my_copy_static_variables(zend_op_array* src, apc_malloc_t allocate, apc_free_t deallocate); #ifdef ZEND_ENGINE_2 static zend_property_info* my_copy_property_info(zend_property_info* dst, zend_property_info* src, apc_malloc_t allocate, apc_free_t deallocate); -static zend_arg_info* my_copy_arg_info_array(zend_arg_info*, zend_arg_info*, uint, apc_malloc_t, apc_free_t); -static zend_arg_info* my_copy_arg_info(zend_arg_info*, zend_arg_info*, apc_malloc_t, apc_free_t); +static zend_arg_info* my_copy_arg_info_array(zend_arg_info*, const zend_arg_info*, uint, apc_malloc_t, apc_free_t); +static zend_arg_info* my_copy_arg_info(zend_arg_info*, const zend_arg_info*, apc_malloc_t, apc_free_t); #endif /* * The "destroy" functions free the memory associated with a particular data @@ -292,10 +292,21 @@ static zval** my_copy_zval_ptr(zval** dst, const zval** src, apc_malloc_t alloca local_dst_alloc = 1; } +#ifdef ZEND_ENGINE_2_3 + if(!(dst[0] = (zval*) allocate(sizeof(zval_gc_info)))) { + if(local_dst_alloc) deallocate(dst); + return NULL; + } + + if(allocate == apc_php_malloc) { + GC_ZVAL_INIT(dst[0]); + } +#else if(!(dst[0] = (zval*) allocate(sizeof(zval)))) { if(local_dst_alloc) deallocate(dst); return NULL; } +#endif if(!(dst_new = my_copy_zval(*dst, *src, allocate, deallocate))) { if(local_dst_alloc) deallocate(dst); return NULL; @@ -305,8 +316,8 @@ static zval** my_copy_zval_ptr(zval** dst, const zval** src, apc_malloc_t alloca *dst = dst_new; } - Z_SET_REFCOUNT_PP(dst, Z_REFCOUNT_PP(src)); - Z_SET_ISREF_TO_PP(dst, Z_ISREF_PP(src)); + Z_SET_REFCOUNT_PP(dst, Z_REFCOUNT_PP((zval**)src)); + Z_SET_ISREF_TO_PP(dst, Z_ISREF_PP((zval**)src)); return dst; } @@ -501,7 +512,7 @@ static zend_function* my_copy_function(zend_function* dst, zend_function* src, a /* }}} */ /* {{{ my_copy_function_entry */ -static zend_function_entry* my_copy_function_entry(zend_function_entry* dst, zend_function_entry* src, apc_malloc_t allocate, apc_free_t deallocate) +static zend_function_entry* my_copy_function_entry(zend_function_entry* dst, const zend_function_entry* src, apc_malloc_t allocate, apc_free_t deallocate) { int local_dst_alloc = 0; assert(src != NULL); @@ -550,7 +561,7 @@ static zend_function_entry* my_copy_function_entry(zend_function_entry* dst, zen return dst; cleanup: - if(dst->fname) deallocate(dst->fname); + if(dst->fname) deallocate((char*)dst->fname); if(local_dst_alloc) deallocate(dst); return NULL; } @@ -629,7 +640,7 @@ static zend_property_info* my_copy_property_info_for_execution(zend_property_inf /* }}} */ /* {{{ my_copy_arg_info_array */ -static zend_arg_info* my_copy_arg_info_array(zend_arg_info* dst, zend_arg_info* src, uint num_args, apc_malloc_t allocate, apc_free_t deallocate) +static zend_arg_info* my_copy_arg_info_array(zend_arg_info* dst, const zend_arg_info* src, uint num_args, apc_malloc_t allocate, apc_free_t deallocate) { int local_dst_alloc = 0; int i = 0; @@ -656,7 +667,7 @@ static zend_arg_info* my_copy_arg_info_array(zend_arg_info* dst, zend_arg_info* /* }}} */ /* {{{ my_copy_arg_info */ -static zend_arg_info* my_copy_arg_info(zend_arg_info* dst, zend_arg_info* src, apc_malloc_t allocate, apc_free_t deallocate) +static zend_arg_info* my_copy_arg_info(zend_arg_info* dst, const zend_arg_info* src, apc_malloc_t allocate, apc_free_t deallocate) { int local_dst_alloc = 0; @@ -690,8 +701,8 @@ static zend_arg_info* my_copy_arg_info(zend_arg_info* dst, zend_arg_info* src, a return dst; cleanup: - if(dst->name) deallocate(dst->name); - if(dst->class_name) deallocate(dst->name); + if(dst->name) deallocate((char*)dst->name); + if(dst->class_name) deallocate((char*)dst->class_name); if(local_dst_alloc) deallocate(dst); return NULL; } @@ -881,12 +892,12 @@ static zend_class_entry* my_copy_class_entry(zend_class_entry* dst, zend_class_e for (i = 0; i < n; i++) { - if(!my_copy_function_entry(&dst->builtin_functions[i], + if(!my_copy_function_entry((zend_function_entry*)(&dst->builtin_functions[i]), &src->builtin_functions[i], allocate, deallocate)) { int ii; - for(ii=i-1; i>=0; i--) my_destroy_function_entry(&dst->builtin_functions[ii], deallocate); + for(ii=i-1; ii>=0; ii--) my_destroy_function_entry((zend_function_entry*)(&dst->builtin_functions[ii]), deallocate); goto cleanup; } } @@ -913,7 +924,7 @@ cleanup: if(dst->refcount) deallocate(dst->refcount); #endif - if(dst->builtin_functions) deallocate(dst->builtin_functions); + if(dst->builtin_functions) deallocate((zend_function_entry*)dst->builtin_functions); if(dst->function_table.arBuckets) my_destroy_hashtable(&dst->function_table, (ht_free_fun_t) my_free_function, deallocate); if(dst->default_properties.arBuckets) my_destroy_hashtable(&dst->default_properties, (ht_free_fun_t) my_free_zval_ptr, deallocate); @@ -1089,7 +1100,15 @@ zval* apc_copy_zval(zval* dst, const zval* src, apc_malloc_t allocate, apc_free_ assert(src != NULL); if (!dst) { +#ifdef ZEND_ENGINE_2_3 + CHECK(dst = (zval*) allocate(sizeof(zval_gc_info))); + + if(allocate == apc_php_malloc) { + GC_ZVAL_INIT(dst); + } +#else CHECK(dst = (zval*) allocate(sizeof(zval))); +#endif local_dst_alloc = 1; } @@ -1712,10 +1731,10 @@ static void my_destroy_function_entry(zend_function_entry* src, apc_free_t deall { assert(src != NULL); - deallocate(src->fname); + deallocate((char*)src->fname); #ifdef ZEND_ENGINE_2 if (src->arg_info) { - my_free_arg_info_array(src->arg_info, src->num_args, deallocate); + my_free_arg_info_array((zend_arg_info*)src->arg_info, src->num_args, deallocate); } #else if (src->func_arg_types) { @@ -1756,8 +1775,8 @@ static void my_destroy_arg_info(zend_arg_info* src, apc_free_t deallocate) { assert(src != NULL); - deallocate(src->name); - deallocate(src->class_name); + deallocate((char*)src->name); + deallocate((char*)src->class_name); } /* }}} */ #endif @@ -1807,9 +1826,9 @@ static void my_destroy_class_entry(zend_class_entry* src, apc_free_t deallocate) if (src->builtin_functions) { for (i = 0; src->builtin_functions[i].fname != NULL; i++) { - my_destroy_function_entry(&src->builtin_functions[i], deallocate); + my_destroy_function_entry((zend_function_entry*)(&src->builtin_functions[i]), deallocate); } - deallocate(src->builtin_functions); + deallocate((zend_function_entry*)src->builtin_functions); } } /* }}} */ diff --git a/apc_compile.h b/apc_compile.h index 20ff076..53fbd58 100644 --- a/apc_compile.h +++ b/apc_compile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -27,7 +27,7 @@ */ -/* $Id: apc_compile.h,v 3.19 2007/03/08 22:03:35 gopalv Exp $ */ +/* $Id: apc_compile.h,v 3.19.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_COMPILE_H #define APC_COMPILE_H diff --git a/apc_debug.c b/apc_debug.c index 0f47a0a..9925aef 100644 --- a/apc_debug.c +++ b/apc_debug.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ All other licensing and usage conditions are those of the PHP Group. */ -/* $Id: apc_debug.c,v 3.6 2006/12/07 23:51:28 gopalv Exp $ */ +/* $Id: apc_debug.c,v 3.6.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc.h" #include #include "zend_compile.h" diff --git a/apc_fcntl.c b/apc_fcntl.c index 550405e..218a24c 100644 --- a/apc_fcntl.c +++ b/apc_fcntl.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_fcntl.c,v 3.25 2006/06/19 02:52:49 rasmus Exp $ */ +/* $Id: apc_fcntl.c,v 3.25.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_fcntl.h" #include "apc.h" diff --git a/apc_fcntl.h b/apc_fcntl.h index 1f71a46..1879adc 100644 --- a/apc_fcntl.h +++ b/apc_fcntl.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_fcntl.h,v 3.14 2006/05/31 22:24:48 rasmus Exp $ */ +/* $Id: apc_fcntl.h,v 3.14.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_FCNTL_H #define APC_FCNTL_H diff --git a/apc_fcntl_win32.c b/apc_fcntl_win32.c index b3822d0..916b823 100644 --- a/apc_fcntl_win32.c +++ b/apc_fcntl_win32.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_fcntl_win32.c,v 3.6 2006/03/12 00:31:45 rasmus Exp $ */ +/* $Id: apc_fcntl_win32.c,v 3.6.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_fcntl.h" #include "apc.h" diff --git a/apc_futex.c b/apc_futex.c index 89069ff..61ccc76 100644 --- a/apc_futex.c +++ b/apc_futex.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_futex.c,v 3.2 2006/10/12 08:23:16 shire Exp $ */ +/* $Id: apc_futex.c,v 3.2.2.1 2008/05/11 18:57:00 rasmus Exp $ */ /*************************************************************************** * Futex (Fast Userspace Mutex) support for APC diff --git a/apc_futex.h b/apc_futex.h index 3fca50f..5b99501 100644 --- a/apc_futex.h +++ b/apc_futex.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_futex.h,v 3.2 2006/10/12 08:23:16 shire Exp $ */ +/* $Id: apc_futex.h,v 3.2.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_FUTEX_H #define APC_FUTEX_H diff --git a/apc_globals.h b/apc_globals.h index 1a5e938..3908158 100644 --- a/apc_globals.h +++ b/apc_globals.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -29,12 +29,12 @@ */ -/* $Id: apc_globals.h,v 3.70.2.5 2008/03/28 19:41:23 rasmus Exp $ */ +/* $Id: apc_globals.h,v 3.70.2.8 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_GLOBALS_H #define APC_GLOBALS_H -#define APC_VERSION "3.0.18" +#define APC_VERSION "3.0.19" #include "apc_cache.h" #include "apc_stack.h" @@ -88,7 +88,6 @@ ZEND_BEGIN_MODULE_GLOBALS(apc) zval *filehits; /* Files that came from the cache for this request */ #endif zend_bool coredump_unmap; /* Trap signals that coredump and unmap shared memory */ - apc_cache_t *current_cache; /* current cache being modified/read */ ZEND_END_MODULE_GLOBALS(apc) /* (the following declaration is defined in php_apc.c) */ diff --git a/apc_lock.h b/apc_lock.h index 089e1cb..1472714 100644 --- a/apc_lock.h +++ b/apc_lock.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_lock.h,v 3.20 2007/01/29 07:39:02 shire Exp $ */ +/* $Id: apc_lock.h,v 3.20.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_LOCK #define APC_LOCK diff --git a/apc_main.c b/apc_main.c index 3cfb279..3825399 100644 --- a/apc_main.c +++ b/apc_main.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -28,7 +28,7 @@ */ -/* $Id: apc_main.c,v 3.103.2.2 2008/03/28 18:35:40 gopalv Exp $ */ +/* $Id: apc_main.c,v 3.103.2.7 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_php.h" #include "apc_main.h" @@ -279,7 +279,9 @@ default_compile: apc_cache_release(apc_cache, cache_entry); /* cannot free up cache data yet, it maybe in use */ - + + zend_llist_del_element(&CG(open_files), h, compare_file_handles); /* We leak fds without this hack */ + h->type = ZEND_HANDLE_FILENAME; return NULL; @@ -345,12 +347,13 @@ static zend_op_array* my_compile_file(zend_file_handle* h, if (cache_entry != NULL) { int dummy = 1; - int reset_opened_path = 0; if (h->opened_path == NULL) { - h->opened_path = cache_entry->data.file.filename; - reset_opened_path = 1; + h->opened_path = estrdup(cache_entry->data.file.filename); } zend_hash_add(&EG(included_files), h->opened_path, strlen(h->opened_path)+1, (void *)&dummy, sizeof(int), NULL); + + zend_llist_add_element(&CG(open_files), h); /* We leak fds without this hack */ + apc_stack_push(APCG(cache_stack), cache_entry); op_array = cached_compile(h, type TSRMLS_CC); if(op_array) { @@ -363,9 +366,6 @@ static zend_op_array* my_compile_file(zend_file_handle* h, if(APCG(report_autofilter)) { apc_wprint("Recompiling %s", h->opened_path); } - if (reset_opened_path == 1) { - h->opened_path = NULL; - } /* TODO: check what happens with EG(included_files) */ } @@ -430,10 +430,10 @@ static zend_op_array* my_compile_file(zend_file_handle* h, mem_size = 0; APCG(mem_size_ptr) = &mem_size; - APCG(current_cache) = apc_cache; if(!(alloc_op_array = apc_copy_op_array(NULL, op_array, apc_sma_malloc, apc_sma_free TSRMLS_CC))) { + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; #if NONBLOCKING_LOCK_AVAILABLE if(APCG(write_lock)) { apc_cache_write_unlock(apc_cache); @@ -445,8 +445,9 @@ static zend_op_array* my_compile_file(zend_file_handle* h, if(!(alloc_functions = apc_copy_new_functions(num_functions, apc_sma_malloc, apc_sma_free TSRMLS_CC))) { apc_free_op_array(alloc_op_array, apc_sma_free); + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; #if NONBLOCKING_LOCK_AVAILABLE if(APCG(write_lock)) { apc_cache_write_unlock(apc_cache); @@ -458,8 +459,9 @@ static zend_op_array* my_compile_file(zend_file_handle* h, if(!(alloc_classes = apc_copy_new_classes(op_array, num_classes, apc_sma_malloc, apc_sma_free TSRMLS_CC))) { apc_free_op_array(alloc_op_array, apc_sma_free); apc_free_functions(alloc_functions, apc_sma_free); + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; #if NONBLOCKING_LOCK_AVAILABLE if(APCG(write_lock)) { apc_cache_write_unlock(apc_cache); @@ -480,8 +482,9 @@ static zend_op_array* my_compile_file(zend_file_handle* h, apc_free_op_array(alloc_op_array, apc_sma_free); apc_free_functions(alloc_functions, apc_sma_free); apc_free_classes(alloc_classes, apc_sma_free); + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; #if NONBLOCKING_LOCK_AVAILABLE if(APCG(write_lock)) { apc_cache_write_unlock(apc_cache); @@ -495,10 +498,12 @@ static zend_op_array* my_compile_file(zend_file_handle* h, if ((ret = apc_cache_insert(apc_cache, key, cache_entry, t)) != 1) { apc_cache_free_entry(cache_entry); + if(ret==-1) { + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); + } } - APCG(current_cache) = NULL; - #if NONBLOCKING_LOCK_AVAILABLE if(APCG(write_lock)) { apc_cache_write_unlock(apc_cache); diff --git a/apc_main.h b/apc_main.h index 2a32e44..3d8d435 100644 --- a/apc_main.h +++ b/apc_main.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -29,7 +29,7 @@ */ -/* $Id: apc_main.h,v 3.9.2.1 2008/03/25 18:04:53 gopalv Exp $ */ +/* $Id: apc_main.h,v 3.9.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_MAIN_H #define APC_MAIN_H diff --git a/apc_mmap.c b/apc_mmap.c index 74d793f..f29de88 100644 --- a/apc_mmap.c +++ b/apc_mmap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_mmap.c,v 3.7.2.1 2008/03/25 21:00:22 rasmus Exp $ */ +/* $Id: apc_mmap.c,v 3.7.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc.h" diff --git a/apc_php.h b/apc_php.h index fa1e4d4..1263525 100644 --- a/apc_php.h +++ b/apc_php.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -29,7 +29,7 @@ */ -/* $Id: apc_php.h,v 3.10 2006/11/16 20:24:48 gopalv Exp $ */ +/* $Id: apc_php.h,v 3.10.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_PHP_H #define APC_PHP_H @@ -47,6 +47,9 @@ #include "zend_hash.h" #include "zend_extensions.h" +#if ZEND_MODULE_API_NO > 20060613 +#define ZEND_ENGINE_2_3 +#endif #if ZEND_MODULE_API_NO > 20050922 #define ZEND_ENGINE_2_2 #endif diff --git a/apc_pthreadmutex.c b/apc_pthreadmutex.c index e3b2c26..f6b8c77 100644 --- a/apc_pthreadmutex.c +++ b/apc_pthreadmutex.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_pthreadmutex.c,v 3.3 2007/12/21 01:36:51 shire Exp $ */ +/* $Id: apc_pthreadmutex.c,v 3.3.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_pthreadmutex.h" diff --git a/apc_pthreadmutex.h b/apc_pthreadmutex.h index 286d303..57e189a 100644 --- a/apc_pthreadmutex.h +++ b/apc_pthreadmutex.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_pthreadmutex.h,v 3.3 2007/01/28 07:53:57 shire Exp $ */ +/* $Id: apc_pthreadmutex.h,v 3.3.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_PTHREADMUTEX_H #define APC_PTHREADMUTEX_H diff --git a/apc_rfc1867.c b/apc_rfc1867.c index af01870..466f700 100644 --- a/apc_rfc1867.c +++ b/apc_rfc1867.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_rfc1867.c,v 3.12 2007/10/18 20:37:20 rasmus Exp $*/ +/* $Id: apc_rfc1867.c,v 3.12.2.1 2008/05/11 18:57:00 rasmus Exp $*/ #include "apc.h" #include "apc_globals.h" diff --git a/apc_sem.c b/apc_sem.c index 5dada09..e76ca20 100644 --- a/apc_sem.c +++ b/apc_sem.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_sem.c,v 3.16 2006/03/12 00:31:45 rasmus Exp $ */ +/* $Id: apc_sem.c,v 3.16.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_sem.h" #include "apc.h" diff --git a/apc_sem.h b/apc_sem.h index c5dcb03..c366b6f 100644 --- a/apc_sem.h +++ b/apc_sem.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_sem.h,v 3.6 2006/03/12 00:31:45 rasmus Exp $ */ +/* $Id: apc_sem.h,v 3.6.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_SEM_H #define APC_SEM_H diff --git a/apc_shm.c b/apc_shm.c index c94eb1e..a6a27c5 100644 --- a/apc_shm.c +++ b/apc_shm.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_shm.c,v 3.11.2.1 2008/03/25 21:00:22 rasmus Exp $ */ +/* $Id: apc_shm.c,v 3.11.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_shm.h" #include "apc.h" diff --git a/apc_shm.h b/apc_shm.h index 81f8053..bb34af9 100644 --- a/apc_shm.h +++ b/apc_shm.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_shm.h,v 3.8 2007/05/23 01:23:21 auroraeosrose Exp $ */ +/* $Id: apc_shm.h,v 3.8.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_SHM_H #define APC_SHM_H diff --git a/apc_signal.c b/apc_signal.c index 32627a3..7db2ef9 100644 --- a/apc_signal.c +++ b/apc_signal.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -24,7 +24,7 @@ All other licensing and usage conditions are those of the PHP Group. */ - /* $Id: apc_signal.c,v 1.2.2.2 2008/03/25 18:24:57 gopalv Exp $ */ + /* $Id: apc_signal.c,v 1.2.2.3 2008/05/11 18:57:00 rasmus Exp $ */ /* Allows apc to install signal handlers and maintain signalling to already registered handlers. Registers all signals that diff --git a/apc_signal.h b/apc_signal.h index 7494702..46d65be 100644 --- a/apc_signal.h +++ b/apc_signal.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_signal.h,v 1.1.2.1 2008/03/25 18:24:57 gopalv Exp $ */ +/* $Id: apc_signal.h,v 1.1.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_SIGNAL_H #define APC_SIGNAL_H diff --git a/apc_sma.c b/apc_sma.c index 0ba8be8..b8f61aa 100644 --- a/apc_sma.c +++ b/apc_sma.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_sma.c,v 1.69.2.2 2008/03/28 20:17:47 rasmus Exp $ */ +/* $Id: apc_sma.c,v 1.69.2.4 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_sma.h" #include "apc.h" @@ -409,7 +409,6 @@ void* apc_sma_malloc(size_t n) { size_t off; int i; - size_t *orig_mem_size_ptr; TSRMLS_FETCH(); assert(sma_initialized); diff --git a/apc_sma.h b/apc_sma.h index e0ba5f4..2f20b1f 100644 --- a/apc_sma.h +++ b/apc_sma.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_sma.h,v 1.18.2.1 2008/03/25 18:04:53 gopalv Exp $ */ +/* $Id: apc_sma.h,v 1.18.2.2 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_SMA_H #define APC_SMA_H diff --git a/apc_spin.c b/apc_spin.c index 3ce65eb..bbeb0c6 100644 --- a/apc_spin.c +++ b/apc_spin.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2007 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_spin.c,v 3.1 2007/01/29 07:39:02 shire Exp $ */ +/* $Id: apc_spin.c,v 3.1.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_spin.h" diff --git a/apc_spin.h b/apc_spin.h index 46163d6..bb0bd14 100644 --- a/apc_spin.h +++ b/apc_spin.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2007 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ */ -/* $Id: apc_spin.h,v 3.1 2007/01/29 07:39:02 shire Exp $ */ +/* $Id: apc_spin.h,v 3.1.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_SPIN_H #define APC_SPIN_H diff --git a/apc_stack.c b/apc_stack.c index c5f7865..a9d298b 100644 --- a/apc_stack.c +++ b/apc_stack.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_stack.c,v 3.4 2006/03/12 00:31:45 rasmus Exp $ */ +/* $Id: apc_stack.c,v 3.4.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_stack.h" #include "apc.h" diff --git a/apc_stack.h b/apc_stack.h index 8d2a5d2..91a6c01 100644 --- a/apc_stack.h +++ b/apc_stack.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: apc_stack.h,v 3.4 2006/03/12 00:31:45 rasmus Exp $ */ +/* $Id: apc_stack.h,v 3.4.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_STACK_H #define APC_STACK_H diff --git a/apc_zend.c b/apc_zend.c index 6cd21be..5d944f1 100644 --- a/apc_zend.c +++ b/apc_zend.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_zend.c,v 3.14 2007/04/02 22:57:10 rasmus Exp $ */ +/* $Id: apc_zend.c,v 3.14.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_zend.h" #include "apc_globals.h" diff --git a/apc_zend.h b/apc_zend.h index 5045d77..daebb52 100644 --- a/apc_zend.h +++ b/apc_zend.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -25,7 +25,7 @@ */ -/* $Id: apc_zend.h,v 3.8 2006/09/01 21:59:16 pollita Exp $ */ +/* $Id: apc_zend.h,v 3.8.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef APC_ZEND_H #define APC_ZEND_H diff --git a/debian/changelog b/debian/changelog index ad97268..d40b4f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +php5-apc (3.0.19-1) stable; urgency=low + + * New PHP5 APC - version 3.0.19, using PHP5 5.2.0-8+etch11, + 20060613+lfs. + + -- Dragan Dosen Tue, 2 Sep 2008 22:00:57 +0200 + php5-apc (3.0.18-1) stable; urgency=low * New PHP5 APC - version 3.0.18, using PHP5 5.2.0-8+etch10, diff --git a/pgsql_s_lock.c b/pgsql_s_lock.c index 4b8b40a..cfcd036 100644 --- a/pgsql_s_lock.c +++ b/pgsql_s_lock.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2007 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -19,7 +19,7 @@ */ -/* $Id: pgsql_s_lock.c,v 3.2 2007/02/25 05:19:11 shire Exp $ */ +/* $Id: pgsql_s_lock.c,v 3.2.2.1 2008/05/11 18:57:00 rasmus Exp $ */ /*------------------------------------------------------------------------- * diff --git a/pgsql_s_lock.h b/pgsql_s_lock.h index 6ee13c9..63162a3 100644 --- a/pgsql_s_lock.h +++ b/pgsql_s_lock.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2007 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -19,7 +19,7 @@ */ -/* $Id: pgsql_s_lock.h,v 3.3 2007/02/16 21:28:04 shire Exp $ */ +/* $Id: pgsql_s_lock.h,v 3.3.2.1 2008/05/11 18:57:00 rasmus Exp $ */ /*------------------------------------------------------------------------- * diff --git a/php_apc.c b/php_apc.c index ab20091..207016d 100644 --- a/php_apc.c +++ b/php_apc.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: php_apc.c,v 3.154.2.2 2008/03/28 18:35:41 gopalv Exp $ */ +/* $Id: php_apc.c,v 3.154.2.5 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_zend.h" #include "apc_cache.h" @@ -226,7 +226,7 @@ static PHP_MINFO_FUNCTION(apc) #else php_info_print_table_row(2, "Locking type", "File Locks"); #endif - php_info_print_table_row(2, "Revision", "$Revision: 3.154.2.2 $"); + php_info_print_table_row(2, "Revision", "$Revision: 3.154.2.5 $"); php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -559,18 +559,18 @@ int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int HANDLE_BLOCK_INTERRUPTIONS(); APCG(mem_size_ptr) = &mem_size; - APCG(current_cache) = apc_user_cache; if (!(entry = apc_cache_make_user_entry(strkey, strkey_len + 1, val, ttl))) { APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); HANDLE_UNBLOCK_INTERRUPTIONS(); return 0; } if (!apc_cache_make_user_key(&key, strkey, strkey_len + 1, t)) { APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; apc_cache_free_entry(entry); + /* make_user_key doesn't allocate anything, so no expunge */ HANDLE_UNBLOCK_INTERRUPTIONS(); return 0; } @@ -578,13 +578,16 @@ int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int if (!apc_cache_user_insert(apc_user_cache, key, entry, t, exclusive TSRMLS_CC)) { apc_cache_free_entry(entry); APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; + /* + No expunge here - user_insert can fail for non-memory related reasons + The alloc-based expunge hook in 3.1 will do a better job here + (removing the expunge here also fixes bug #13336) + */ HANDLE_UNBLOCK_INTERRUPTIONS(); return 0; } APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; HANDLE_UNBLOCK_INTERRUPTIONS(); diff --git a/php_apc.h b/php_apc.h index 780e46e..8eb6861 100644 --- a/php_apc.h +++ b/php_apc.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -27,7 +27,7 @@ */ -/* $Id: php_apc.h,v 3.14 2006/03/12 00:31:45 rasmus Exp $ */ +/* $Id: php_apc.h,v 3.14.2.1 2008/05/11 18:57:00 rasmus Exp $ */ #ifndef PHP_APC_H #define PHP_APC_H diff --git a/tests/apc_003.phpt b/tests/apc_003.phpt index 4f5b5ff..8f4876e 100644 --- a/tests/apc_003.phpt +++ b/tests/apc_003.phpt @@ -11,13 +11,13 @@ apc.file_update_protection=0 class foo { } $foo = new foo; -var_dump($foo); +print_r($foo); apc_store('foo',$foo); unset($foo); $bar = apc_fetch('foo'); -var_dump($bar); +print_r($bar); $bar->a = true; -var_dump($bar); +print_r($bar); class bar extends foo { @@ -48,65 +48,52 @@ class baz extends bar } $baz = new baz; -var_dump($baz); +print_r($baz); $baz->change(); -var_dump($baz); +print_r($baz); apc_store('baz', $baz); unset($baz); -var_dump(apc_fetch('baz')); +print_r(apc_fetch('baz')); ?> ===DONE=== --EXPECTF-- -object(foo)#%d (0) { -} -object(foo)#%d (0) { -} -object(foo)#%d (1) { - ["a"]=> - bool(true) -} -object(baz)#%d (6) { - ["pri:private"]=> - string(3) "baz" - ["pub"]=> - string(3) "bar" - ["pro:protected"]=> - string(3) "bar" - ["pri:private"]=> - string(3) "bar" - ["bar"]=> - bool(true) - ["baz"]=> - bool(true) -} -object(baz)#%d (6) { - ["pri:private"]=> - string(3) "baz" - ["pub"]=> - string(3) "bar" - ["pro:protected"]=> - string(3) "bar" - ["pri:private"]=> - string(3) "mod" - ["bar"]=> - bool(true) - ["baz"]=> - bool(true) -} -object(baz)#%d (6) { - ["pri:private"]=> - string(3) "baz" - ["pub"]=> - string(3) "bar" - ["pro:protected"]=> - string(3) "bar" - ["pri:private"]=> - string(3) "mod" - ["bar"]=> - bool(true) - ["baz"]=> - bool(true) -} +foo Object +( +) +foo Object +( +) +foo Object +( + [a] => 1 +) +baz Object +( + [pri%sprivate] => baz + [pub] => bar + [pro:protected] => bar + [pri%sprivate] => bar + [bar] => 1 + [baz] => 1 +) +baz Object +( + [pri%sprivate] => baz + [pub] => bar + [pro:protected] => bar + [pri%sprivate] => mod + [bar] => 1 + [baz] => 1 +) +baz Object +( + [pri%sprivate] => baz + [pub] => bar + [pro:protected] => bar + [pri%sprivate] => mod + [bar] => 1 + [baz] => 1 +) ===DONE=== -- 1.7.10.4