---- /dev/null
-+++ b/ext/apc/apc_bin.c
+diff -Naur a/ext/apc/apc_bin.c b/ext/apc/apc_bin.c
+--- a/ext/apc/apc_bin.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_bin.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,987 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_bin.c 303383 2010-09-15 08:15:58Z dmitry $ */
++/* $Id: apc_bin.c 324017 2012-03-08 09:46:22Z pajoye $ */
+
+/* Creates a binary architecture specific output to a string or file containing
+ * the current cache contents for both fies and user variables. This is accomplished
+#include "apc_globals.h"
+#include "apc_bin.h"
+#include "apc_zend.h"
++#include "apc_php.h"
+#include "apc_sma.h"
+#include "apc_pool.h"
+#include "ext/standard/md5.h"
+ printf("%x in %s on line %d", ptr, __FILE__, __LINE__); \
+ } else if((long)ptr > bd->size) { /* not swizzled */ \
+ apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (long)bd, ptr, ((long)bd + bd->size), __FILE__, __LINE__); \
++ return; \
+ } \
+ printf("\n"); \
+ } while(0);
+ ptr = (void*)((long)(ptr) - (long)(bd)); \
+ } else if((ulong)ptr > bd->size) { /* not swizzled */ \
+ apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (long)bd, ptr, ((long)bd + bd->size), __FILE__, __LINE__); \
++ return NULL; \
+ } \
+ } while(0);
+
+ size_t *size;
+ if(zend_hash_index_find(&APCG(apc_bd_alloc_list), (ulong)ptr, (void**)&size) == FAILURE) {
+ apc_error("apc_bd_free could not free pointer (not found in list: %x)" TSRMLS_CC, ptr);
++ return;
+ }
+ APCG(apc_bd_alloc_ptr) = (void*)((size_t)APCG(apc_bd_alloc_ptr) - *size);
+ zend_hash_index_del(&APCG(apc_bd_alloc_list), (ulong)ptr);
+#endif
+ if(APCG(apc_bd_alloc_ptr) > APCG(apc_bd_alloc_ubptr)) {
+ apc_error("Exceeded bounds check in apc_bd_alloc_ex by %d bytes." TSRMLS_CC, (unsigned char *) APCG(apc_bd_alloc_ptr) - (unsigned char *) APCG(apc_bd_alloc_ubptr));
++ return NULL;
+ }
+ zend_hash_index_update(&APCG(apc_bd_alloc_list), (ulong)rval, &size, sizeof(size_t), NULL);
+ }
+#endif
+ } else if((ulong)ptr > bd->size) {
+ apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (long)bd, *ptr, ((long)bd + bd->size), file, line); \
++ return;
+ }
+ }
+} /* }}} */
+ apc_swizzle_hashtable(bd, ll, &ce->function_table, (apc_swizzle_cb_t)apc_swizzle_function, 0 TSRMLS_CC);
+#ifdef ZEND_ENGINE_2_4
+ if (ce->default_properties_table) {
-+ int i;
-+
+ for (i = 0; i < ce->default_properties_count; i++) {
+ if (ce->default_properties_table[i]) {
+ apc_swizzle_ptr(bd, ll, &ce->default_properties_table[i]);
+
+#ifdef ZEND_ENGINE_2_4
+ if (ce->default_static_members_table) {
-+ int i;
-+
+ for (i = 0; i < ce->default_static_members_count; i++) {
+ if (ce->default_static_members_table[i]) {
+ apc_swizzle_ptr(bd, ll, &ce->default_static_members_table[i]);
+ zend_hash_index_update(&APCG(copied_zvals), (ulong)zv, (void**)&zv, sizeof(zval*), NULL);
+ }
+
-+ switch(zv->type & ~IS_CONSTANT_INDEX) {
++ switch(zv->type & IS_CONSTANT_TYPE_MASK) {
+ case IS_NULL:
+ case IS_LONG:
+ case IS_DOUBLE:
+ PHP_MD5Final(digest, &context);
+ if(memcmp(md5_orig, digest, 16)) {
+ apc_error("MD5 checksum of binary dump failed." TSRMLS_CC);
-+ memcpy(bd->md5, md5_orig, 16); /* add back md5 checksum */
+ return -1;
+ }
+ }
+ }
+ if(crc_orig != crc) {
+ apc_error("CRC32 checksum of binary dump failed." TSRMLS_CC);
-+ bd->crc = crc_orig;
+ return -1;
+ }
+ }
+ * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_bin.h
+diff -Naur a/ext/apc/apc_bin.h b/ext/apc/apc_bin.h
+--- a/ext/apc/apc_bin.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_bin.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,63 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_bin.h 300979 2010-07-04 10:15:05Z kalle $ */
++/* $Id: apc_bin.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_BINDUMP_H
+#define APC_BINDUMP_H
+ * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc.c
-@@ -0,0 +1,636 @@
+diff -Naur a/ext/apc/apc.c b/ext/apc/apc.c
+--- a/ext/apc/apc.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,670 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc.c 305003 2010-10-31 19:45:10Z gopalv $ */
++/* $Id: apc.c 326710 2012-07-19 20:51:04Z rasmus $ */
+
+#include "apc.h"
+#include "apc_zend.h"
+#include "apc_cache.h"
++#include "apc_globals.h"
+#include "php.h"
+
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+ void* p = malloc(n);
+ if (p == NULL) {
+ apc_error("apc_emalloc: malloc failed to allocate %u bytes:" TSRMLS_CC, n);
++ return NULL;
+ }
+ return p;
+}
+
+void* apc_erealloc(void* p, size_t n TSRMLS_DC)
+{
-+ p = realloc(p, n);
-+ if (p == NULL) {
++ void *new;
++ new = realloc(p, n);
++ if (new == NULL) {
+ apc_error("apc_erealloc: realloc failed to allocate %u bytes:" TSRMLS_CC, n);
++ return NULL;
+ }
-+ return p;
++ return new;
+}
+
+void apc_efree(void* p TSRMLS_DC)
+{
+ if (p == NULL) {
+ apc_error("apc_efree: attempt to free null pointer" TSRMLS_CC);
++ return;
+ }
+ free(p);
+}
+
-+char* apc_estrdup(const char* s TSRMLS_DC)
++char* APC_ALLOC apc_estrdup(const char* s TSRMLS_DC)
+{
+ int len;
+ char* dup;
+ dup = (char*) malloc(len+1);
+ if (dup == NULL) {
+ apc_error("apc_estrdup: malloc failed to allocate %u bytes:" TSRMLS_CC, len+1);
++ return NULL;
+ }
+ memcpy(dup, s, len);
+ dup[len] = '\0';
+ return dup;
+}
+
-+void* apc_xstrdup(const char* s, apc_malloc_t f TSRMLS_DC)
++void* APC_ALLOC apc_xstrdup(const char* s, apc_malloc_t f TSRMLS_DC)
+{
+ return s != NULL ? apc_xmemcpy(s, strlen(s)+1, f TSRMLS_CC) : NULL;
+}
+
-+void* apc_xmemcpy(const void* p, size_t n, apc_malloc_t f TSRMLS_DC)
++void* APC_ALLOC apc_xmemcpy(const void* p, size_t n, apc_malloc_t f TSRMLS_DC)
+{
+ void* q;
+
+ (filename[1] == '.' && \
+ IS_SLASH(filename[2])))))
+
++/* {{{ stupid stringifcation */
++#if DEFAULT_SLASH == '/'
++ #define DEFAULT_SLASH_STRING "/"
++#elif DEFAULT_SLASH == '\\'
++ #define DEFAULT_SLASH_STRING "\\"
++#else
++ #error "Unknown value for DEFAULT_SLASH"
++#endif
++/* }}} */
+
+int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo TSRMLS_DC)
+{
+ break;
+ }
+ }
++ /* in cli mode PHP explicitly checks the cwd, so we should as well */
++ if(APCG(enable_cli) && !strcmp(sapi_module.name, "cli")) {
++ snprintf(fileinfo->path_buf, sizeof(fileinfo->path_buf), ".%c%s", DEFAULT_SLASH, path_for_open);
++ if (APC_URL_STAT(wrapper, fileinfo->path_buf, &fileinfo->st_buf) == 0) {
++ fileinfo->fullpath = (char*) fileinfo->path_buf;
++ found = 1;
++ }
++ }
++ } else {
++ /* read cwd and try to fake up fullpath */
++ fileinfo->path_buf[0] = '\0';
++ if(VCWD_GETCWD(fileinfo->path_buf, sizeof(fileinfo->path_buf))) {
++ strlcat(fileinfo->path_buf, DEFAULT_SLASH_STRING, sizeof(fileinfo->path_buf));
++ strlcat(fileinfo->path_buf, path_for_open, sizeof(fileinfo->path_buf));
++ if (APC_URL_STAT(wrapper, fileinfo->path_buf, &fileinfo->st_buf) == 0) {
++ fileinfo->fullpath = (char*) fileinfo->path_buf;
++ return apc_restat(fileinfo TSRMLS_CC);
++ }
++ }
+ }
+
+ /* check in path of the calling scripts' current working directory */
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_cache.c
-@@ -0,0 +1,1295 @@
+diff -Naur a/ext/apc/apc_cache.c b/ext/apc/apc_cache.c
+--- a/ext/apc/apc_cache.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_cache.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,1383 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_cache.c 305771 2010-11-26 12:57:16Z gopalv $ */
++/* $Id: apc_cache.c 325482 2012-05-01 00:09:36Z rasmus $ */
+
+#include "apc_cache.h"
+#include "apc_zend.h"
+#include "apc_sma.h"
+#include "apc_globals.h"
+#include "SAPI.h"
++#include "TSRM.h"
++#include "ext/standard/md5.h"
+
+/* TODO: rehash when load factor exceeds threshold */
+
+static void apc_cache_expunge(apc_cache_t* cache, size_t size TSRMLS_DC);
+
+/* {{{ hash */
-+static unsigned int hash(apc_cache_key_t key)
++static unsigned long hash(apc_cache_key_t key)
+{
-+ return (unsigned int)(key.data.file.device + key.data.file.inode);
++ return (unsigned long)(key.data.file.device + key.data.file.inode);
+}
+/* }}} */
+
+/* {{{ string_nhash_8 */
-+#define string_nhash_8(s,len) (unsigned int)(zend_inline_hash_func(s, len))
++#define string_nhash_8(s,len) (unsigned long)(zend_inline_hash_func((s), len))
++/* }}} */
++
++/* {{{ murmurhash */
++#if 0
++static inline unsigned long murmurhash(const char *skey, size_t keylen)
++{
++ const long m = 0x7fd652ad;
++ const long r = 16;
++ unsigned int h = 0xdeadbeef;
++
++ while(keylen >= 4)
++ {
++ h += *(unsigned int*)skey;
++ h *= m;
++ h ^= h >> r;
++
++ skey += 4;
++ keylen -= 4;
++ }
++
++ switch(keylen)
++ {
++ case 3:
++ h += skey[2] << 16;
++ case 2:
++ h += skey[1] << 8;
++ case 1:
++ h += skey[0];
++ h *= m;
++ h ^= h >> r;
++ };
++
++ h *= m;
++ h ^= h >> 10;
++ h *= m;
++ h ^= h >> 17;
++
++ return h;
++}
++#endif
+/* }}} */
+
++
+/* {{{ make_prime */
+static int const primes[] = {
+ 257, /* 256 */
+ 8209, /* 8192 */
+ 9221, /* 9216 */
+10243, /* 10240 */
-+#if 0
+11273, /* 11264 */
+12289, /* 12288 */
+13313, /* 13312 */
+17417, /* 17408 */
+18433, /* 18432 */
+19457, /* 19456 */
-+#endif
+0 /* sentinel */
+};
+
+/* }}} */
+
+/* {{{ make_slot */
-+slot_t* make_slot(apc_cache_key_t key, apc_cache_entry_t* value, slot_t* next, time_t t TSRMLS_DC)
++slot_t* make_slot(apc_cache_key_t *key, apc_cache_entry_t* value, slot_t* next, time_t t TSRMLS_DC)
+{
+ slot_t* p = apc_pool_alloc(value->pool, sizeof(slot_t));
+
+ if (!p) return NULL;
+
-+ if(value->type == APC_CACHE_ENTRY_USER) {
-+ char *identifier = (char*) apc_pmemcpy(key.data.user.identifier, key.data.user.identifier_len, value->pool TSRMLS_CC);
++ if(key->type == APC_CACHE_KEY_USER) {
++ char *identifier = (char*) apc_pmemcpy(key->data.user.identifier, key->data.user.identifier_len, value->pool TSRMLS_CC);
+ if (!identifier) {
+ return NULL;
+ }
-+ key.data.user.identifier = identifier;
-+ } else if(key.type == APC_CACHE_KEY_FPFILE) {
-+ char *fullpath = (char*) apc_pstrdup(key.data.fpfile.fullpath, value->pool TSRMLS_CC);
++ key->data.user.identifier = identifier;
++ } else if(key->type == APC_CACHE_KEY_FPFILE) {
++ char *fullpath = (char*) apc_pstrdup(key->data.fpfile.fullpath, value->pool TSRMLS_CC);
+ if (!fullpath) {
+ return NULL;
+ }
-+ key.data.fpfile.fullpath = fullpath;
++ key->data.fpfile.fullpath = fullpath;
+ }
-+ p->key = key;
++ p->key = key[0];
+ p->value = value;
+ p->next = next;
+ p->num_hits = 0;
+ *slot = (*slot)->next;
+
+ cache->header->mem_size -= dead->value->mem_size;
-+ cache->header->num_entries--;
++ CACHE_FAST_DEC(cache, cache->header->num_entries);
+ if (dead->value->ref_count <= 0) {
+ free_slot(dead TSRMLS_CC);
+ }
+ if (dead->value->ref_count > 0) {
+ switch(dead->value->type) {
+ case APC_CACHE_ENTRY_FILE:
-+ apc_warning("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" TSRMLS_CC,
++ apc_debug("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" TSRMLS_CC,
+ dead->value->data.file.filename, dead->key.data.file.device, dead->key.data.file.inode, gc_sec);
+ break;
+ case APC_CACHE_ENTRY_USER:
-+ apc_warning("GC cache entry '%s'was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec);
++ apc_debug("GC cache entry '%s' was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec);
+ break;
+ }
+ }
+ cache->shmaddr = apc_sma_malloc(cache_size TSRMLS_CC);
+ if(!cache->shmaddr) {
+ apc_error("Unable to allocate shared memory for cache structures. (Perhaps your shared memory size isn't large enough?). " TSRMLS_CC);
++ return NULL;
+ }
+ memset(cache->shmaddr, 0, cache_size);
+
+void apc_cache_destroy(apc_cache_t* cache TSRMLS_DC)
+{
+ DESTROY_LOCK(cache->header->lock);
-+#ifdef NONBLOCKING_LOCK_AVAILABLE
++#if NONBLOCKING_LOCK_AVAILABLE
+ DESTROY_LOCK(cache->header->wrlock);
+#endif
+ apc_efree(cache TSRMLS_CC);
+ * we run out of space.
+ */
+ CACHE_SAFE_LOCK(cache);
++ process_pending_removals(cache TSRMLS_CC);
+ if (apc_sma_get_avail_mem() > (size_t)(APCG(shm_size)/2)) {
+ /* probably a queued up expunge, we don't need to do this */
+ CACHE_SAFE_UNLOCK(cache);
+ return;
+ }
+ cache->header->busy = 1;
-+ cache->header->expunges++;
++ CACHE_FAST_INC(cache, cache->header->expunges);
+clear_all:
+ for (i = 0; i < cache->num_slots; i++) {
+ slot_t* p = cache->slots[i];
+ */
+
+ CACHE_SAFE_LOCK(cache);
++ process_pending_removals(cache TSRMLS_CC);
+ if (apc_sma_get_avail_mem() > (size_t)(APCG(shm_size)/2)) {
+ /* probably a queued up expunge, we don't need to do this */
+ CACHE_SAFE_UNLOCK(cache);
+ return;
+ }
+ cache->header->busy = 1;
-+ cache->header->expunges++;
++ CACHE_FAST_INC(cache, cache->header->expunges);
+ for (i = 0; i < cache->num_slots; i++) {
+ p = &cache->slots[i];
+ while(*p) {
+
+ process_pending_removals(cache TSRMLS_CC);
+
-+ if(key.type == APC_CACHE_KEY_FILE) slot = &cache->slots[hash(key) % cache->num_slots];
-+ else slot = &cache->slots[string_nhash_8(key.data.fpfile.fullpath, key.data.fpfile.fullpath_len) % cache->num_slots];
++ slot = &cache->slots[key.h % cache->num_slots];
+
+ while(*slot) {
+ if(key.type == (*slot)->key.type) {
+ continue;
+ }
+ } else { /* APC_CACHE_KEY_FPFILE */
-+ if(!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) {
++ if((key.h == (*slot)->key.h) &&
++ !memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) {
+ /* Hrm.. it's already here, remove it and insert new one */
+ remove_slot(cache, slot TSRMLS_CC);
+ break;
+ slot = &(*slot)->next;
+ }
+
-+ if ((*slot = make_slot(key, value, *slot, t TSRMLS_CC)) == NULL) {
++ if ((*slot = make_slot(&key, value, *slot, t TSRMLS_CC)) == NULL) {
+ return -1;
+ }
+
+ value->mem_size = ctxt->pool->size;
+ cache->header->mem_size += ctxt->pool->size;
-+ cache->header->num_entries++;
-+ cache->header->num_inserts++;
++ CACHE_FAST_INC(cache, cache->header->num_entries);
++ CACHE_FAST_INC(cache, cache->header->num_inserts);
+
+ return 1;
+}
+{
+ slot_t** slot;
+ unsigned int keylen = key.data.user.identifier_len;
-+ unsigned int h = string_nhash_8(key.data.user.identifier, keylen);
+ apc_keyid_t *lastkey = &cache->header->lastkey;
+
+ if (!value) {
+ return 0;
+ }
+
-+ if(apc_cache_is_last_key(cache, &key, h, t TSRMLS_CC)) {
++ if(apc_cache_is_last_key(cache, &key, t TSRMLS_CC)) {
+ /* potential cache slam */
-+ printf("Last key warning for it!");
+ return 0;
+ }
+
+
+ memset(lastkey, 0, sizeof(apc_keyid_t));
+
-+ lastkey->h = h;
++ lastkey->h = key.h;
+ lastkey->keylen = keylen;
+ lastkey->mtime = t;
+#ifdef ZTS
+
+ process_pending_removals(cache TSRMLS_CC);
+
-+ slot = &cache->slots[h % cache->num_slots];
++ slot = &cache->slots[key.h % cache->num_slots];
+
+ while (*slot) {
-+ if (((*slot)->key.data.user.identifier_len == key.data.user.identifier_len) &&
++ if (((*slot)->key.h == key.h) &&
+ (!memcmp((*slot)->key.data.user.identifier, key.data.user.identifier, keylen))) {
+ /*
+ * At this point we have found the user cache entry. If we are doing
+ slot = &(*slot)->next;
+ }
+
-+ if ((*slot = make_slot(key, value, *slot, t TSRMLS_CC)) == NULL) {
++ if ((*slot = make_slot(&key, value, *slot, t TSRMLS_CC)) == NULL) {
+ goto fail;
+ }
+
+ value->mem_size = ctxt->pool->size;
+ cache->header->mem_size += ctxt->pool->size;
+
-+ cache->header->num_entries++;
-+ cache->header->num_inserts++;
++ CACHE_FAST_INC(cache, cache->header->num_entries);
++ CACHE_FAST_INC(cache, cache->header->num_inserts);
+
+ CACHE_UNLOCK(cache);
+
+ slot_t** slot;
+ volatile slot_t* retval = NULL;
+
-+ CACHE_LOCK(cache);
++ CACHE_RDLOCK(cache);
+ if(key.type == APC_CACHE_KEY_FILE) slot = &cache->slots[hash(key) % cache->num_slots];
-+ else slot = &cache->slots[string_nhash_8(key.data.fpfile.fullpath, key.data.fpfile.fullpath_len) % cache->num_slots];
++ else slot = &cache->slots[key.h % cache->num_slots];
+
+ while (*slot) {
+ if(key.type == (*slot)->key.type) {
+ if(key.type == APC_CACHE_KEY_FILE) {
+ if(key_equals((*slot)->key.data.file, key.data.file)) {
+ if((*slot)->key.mtime != key.mtime) {
++ #if (USE_READ_LOCKS == 0)
++ /* this is merely a memory-friendly optimization, if we do have a write-lock
++ * might as well move this to the deleted_list right-away. Otherwise an insert
++ * of the same key wil do it (or an expunge, *eventually*).
++ */
+ remove_slot(cache, slot TSRMLS_CC);
-+ cache->header->num_misses++;
-+ CACHE_UNLOCK(cache);
++ #endif
++ CACHE_SAFE_INC(cache, cache->header->num_misses);
++ CACHE_RDUNLOCK(cache);
+ return NULL;
+ }
-+ (*slot)->num_hits++;
-+ (*slot)->value->ref_count++;
++ CACHE_SAFE_INC(cache, (*slot)->num_hits);
++ CACHE_SAFE_INC(cache, (*slot)->value->ref_count);
+ (*slot)->access_time = t;
+ prevent_garbage_collection((*slot)->value);
-+ cache->header->num_hits++;
++ CACHE_FAST_INC(cache, cache->header->num_hits);
+ retval = *slot;
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return (slot_t*)retval;
+ }
+ } else { /* APC_CACHE_KEY_FPFILE */
-+ if(!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) {
++ if(((*slot)->key.h == key.h) &&
++ !memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) {
+ /* TTL Check ? */
-+ (*slot)->num_hits++;
-+ (*slot)->value->ref_count++;
++ CACHE_SAFE_INC(cache, (*slot)->num_hits);
++ CACHE_SAFE_INC(cache, (*slot)->value->ref_count);
+ (*slot)->access_time = t;
+ prevent_garbage_collection((*slot)->value);
-+ cache->header->num_hits++;
++ CACHE_FAST_INC(cache, cache->header->num_hits);
+ retval = *slot;
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return (slot_t*)retval;
+ }
+ }
+ }
+ slot = &(*slot)->next;
+ }
-+ cache->header->num_misses++;
-+ CACHE_UNLOCK(cache);
++ CACHE_FAST_INC(cache, cache->header->num_misses);
++ CACHE_RDUNLOCK(cache);
+ return NULL;
+}
+/* }}} */
+apc_cache_entry_t* apc_cache_find(apc_cache_t* cache, apc_cache_key_t key, time_t t TSRMLS_DC)
+{
+ slot_t * slot = apc_cache_find_slot(cache, key, t TSRMLS_CC);
++ apc_debug("apc_cache_find [%i]\n" TSRMLS_CC, key.h);
+ return (slot) ? slot->value : NULL;
+}
+/* }}} */
+{
+ slot_t** slot;
+ volatile apc_cache_entry_t* value = NULL;
++ unsigned long h;
+
+ if(apc_cache_busy(cache))
+ {
+ return NULL;
+ }
+
-+ CACHE_LOCK(cache);
++ CACHE_RDLOCK(cache);
++
++ h = string_nhash_8(strkey, keylen);
+
-+ slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots];
++ slot = &cache->slots[h % cache->num_slots];
+
+ while (*slot) {
-+ if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
++ if ((h == (*slot)->key.h) &&
++ !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
+ /* Check to make sure this entry isn't expired by a hard TTL */
+ if((*slot)->value->data.user.ttl && (time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t) {
++ #if (USE_READ_LOCKS == 0)
++ /* this is merely a memory-friendly optimization, if we do have a write-lock
++ * might as well move this to the deleted_list right-away. Otherwise an insert
++ * of the same key wil do it (or an expunge, *eventually*).
++ */
+ remove_slot(cache, slot TSRMLS_CC);
-+ cache->header->num_misses++;
-+ CACHE_UNLOCK(cache);
++ #endif
++ CACHE_FAST_INC(cache, cache->header->num_misses);
++ CACHE_RDUNLOCK(cache);
+ return NULL;
+ }
+ /* Otherwise we are fine, increase counters and return the cache entry */
-+ (*slot)->num_hits++;
-+ (*slot)->value->ref_count++;
++ CACHE_SAFE_INC(cache, (*slot)->num_hits);
++ CACHE_SAFE_INC(cache, (*slot)->value->ref_count);
+ (*slot)->access_time = t;
+
-+ cache->header->num_hits++;
++ CACHE_FAST_INC(cache, cache->header->num_hits);
+ value = (*slot)->value;
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return (apc_cache_entry_t*)value;
+ }
+ slot = &(*slot)->next;
+ }
+
-+ cache->header->num_misses++;
-+ CACHE_UNLOCK(cache);
++ CACHE_FAST_INC(cache, cache->header->num_misses);
++ CACHE_RDUNLOCK(cache);
+ return NULL;
+}
+/* }}} */
+{
+ slot_t** slot;
+ volatile apc_cache_entry_t* value = NULL;
++ unsigned long h;
+
+ if(apc_cache_busy(cache))
+ {
+ return NULL;
+ }
+
-+ CACHE_LOCK(cache);
++ CACHE_RDLOCK(cache);
+
-+ slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots];
++ h = string_nhash_8(strkey, keylen);
++
++ slot = &cache->slots[h % cache->num_slots];
+
+ while (*slot) {
-+ if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
++ if ((h == (*slot)->key.h) &&
++ !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
+ /* Check to make sure this entry isn't expired by a hard TTL */
+ if((*slot)->value->data.user.ttl && (time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t) {
+ CACHE_UNLOCK(cache);
+ }
+ /* Return the cache entry ptr */
+ value = (*slot)->value;
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return (apc_cache_entry_t*)value;
+ }
+ slot = &(*slot)->next;
+ }
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return NULL;
+}
+/* }}} */
+{
+ slot_t** slot;
+ int retval;
++ unsigned long h;
+
+ if(apc_cache_busy(cache))
+ {
+
+ CACHE_LOCK(cache);
+
-+ slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots];
++ h = string_nhash_8(strkey, keylen);
++ slot = &cache->slots[h % cache->num_slots];
+
+ while (*slot) {
-+ if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
-+ retval = updater(cache, (*slot)->value, data);
-+ (*slot)->key.mtime = apc_time();
++ if ((h == (*slot)->key.h) &&
++ !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
++ switch(Z_TYPE_P((*slot)->value->data.user.val) & ~IS_CONSTANT_INDEX) {
++ case IS_ARRAY:
++ case IS_CONSTANT_ARRAY:
++ case IS_OBJECT:
++ {
++ if(APCG(serializer)) {
++ retval = 0;
++ break;
++ } else {
++ /* fall through */
++ }
++ }
++ /* fall through */
++ default:
++ {
++ retval = updater(cache, (*slot)->value, data);
++ (*slot)->key.mtime = apc_time();
++ }
++ break;
++ }
+ CACHE_UNLOCK(cache);
+ return retval;
+ }
+int apc_cache_user_delete(apc_cache_t* cache, char *strkey, int keylen TSRMLS_DC)
+{
+ slot_t** slot;
++ unsigned long h;
+
+ CACHE_LOCK(cache);
+
-+ slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots];
++ h = string_nhash_8(strkey, keylen);
++
++ slot = &cache->slots[h % cache->num_slots];
+
+ while (*slot) {
-+ if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
++ if ((h == (*slot)->key.h) &&
++ !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
+ remove_slot(cache, slot TSRMLS_CC);
+ CACHE_UNLOCK(cache);
+ return 1;
+ CACHE_LOCK(cache);
+
+ if(key.type == APC_CACHE_KEY_FILE) slot = &cache->slots[hash(key) % cache->num_slots];
-+ else slot = &cache->slots[string_nhash_8(key.data.fpfile.fullpath, key.data.fpfile.fullpath_len) % cache->num_slots];
++ else slot = &cache->slots[key.h % cache->num_slots];
+
+ while(*slot) {
+ if(key.type == (*slot)->key.type) {
+ return 1;
+ }
+ } else { /* APC_CACHE_KEY_FPFILE */
-+ if(((*slot)->key.data.fpfile.fullpath_len == key.data.fpfile.fullpath_len) &&
++ if(((*slot)->key.h == key.h) &&
+ (!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1))) {
+ remove_slot(cache, slot TSRMLS_CC);
+ CACHE_UNLOCK(cache);
+/* {{{ apc_cache_release */
+void apc_cache_release(apc_cache_t* cache, apc_cache_entry_t* entry TSRMLS_DC)
+{
-+ CACHE_LOCK(cache);
-+ entry->ref_count--;
-+ CACHE_UNLOCK(cache);
++ CACHE_SAFE_DEC(cache, entry->ref_count);
+}
+/* }}} */
+
+
+ len = strlen(filename);
+ if(APCG(fpstat)==0) {
-+ if(IS_ABSOLUTE_PATH(filename,len)) {
++ if(IS_ABSOLUTE_PATH(filename,len) || strstr(filename, "://")) {
+ key->data.fpfile.fullpath = filename;
+ key->data.fpfile.fullpath_len = len;
++ key->h = string_nhash_8(key->data.fpfile.fullpath, key->data.fpfile.fullpath_len);
+ key->mtime = t;
+ key->type = APC_CACHE_KEY_FPFILE;
+ goto success;
+
+ key->data.fpfile.fullpath = APCG(canon_path);
+ key->data.fpfile.fullpath_len = strlen(APCG(canon_path));
++ key->h = string_nhash_8(key->data.fpfile.fullpath, key->data.fpfile.fullpath_len);
+ key->mtime = t;
+ key->type = APC_CACHE_KEY_FPFILE;
+ goto success;
+
+ key->data.file.device = fileinfo->st_buf.sb.st_dev;
+ key->data.file.inode = fileinfo->st_buf.sb.st_ino;
++ key->h = (unsigned long) key->data.file.device + (unsigned long) key->data.file.inode;
+
+ /*
+ * If working with content management systems that like to munge the mtime,
+
+ key->data.user.identifier = identifier;
+ key->data.user.identifier_len = identifier_len;
++ key->h = string_nhash_8(key->data.user.identifier, key->data.user.identifier_len);
+ key->mtime = t;
+ key->type = APC_CACHE_KEY_USER;
+ return 1;
+}
+/* }}} */
+
++/* {{{ */
++static zval* apc_cache_link_info(apc_cache_t *cache, slot_t* p TSRMLS_DC)
++{
++ zval *link = NULL;
++ char md5str[33];
++
++ ALLOC_INIT_ZVAL(link);
++
++ if(!link) {
++ return NULL;
++ }
++
++ array_init(link);
++
++ if(p->value->type == APC_CACHE_ENTRY_FILE) {
++ add_assoc_string(link, "type", "file", 1);
++ if(p->key.type == APC_CACHE_KEY_FILE) {
++
++ #ifdef PHP_WIN32
++ {
++ char buf[20];
++ sprintf(buf, "%I64d", p->key.data.file.device);
++ add_assoc_string(link, "device", buf, 1);
++
++ sprintf(buf, "%I64d", p->key.data.file.inode);
++ add_assoc_string(link, "inode", buf, 1);
++ }
++ #else
++ add_assoc_long(link, "device", p->key.data.file.device);
++ add_assoc_long(link, "inode", p->key.data.file.inode);
++ #endif
++
++ add_assoc_string(link, "filename", p->value->data.file.filename, 1);
++ } else { /* This is a no-stat fullpath file entry */
++ add_assoc_long(link, "device", 0);
++ add_assoc_long(link, "inode", 0);
++ add_assoc_string(link, "filename", (char*)p->key.data.fpfile.fullpath, 1);
++ }
++ if (APCG(file_md5)) {
++ make_digest(md5str, p->key.md5);
++ add_assoc_string(link, "md5", md5str, 1);
++ }
++ } else if(p->value->type == APC_CACHE_ENTRY_USER) {
++ add_assoc_stringl(link, "info", p->value->data.user.info, p->value->data.user.info_len-1, 1);
++ add_assoc_long(link, "ttl", (long)p->value->data.user.ttl);
++ add_assoc_string(link, "type", "user", 1);
++ }
++
++ add_assoc_double(link, "num_hits", (double)p->num_hits);
++ add_assoc_long(link, "mtime", p->key.mtime);
++ add_assoc_long(link, "creation_time", p->creation_time);
++ add_assoc_long(link, "deletion_time", p->deletion_time);
++ add_assoc_long(link, "access_time", p->access_time);
++ add_assoc_long(link, "ref_count", p->value->ref_count);
++ add_assoc_long(link, "mem_size", p->value->mem_size);
++
++ return link;
++}
++/* }}} */
++
+/* {{{ apc_cache_info */
-+apc_cache_info_t* apc_cache_info(apc_cache_t* cache, zend_bool limited TSRMLS_DC)
++zval* apc_cache_info(apc_cache_t* cache, zend_bool limited TSRMLS_DC)
+{
-+ apc_cache_info_t* info;
++ zval *info = NULL;
++ zval *list = NULL;
++ zval *deleted_list = NULL;
++ zval *slots = NULL;
+ slot_t* p;
-+ int i;
++ int i, j;
+
+ if(!cache) return NULL;
+
-+ CACHE_LOCK(cache);
++ CACHE_RDLOCK(cache);
++
++ ALLOC_INIT_ZVAL(info);
+
-+ info = (apc_cache_info_t*) apc_php_malloc(sizeof(apc_cache_info_t) TSRMLS_CC);
+ if(!info) {
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return NULL;
+ }
-+ info->num_slots = cache->num_slots;
-+ info->ttl = cache->ttl;
-+ info->num_hits = cache->header->num_hits;
-+ info->num_misses = cache->header->num_misses;
-+ info->list = NULL;
-+ info->deleted_list = NULL;
-+ info->start_time = cache->header->start_time;
-+ info->expunges = cache->header->expunges;
-+ info->mem_size = cache->header->mem_size;
-+ info->num_entries = cache->header->num_entries;
-+ info->num_inserts = cache->header->num_inserts;
++
++ array_init(info);
++ add_assoc_long(info, "num_slots", cache->num_slots);
++ add_assoc_long(info, "ttl", cache->ttl);
++
++ add_assoc_double(info, "num_hits", (double)cache->header->num_hits);
++ add_assoc_double(info, "num_misses", (double)cache->header->num_misses);
++ add_assoc_double(info, "num_inserts", (double)cache->header->num_inserts);
++ add_assoc_double(info, "expunges", (double)cache->header->expunges);
++
++ add_assoc_long(info, "start_time", cache->header->start_time);
++ add_assoc_double(info, "mem_size", (double)cache->header->mem_size);
++ add_assoc_long(info, "num_entries", cache->header->num_entries);
++#ifdef MULTIPART_EVENT_FORMDATA
++ add_assoc_long(info, "file_upload_progress", 1);
++#else
++ add_assoc_long(info, "file_upload_progress", 0);
++#endif
++#if APC_MMAP
++ add_assoc_stringl(info, "memory_type", "mmap", sizeof("mmap")-1, 1);
++#else
++ add_assoc_stringl(info, "memory_type", "IPC shared", sizeof("IPC shared")-1, 1);
++#endif
++ add_assoc_stringl(info, "locking_type", APC_LOCK_TYPE, sizeof(APC_LOCK_TYPE)-1, 1);
+
+ if(!limited) {
+ /* For each hashtable slot */
-+ for (i = 0; i < info->num_slots; i++) {
++ ALLOC_INIT_ZVAL(list);
++ array_init(list);
++
++ ALLOC_INIT_ZVAL(slots);
++ array_init(slots);
++
++ for (i = 0; i < cache->num_slots; i++) {
+ p = cache->slots[i];
++ j = 0;
+ for (; p != NULL; p = p->next) {
-+ apc_cache_link_t* link = (apc_cache_link_t*) apc_php_malloc(sizeof(apc_cache_link_t) TSRMLS_CC);
-+
-+ if(p->value->type == APC_CACHE_ENTRY_FILE) {
-+ if(p->key.type == APC_CACHE_KEY_FILE) {
-+ link->data.file.device = p->key.data.file.device;
-+ link->data.file.inode = p->key.data.file.inode;
-+ link->data.file.filename = apc_xstrdup(p->value->data.file.filename, apc_php_malloc TSRMLS_CC);
-+ } else { /* This is a no-stat fullpath file entry */
-+ link->data.file.device = 0;
-+ link->data.file.inode = 0;
-+ link->data.file.filename = apc_xstrdup(p->key.data.fpfile.fullpath, apc_php_malloc TSRMLS_CC);
-+ }
-+ link->type = APC_CACHE_ENTRY_FILE;
-+ if (APCG(file_md5)) {
-+ link->data.file.md5 = emalloc(sizeof(p->key.md5));
-+ memcpy(link->data.file.md5, p->key.md5, 16);
-+ } else {
-+ link->data.file.md5 = NULL;
-+ }
-+ } else if(p->value->type == APC_CACHE_ENTRY_USER) {
-+ link->data.user.info = apc_xmemcpy(p->value->data.user.info, p->value->data.user.info_len+1, apc_php_malloc TSRMLS_CC);
-+ link->data.user.ttl = p->value->data.user.ttl;
-+ link->type = APC_CACHE_ENTRY_USER;
-+ }
-+ link->num_hits = p->num_hits;
-+ link->mtime = p->key.mtime;
-+ link->creation_time = p->creation_time;
-+ link->deletion_time = p->deletion_time;
-+ link->access_time = p->access_time;
-+ link->ref_count = p->value->ref_count;
-+ link->mem_size = p->value->mem_size;
-+ link->next = info->list;
-+ info->list = link;
++ zval *link = apc_cache_link_info(cache, p TSRMLS_CC);
++ add_next_index_zval(list, link);
++ j++;
++ }
++ if(j != 0) {
++ add_index_long(slots, (ulong)i, j);
+ }
+ }
+
+ /* For each slot pending deletion */
++ ALLOC_INIT_ZVAL(deleted_list);
++ array_init(deleted_list);
++
+ for (p = cache->header->deleted_list; p != NULL; p = p->next) {
-+ apc_cache_link_t* link = (apc_cache_link_t*) apc_php_malloc(sizeof(apc_cache_link_t) TSRMLS_CC);
-+
-+ if(p->value->type == APC_CACHE_ENTRY_FILE) {
-+ if(p->key.type == APC_CACHE_KEY_FILE) {
-+ link->data.file.device = p->key.data.file.device;
-+ link->data.file.inode = p->key.data.file.inode;
-+ link->data.file.filename = apc_xstrdup(p->value->data.file.filename, apc_php_malloc TSRMLS_CC);
-+ } else { /* This is a no-stat fullpath file entry */
-+ link->data.file.device = 0;
-+ link->data.file.inode = 0;
-+ link->data.file.filename = apc_xstrdup(p->key.data.fpfile.fullpath, apc_php_malloc TSRMLS_CC);
-+ }
-+ link->type = APC_CACHE_ENTRY_FILE;
-+ if (APCG(file_md5)) {
-+ link->data.file.md5 = emalloc(sizeof(p->key.md5));
-+ memcpy(link->data.file.md5, p->key.md5, 16);
-+ } else {
-+ link->data.file.md5 = NULL;
-+ }
-+ } else if(p->value->type == APC_CACHE_ENTRY_USER) {
-+ link->data.user.info = apc_xmemcpy(p->value->data.user.info, p->value->data.user.info_len+1, apc_php_malloc TSRMLS_CC);
-+ link->data.user.ttl = p->value->data.user.ttl;
-+ link->type = APC_CACHE_ENTRY_USER;
-+ }
-+ link->num_hits = p->num_hits;
-+ link->mtime = p->key.mtime;
-+ link->creation_time = p->creation_time;
-+ link->deletion_time = p->deletion_time;
-+ link->access_time = p->access_time;
-+ link->ref_count = p->value->ref_count;
-+ link->mem_size = p->value->mem_size;
-+ link->next = info->deleted_list;
-+ info->deleted_list = link;
++ zval *link = apc_cache_link_info(cache, p TSRMLS_CC);
++ add_next_index_zval(deleted_list, link);
+ }
++
++ add_assoc_zval(info, "cache_list", list);
++ add_assoc_zval(info, "deleted_list", deleted_list);
++ add_assoc_zval(info, "slot_distribution", slots);
+ }
+
-+ CACHE_UNLOCK(cache);
++ CACHE_RDUNLOCK(cache);
+ return info;
+}
+/* }}} */
+
-+/* {{{ apc_cache_free_info */
-+void apc_cache_free_info(apc_cache_info_t* info TSRMLS_DC)
-+{
-+ apc_cache_link_t* p = info->list;
-+ apc_cache_link_t* q = NULL;
-+ while (p != NULL) {
-+ q = p;
-+ p = p->next;
-+ if(q->type == APC_CACHE_ENTRY_FILE) {
-+ if(q->data.file.md5) {
-+ efree(q->data.file.md5);
-+ }
-+ apc_php_free(q->data.file.filename TSRMLS_CC);
-+ }
-+ else if(q->type == APC_CACHE_ENTRY_USER) apc_php_free(q->data.user.info TSRMLS_CC);
-+ apc_php_free(q TSRMLS_CC);
-+ }
-+ p = info->deleted_list;
-+ while (p != NULL) {
-+ q = p;
-+ p = p->next;
-+ if(q->type == APC_CACHE_ENTRY_FILE) {
-+ if(q->data.file.md5) {
-+ efree(q->data.file.md5);
-+ }
-+ apc_php_free(q->data.file.filename TSRMLS_CC);
-+ }
-+ else if(q->type == APC_CACHE_ENTRY_USER) apc_php_free(q->data.user.info TSRMLS_CC);
-+ apc_php_free(q TSRMLS_CC);
-+ }
-+ apc_php_free(info TSRMLS_CC);
-+}
-+/* }}} */
-+
+/* {{{ apc_cache_unlock */
+void apc_cache_unlock(apc_cache_t* cache TSRMLS_DC)
+{
+/* }}} */
+
+/* {{{ apc_cache_is_last_key */
-+zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, unsigned int h, time_t t TSRMLS_DC)
++zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t TSRMLS_DC)
+{
+ apc_keyid_t *lastkey = &cache->header->lastkey;
+ unsigned int keylen = key->data.user.identifier_len;
+#endif
+
+
-+ if(!h) h = string_nhash_8(key->data.user.identifier, keylen);
-+
+ /* unlocked reads, but we're not shooting for 100% success with this */
-+ if(lastkey->h == h && keylen == lastkey->keylen) {
++ if(lastkey->h == key->h && keylen == lastkey->keylen) {
+ if(lastkey->mtime == t && FROM_DIFFERENT_THREAD(lastkey)) {
+ /* potential cache slam */
+ if(APCG(slam_defense)) {
-+ apc_warning("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);
++ apc_debug("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);
+ return 1;
+ }
+ }
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_cache.h
-@@ -0,0 +1,403 @@
+diff -Naur a/ext/apc/apc_cache.h b/ext/apc/apc_cache.h
+--- a/ext/apc/apc_cache.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_cache.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,371 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_cache.h 305258 2010-11-10 19:02:06Z gopalv $ */
++/* $Id: apc_cache.h 324329 2012-03-18 15:29:37Z mike $ */
+
+#ifndef APC_CACHE_H
+#define APC_CACHE_H
+#define CACHE_UNLOCK(cache) { UNLOCK(cache->header->lock); cache->has_lock = 0; }
+#define CACHE_SAFE_LOCK(cache) { if ((++cache->has_lock) == 1) LOCK(cache->header->lock); }
+#define CACHE_SAFE_UNLOCK(cache) { if ((--cache->has_lock) == 0) UNLOCK(cache->header->lock); }
++
++#if (RDLOCK_AVAILABLE == 1) && defined(HAVE_ATOMIC_OPERATIONS)
++#define USE_READ_LOCKS 1
++#define CACHE_RDLOCK(cache) { RDLOCK(cache->header->lock); cache->has_lock = 0; }
++#define CACHE_RDUNLOCK(cache) { RDUNLOCK(cache->header->lock); cache->has_lock = 0; }
++#define CACHE_SAFE_INC(cache, obj) { ATOMIC_INC(obj); }
++#define CACHE_SAFE_DEC(cache, obj) { ATOMIC_DEC(obj); }
++#else
++#define USE_READ_LOCKS 0
++#define CACHE_RDLOCK(cache) { LOCK(cache->header->lock); cache->has_lock = 1; }
++#define CACHE_RDUNLOCK(cache) { UNLOCK(cache->header->lock); cache->has_lock = 0; }
++#define CACHE_SAFE_INC(cache, obj) { CACHE_SAFE_LOCK(cache); obj++; CACHE_SAFE_UNLOCK(cache);}
++#define CACHE_SAFE_DEC(cache, obj) { CACHE_SAFE_LOCK(cache); obj--; CACHE_SAFE_UNLOCK(cache);}
++#endif
++
++#define CACHE_FAST_INC(cache, obj) { obj++; }
++#define CACHE_FAST_DEC(cache, obj) { obj--; }
+/* }}} */
+
+/* {{{ struct definition: apc_cache_key_t */
+typedef struct apc_cache_key_t apc_cache_key_t;
+struct apc_cache_key_t {
+ apc_cache_key_data_t data;
++ unsigned long h; /* pre-computed hash value */
+ time_t mtime; /* the mtime of this cached entry */
+ unsigned char type;
+ unsigned char md5[16]; /* md5 hash of the source file */
+ apc_function_t* functions,
+ apc_class_t* classes,
+ apc_context_t* ctxt
-+ TSRMLS_DC);
++ TSRMLS_DC);
+
+
-+zend_bool apc_compile_cache_entry(apc_cache_key_t key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array_pp, apc_cache_entry_t** cache_entry_pp TSRMLS_DC);
++zend_bool apc_compile_cache_entry(apc_cache_key_t *key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array_pp, apc_cache_entry_t** cache_entry_pp TSRMLS_DC);
+
+/*
+ * apc_cache_make_user_entry creates an apc_cache_entry_t object given an info string
+
+extern int apc_cache_make_user_key(apc_cache_key_t* key, char* identifier, int identifier_len, const time_t t);
+
-+/* {{{ struct definition: apc_cache_link_data_t */
-+typedef union _apc_cache_link_data_t {
-+ struct {
-+ char *filename;
-+ apc_ino_t device;
-+ apc_dev_t inode;
-+ unsigned char *md5;
-+ } file;
-+ struct {
-+ char *info;
-+ unsigned int ttl;
-+ } user;
-+} apc_cache_link_data_t;
-+/* }}} */
-+
-+/* {{{ struct definition: apc_cache_link_t */
-+typedef struct apc_cache_link_t apc_cache_link_t;
-+struct apc_cache_link_t {
-+ apc_cache_link_data_t data;
-+ unsigned char type;
-+ unsigned long num_hits;
-+ time_t mtime;
-+ time_t creation_time;
-+ time_t deletion_time;
-+ time_t access_time;
-+ int ref_count;
-+ size_t mem_size;
-+ apc_cache_link_t* next;
-+};
-+/* }}} */
-+
-+
-+/* {{{ struct definition: apc_cache_info_t */
-+typedef struct apc_cache_info_t apc_cache_info_t;
-+struct apc_cache_info_t {
-+ int num_slots;
-+ unsigned long num_hits;
-+ unsigned long num_misses;
-+ unsigned long num_inserts;
-+ unsigned long expunges;
-+ int ttl;
-+ apc_cache_link_t* list;
-+ apc_cache_link_t* deleted_list;
-+ time_t start_time;
-+ int num_entries;
-+ size_t mem_size;
-+};
-+/* }}} */
-+
+/* {{{ struct definition: slot_t */
+typedef struct slot_t slot_t;
+struct slot_t {
+};
+/* }}} */
+
-+extern apc_cache_info_t* apc_cache_info(T cache, zend_bool limited TSRMLS_DC);
-+extern void apc_cache_free_info(apc_cache_info_t* info TSRMLS_DC);
++extern zval* apc_cache_info(T cache, zend_bool limited TSRMLS_DC);
+extern void apc_cache_unlock(apc_cache_t* cache TSRMLS_DC);
+extern zend_bool apc_cache_busy(apc_cache_t* cache);
+extern zend_bool apc_cache_write_lock(apc_cache_t* cache TSRMLS_DC);
+extern void apc_cache_write_unlock(apc_cache_t* cache TSRMLS_DC);
-+extern zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, unsigned int h, time_t t TSRMLS_DC);
++extern zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t TSRMLS_DC);
+
+/* used by apc_rfc1867 to update data in-place - not to be used elsewhere */
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_compile.c
-@@ -0,0 +1,2102 @@
+diff -Naur a/ext/apc/apc_compile.c b/ext/apc/apc_compile.c
+--- a/ext/apc/apc_compile.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_compile.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,2164 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_compile.c 303796 2010-09-27 17:14:18Z gopalv $ */
++/* $Id: apc_compile.c 326703 2012-07-19 17:06:12Z rasmus $ */
+
+#include "apc_compile.h"
+#include "apc_globals.h"
+#include "apc_zend.h"
++#include "apc_php.h"
+#include "apc_string.h"
+#include "ext/standard/php_var.h"
+#include "ext/standard/php_smart_str.h"
+
-+#ifndef IS_CONSTANT_TYPE_MASK
-+#define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX)
-+#endif
-+
+typedef void* (*ht_copy_fun_t)(void*, void*, apc_context_t* TSRMLS_DC);
+//typedef void (*ht_free_fun_t)(void*, apc_context_t*);
+typedef int (*ht_check_copy_fun_t)(Bucket*, va_list);
+ */
+static zval** my_copy_zval_ptr(zval**, const zval**, apc_context_t* TSRMLS_DC);
+static zval* my_copy_zval(zval*, const zval*, apc_context_t* TSRMLS_DC);
++#ifndef ZEND_ENGINE_2_4
+static znode* my_copy_znode(znode*, znode*, apc_context_t* TSRMLS_DC);
++#endif
+static zend_op* my_copy_zend_op(zend_op*, zend_op*, apc_context_t* TSRMLS_DC);
+static zend_function* my_copy_function(zend_function*, zend_function*, apc_context_t* TSRMLS_DC);
+static zend_function_entry* my_copy_function_entry(zend_function_entry*, const zend_function_entry*, apc_context_t* TSRMLS_DC);
+ * defined/overridden in the 'current' class and not inherited.
+ */
+static int my_check_copy_function(Bucket* src, va_list args);
-+static int my_check_copy_default_property(Bucket* p, va_list args);
+static int my_check_copy_property_info(Bucket* src, va_list args);
++#ifndef ZEND_ENGINE_2_4
++static int my_check_copy_default_property(Bucket* p, va_list args);
+static int my_check_copy_static_member(Bucket* src, va_list args);
++#endif
+static int my_check_copy_constant(Bucket* src, va_list args);
+
+/* }}} */
+
++/* {{{ apc php serializers */
++int APC_SERIALIZER_NAME(php) (APC_SERIALIZER_ARGS)
++{
++ smart_str strbuf = {0};
++ php_serialize_data_t var_hash;
++ PHP_VAR_SERIALIZE_INIT(var_hash);
++ php_var_serialize(&strbuf, (zval**)&value, &var_hash TSRMLS_CC);
++ PHP_VAR_SERIALIZE_DESTROY(var_hash);
++ if(strbuf.c) {
++ *buf = (unsigned char*)strbuf.c;
++ *buf_len = strbuf.len;
++ smart_str_0(&strbuf);
++ return 1;
++ }
++ return 0;
++}
++
++int APC_UNSERIALIZER_NAME(php) (APC_UNSERIALIZER_ARGS)
++{
++ const unsigned char *tmp = buf;
++ php_unserialize_data_t var_hash;
++ PHP_VAR_UNSERIALIZE_INIT(var_hash);
++ if(!php_var_unserialize(value, &tmp, buf + buf_len, &var_hash TSRMLS_CC)) {
++ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
++ zval_dtor(*value);
++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %ld of %ld bytes", (long)(tmp - buf), (long)buf_len);
++ (*value)->type = IS_NULL;
++ return 0;
++ }
++ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
++ return 1;
++}
++/* }}} */
++
+/* {{{ check_op_array_integrity */
+#if 0
+static void check_op_array_integrity(zend_op_array* src)
+static zval* my_serialize_object(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ smart_str buf = {0};
-+ php_serialize_data_t var_hash;
+ apc_pool* pool = ctxt->pool;
++ apc_serialize_t serialize = APC_SERIALIZER_NAME(php);
++ void *config = NULL;
+
-+ PHP_VAR_SERIALIZE_INIT(var_hash);
-+ php_var_serialize(&buf, (zval**)&src, &var_hash TSRMLS_CC);
-+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
++ if(APCG(serializer)) { /* TODO: move to ctxt */
++ serialize = APCG(serializer)->serialize;
++ config = APCG(serializer)->config;
++ }
+
-+ if(buf.c) {
++ if(serialize((unsigned char**)&buf.c, &buf.len, src, config TSRMLS_CC)) {
+ dst->type = src->type & ~IS_CONSTANT_INDEX;
+ dst->value.str.len = buf.len;
+ CHECK(dst->value.str.val = apc_pmemcpy(buf.c, (buf.len + 1), pool TSRMLS_CC));
-+ dst->type = src->type;
-+ smart_str_free(&buf);
+ }
+
++ if(buf.c) smart_str_free(&buf);
++
+ return dst;
+}
+/* }}} */
+/* {{{ my_unserialize_object */
+static zval* my_unserialize_object(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
-+ php_unserialize_data_t var_hash;
-+ const unsigned char *p = (unsigned char*)Z_STRVAL_P(src);
++ apc_unserialize_t unserialize = APC_UNSERIALIZER_NAME(php);
++ unsigned char *p = (unsigned char*)Z_STRVAL_P(src);
++ void *config = NULL;
+
-+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
-+ if(!php_var_unserialize(&dst, &p, p + Z_STRLEN_P(src), &var_hash TSRMLS_CC)) {
-+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
++ if(APCG(serializer)) { /* TODO: move to ctxt */
++ unserialize = APCG(serializer)->unserialize;
++ config = APCG(serializer)->config;
++ }
++
++ if(unserialize(&dst, p, Z_STRLEN_P(src), config TSRMLS_CC)) {
++ return dst;
++ } else {
+ zval_dtor(dst);
-+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %ld of %d bytes", (long)((char*)p - Z_STRVAL_P(src)), Z_STRLEN_P(src));
+ dst->type = IS_NULL;
+ }
-+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return dst;
+}
+/* }}} */
+static char *apc_string_pmemcpy(char *str, size_t len, apc_pool* pool TSRMLS_DC)
+{
+#ifdef ZEND_ENGINE_2_4
++#ifndef ZTS
+ if (pool->type != APC_UNPOOL) {
-+ char * ret = apc_new_interned_string(str, len TSRMLS_CC);
++ char * ret = (char*)apc_new_interned_string((const char*)str, len TSRMLS_CC);
+ if (ret) {
+ return ret;
+ }
+ }
+#endif
++#endif
+ return apc_pmemcpy(str, len, pool TSRMLS_CC);
+}
+
+/* {{{ my_copy_zval */
-+static zval* my_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
++static APC_HOTSPOT zval* my_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ zval **tmp;
+ apc_pool* pool = ctxt->pool;
+
+ case IS_ARRAY:
+ case IS_CONSTANT_ARRAY:
-+
-+ CHECK(dst->value.ht =
-+ my_copy_hashtable(NULL,
-+ src->value.ht,
-+ (ht_copy_fun_t) my_copy_zval_ptr,
-+ 1,
-+ ctxt));
-+ break;
++ if(APCG(serializer) == NULL ||
++ ctxt->copy == APC_COPY_IN_OPCODE || ctxt->copy == APC_COPY_OUT_OPCODE) {
++
++ CHECK(dst->value.ht =
++ my_copy_hashtable(NULL,
++ src->value.ht,
++ (ht_copy_fun_t) my_copy_zval_ptr,
++ 1,
++ ctxt));
++ break;
++ } else {
++ /* fall through to object case */
++ }
+
+ case IS_OBJECT:
+
+ }
+
+ if (src->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(src)) {
-+ int i, n;
++ int n;
+
+ for (n = 0; src->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(src)[n].fname != NULL; n++) {}
+
+/* }}} */
+
+/* {{{ my_copy_hashtable_ex */
-+static HashTable* my_copy_hashtable_ex(HashTable* dst,
++static APC_HOTSPOT HashTable* my_copy_hashtable_ex(HashTable* dst,
+ HashTable* src TSRMLS_DC,
+ ht_copy_fun_t copy_fn,
+ int holds_ptrs,
+ CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
+ } else if (IS_INTERNED(curr->arKey)) {
+ CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
++#ifndef ZTS
+ } else if (pool->type != APC_UNPOOL) {
+ char *arKey;
+
++ CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
+ arKey = apc_new_interned_string(curr->arKey, curr->nKeyLength TSRMLS_CC);
+ if (!arKey) {
-+ CHECK((newp = (Bucket*) apc_pmemcpy(curr, (sizeof(Bucket) + curr->nKeyLength), pool TSRMLS_CC)));
-+ newp->arKey = ((char*)newp) + sizeof(Bucket);
++ CHECK((newp->arKey = (char*) apc_pmemcpy(curr->arKey, curr->nKeyLength, pool TSRMLS_CC)));
+ } else {
-+ CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
+ newp->arKey = arKey;
+ }
++#endif
+ } else {
-+ CHECK((newp = (Bucket*) apc_pmemcpy(curr, (sizeof(Bucket) + curr->nKeyLength), pool TSRMLS_CC)));
-+ newp->arKey = ((char*)newp) + sizeof(Bucket);
++ CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
++ CHECK((newp->arKey = (char*) apc_pmemcpy(curr->arKey, curr->nKeyLength, pool TSRMLS_CC)));
+ }
+#else
+ CHECK((newp = (Bucket*) apc_pmemcpy(curr,
+
+ dst->pListTail = newp;
+
++ zend_hash_internal_pointer_reset(dst);
++
+ return dst;
+}
+/* }}} */
+ case ZEND_JMP_SET:
+#endif
+#ifdef ZEND_ENGINE_2_4
++ case ZEND_JMP_SET_VAR:
++#endif
++#ifdef ZEND_ENGINE_2_4
+ zo->op2.jmp_addr = dst->opcodes + (zo->op2.jmp_addr - src->opcodes);
+#else
+ zo->op2.u.jmp_addr = dst->opcodes + (zo->op2.u.jmp_addr - src->opcodes);
+#ifdef ZEND_ENGINE_2_3
+ case ZEND_JMP_SET:
+#endif
++#ifdef ZEND_ENGINE_2_4
++ case ZEND_JMP_SET_VAR:
++#endif
+ if(flags != NULL) {
+ flags->has_jumps = 1;
+ }
+ dzo->op1.literal = (zend_literal*) apc_pool_alloc(pool, sizeof(zend_literal));
+ Z_STRLEN_P(dzo->op1.zv) = strlen(fullpath);
+ Z_STRVAL_P(dzo->op1.zv) = apc_pstrdup(fullpath, pool TSRMLS_CC);
++ Z_TYPE_P(dzo->op1.zv) = IS_STRING;
+ Z_SET_REFCOUNT_P(dzo->op1.zv, 2);
+ Z_SET_ISREF_P(dzo->op1.zv);
+ dzo->op1.literal->hash_value = zend_hash_func(Z_STRVAL_P(dzo->op1.zv), Z_STRLEN_P(dzo->op1.zv)+1);
+ case ZEND_JMP_SET:
+#endif
+#ifdef ZEND_ENGINE_2_4
++ case ZEND_JMP_SET_VAR:
++#endif
++#ifdef ZEND_ENGINE_2_4
+ dzo->op2.jmp_addr = dst->opcodes +
+ (zo->op2.jmp_addr - src->opcodes);
+#else
+ /* Deep-copy the class properties, because they will be modified */
+
+#ifdef ZEND_ENGINE_2_4
++ dst->name = apc_string_pmemcpy((char*)src->name, src->name_length+1, ctxt->pool TSRMLS_CC);
+ dst->default_properties_count = src->default_properties_count;
+ if (src->default_properties_count) {
+ dst->default_properties_table = (zval**) apc_php_malloc((sizeof(zval*) * src->default_properties_count) TSRMLS_CC);
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_compile.h
-@@ -0,0 +1,146 @@
+diff -Naur a/ext/apc/apc_compile.h b/ext/apc/apc_compile.h
+--- a/ext/apc/apc_compile.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_compile.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,152 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_compile.h 303388 2010-09-15 09:50:28Z dmitry $ */
++/* $Id: apc_compile.h 307185 2011-01-06 21:13:11Z gopalv $ */
+
+#ifndef APC_COMPILE_H
+#define APC_COMPILE_H
+#include "apc.h"
+#include "apc_php.h"
+#include "apc_main.h"
++#include "apc_serializer.h"
+
+/* {{{ struct definition: apc_function_t */
+typedef struct apc_function_t apc_function_t;
+long apc_file_halt_offset(const char* filename TSRMLS_DC);
+void apc_do_halt_compiler_register(const char *filename, long halt_offset TSRMLS_DC);
+
++/*
++ * apc serialization functions
++ */
++int APC_SERIALIZER_NAME(php) (APC_SERIALIZER_ARGS);
++int APC_UNSERIALIZER_NAME(php) (APC_UNSERIALIZER_ARGS);
+#endif
+
+/*
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_debug.c
+diff -Naur a/ext/apc/apc_debug.c b/ext/apc/apc_debug.c
+--- a/ext/apc/apc_debug.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_debug.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,70 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+ All other licensing and usage conditions are those of the PHP Group.
+*/
+
-+/* $Id: apc_debug.c 304107 2010-10-05 15:14:06Z kalle $ */
++/* $Id: apc_debug.c 307048 2011-01-03 23:53:17Z kalle $ */
+#include "apc.h"
+#include <stdio.h>
+#include "zend.h"
+ apc_warning("vld is not installed or something even worse." TSRMLS_CC);
+#endif
+}
---- /dev/null
-+++ b/ext/apc/apc_debug.h
+diff -Naur a/ext/apc/apc_debug.h b/ext/apc/apc_debug.h
+--- a/ext/apc/apc_debug.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_debug.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,29 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+*/
+
+void dump(zend_op_array * TSRMLS_DC);
---- /dev/null
-+++ b/ext/apc/apc_fcntl.c
+diff -Naur a/ext/apc/apc_fcntl.c b/ext/apc/apc_fcntl.c
+--- a/ext/apc/apc_fcntl.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_fcntl.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,123 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_fcntl.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_fcntl.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc.h"
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_fcntl.h
+diff -Naur a/ext/apc/apc_fcntl.h b/ext/apc/apc_fcntl.h
+--- a/ext/apc/apc_fcntl.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_fcntl.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,50 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_fcntl.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_fcntl.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_FCNTL_H
+#define APC_FCNTL_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_fcntl_win32.c
-@@ -0,0 +1,117 @@
+diff -Naur a/ext/apc/apc_fcntl_win32.c b/ext/apc/apc_fcntl_win32.c
+--- a/ext/apc/apc_fcntl_win32.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_fcntl_win32.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,120 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+ +----------------------------------------------------------------------+
+ | Authors: George Schlossnagle <george@omniti.com> |
+ | Edin Kadribasic <edink@php.net> |
++ | Pierre Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+
+ This software was contributed to PHP by Community Connect Inc. in 2002
+
+ */
+
-+/* $Id: apc_fcntl_win32.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_fcntl_win32.c 309203 2011-03-14 06:47:16Z pajoye $ */
+
+#include "apc.h"
+#include "apc_fcntl.h"
+
+int apc_fcntl_create(const char* pathname TSRMLS_DC)
+{
-+ char *lock_file = emalloc(MAXPATHLEN);
++ char lock_file[MAXPATHLEN];
+ HANDLE fd;
-+ DWORD tmplen;
-+ static int i=0;
++ DWORD tmp_dirname_len;
++ char lock_filename_tpl[] = ".apc.XXXXXX";
++ char *lock_filename;
+
-+ tmplen = GetTempPath(MAXPATHLEN, lock_file);
-+ if (!tmplen) {
-+ efree(lock_file);
++ tmp_dirname_len = GetTempPath(MAXPATHLEN, lock_file);
++ if (!tmp_dirname_len) {
+ return -1;
+ }
+
-+ snprintf(lock_file + tmplen, MAXPATHLEN - tmplen - 1, "apc.lock.%d", i++);
++ lock_filename = _mktemp(lock_filename_tpl);
++ if (lock_filename == NULL) {
++ return -1;
++ }
++
++ snprintf(lock_file + tmp_dirname_len, MAXPATHLEN - tmp_dirname_len - 1, "%s", lock_filename);
+
+ fd = CreateFile(lock_file,
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
-+
+ if (fd == INVALID_HANDLE_VALUE) {
+ apc_error("apc_fcntl_create: could not open %s" TSRMLS_CC, lock_file);
-+ efree(lock_file);
+ return -1;
+ }
+
-+ efree(lock_file);
+ return (int)fd;
+}
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_globals.h
-@@ -0,0 +1,148 @@
+diff -Naur a/ext/apc/apc_globals.h b/ext/apc/apc_globals.h
+--- a/ext/apc/apc_globals.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_globals.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,152 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_globals.h 301232 2010-07-13 12:23:35Z gopalv $ */
++/* $Id: apc_globals.h 307215 2011-01-07 09:54:00Z gopalv $ */
+
+#ifndef APC_GLOBALS_H
+#define APC_GLOBALS_H
+#include "apc_cache.h"
+#include "apc_stack.h"
+#include "apc_php.h"
++#include "apc_main.h"
+
+/* {{{ struct apc_rfc1867_data */
+
+};
+/* }}} */
+
++
+ZEND_BEGIN_MODULE_GLOBALS(apc)
+ /* configuration parameters */
+ zend_bool enabled; /* if true, apc is enabled (defaults to true) */
+#ifdef ZEND_ENGINE_2_4
+ long shm_strings_buffer;
+#endif
++ char *serializer_name; /* the serializer config option */
++ apc_serializer_t *serializer;/* the actual serializer in use */
+ZEND_END_MODULE_GLOBALS(apc)
+
+/* (the following declaration is defined in php_apc.c) */
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc.h
-@@ -0,0 +1,124 @@
+diff -Naur a/ext/apc/apc.h b/ext/apc/apc.h
+--- a/ext/apc/apc.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,136 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc.h 304310 2010-10-11 12:19:24Z gopalv $ */
++/* $Id: apc.h 307264 2011-01-08 13:20:20Z gopalv $ */
+
+#ifndef APC_H
+#define APC_H
+#define APC_POSITIVE_MATCH 2
+
+#define apc_time() \
-+ (APCG(use_request_time) ? sapi_get_request_time(TSRMLS_C) : time(0));
++ (APCG(use_request_time) ? (time_t) sapi_get_request_time(TSRMLS_C) : time(0));
++
++#if defined(__GNUC__)
++# define APC_UNUSED __attribute__((unused))
++# define APC_USED __attribute__((used))
++# define APC_ALLOC __attribute__((malloc))
++# define APC_HOTSPOT __attribute__((hot))
++#else
++# define APC_UNUSED
++# define APC_USED
++# define APC_ALLOC
++# define APC_HOTSPOT
++#endif
+
+#endif
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_iterator.c
-@@ -0,0 +1,710 @@
+diff -Naur a/ext/apc/apc_iterator.c b/ext/apc/apc_iterator.c
+--- a/ext/apc/apc_iterator.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_iterator.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,741 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_iterator.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_iterator.c 324326 2012-03-18 13:19:50Z pajoye $ */
+
+#include "php_apc.h"
+#include "apc_iterator.h"
+ }
+ if (APC_ITER_MD5 & iterator->format) {
+ if(slot->value->type == APC_CACHE_ENTRY_FILE) {
-+ if(slot->key.md5) {
++ if(APCG(file_md5) && slot->key.md5) {
+ make_digest(md5str, slot->key.md5);
+ add_assoc_string(item->value, "md5", md5str, 1);
+ }
+ iterator->obj.ce = ce;
+ ALLOC_HASHTABLE(iterator->obj.properties);
+ zend_hash_init(iterator->obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
++#ifdef ZEND_ENGINE_2_4
++ iterator->obj.properties_table = NULL;
++#endif
+ iterator->obj.guards = NULL;
+ iterator->initialized = 0;
+ retval.handle = zend_objects_store_put(iterator, apc_iterator_destroy, apc_iterator_free, NULL TSRMLS_CC);
+ char *key;
+ int key_len;
+ char *fname_key = NULL;
-+ int fname_key_len;
++ int fname_key_len = 0;
+ int rval = 1;
+
+ if ((*slot)->key.type == APC_CACHE_KEY_FILE) {
-+ key = estrdup((*slot)->value->data.file.filename);
++ key = (*slot)->value->data.file.filename;
+ key_len = strlen(key);
+ fname_key_len = spprintf(&fname_key, 0, "%ld %ld", (*slot)->key.data.file.device, (*slot)->key.data.file.inode);
+ } else if ((*slot)->key.type == APC_CACHE_KEY_USER) {
+ } else if ((*slot)->key.type == APC_CACHE_KEY_FPFILE) {
+ key = (char*)(*slot)->key.data.fpfile.fullpath;
+ key_len = (*slot)->key.data.fpfile.fullpath_len;
++ } else {
++ return 0;
+ }
+
+#ifdef ITERATOR_PCRE
+}
+/* }}} */
+
-+/* {{{ apc_iterator_fetch_active */
-+static int apc_iterator_fetch_active(apc_iterator_t *iterator TSRMLS_DC) {
-+ int count=0;
-+ slot_t **slot;
-+ apc_iterator_item_t *item;
-+
-+ while (apc_stack_size(iterator->stack) > 0) {
-+ apc_iterator_item_dtor(apc_stack_pop(iterator->stack));
-+ }
++/* {{{ apc_iterator_check_expiry */
++static int apc_iterator_check_expiry(apc_cache_t* cache, slot_t **slot, time_t t)
++{
++ if((*slot)->value->type == APC_CACHE_ENTRY_USER) {
++ if((*slot)->value->data.user.ttl) {
++ if((time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t) {
++ return 0;
++ }
++ } else if(cache->ttl) {
++ if((*slot)->creation_time + cache->ttl < t) {
++ return 0;
++ }
++ }
++ } else if((*slot)->access_time < (t - cache->ttl)) {
++ return 0;
++ }
++
++ return 1;
++}
++/* }}} */
++
++/* {{{ apc_iterator_fetch_active */
++static int apc_iterator_fetch_active(apc_iterator_t *iterator TSRMLS_DC) {
++ int count=0;
++ slot_t **slot;
++ apc_iterator_item_t *item;
++ time_t t;
++
++ t = apc_time();
++
++ while (apc_stack_size(iterator->stack) > 0) {
++ apc_iterator_item_dtor(apc_stack_pop(iterator->stack));
++ }
+
+ CACHE_LOCK(iterator->cache);
+ while(count <= iterator->chunk_size && iterator->slot_idx < iterator->cache->num_slots) {
+ slot = &iterator->cache->slots[iterator->slot_idx];
+ while(*slot) {
-+ if (apc_iterator_search_match(iterator, slot)) {
-+ count++;
-+ item = apc_iterator_item_ctor(iterator, slot TSRMLS_CC);
-+ if (item) {
-+ apc_stack_push(iterator->stack, item TSRMLS_CC);
++ if (apc_iterator_check_expiry(iterator->cache, slot, t)) {
++ if (apc_iterator_search_match(iterator, slot)) {
++ count++;
++ item = apc_iterator_item_ctor(iterator, slot TSRMLS_CC);
++ if (item) {
++ apc_stack_push(iterator->stack, item TSRMLS_CC);
++ }
+ }
+ }
+ slot = &(*slot)->next;
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_iterator.h
+diff -Naur a/ext/apc/apc_iterator.h b/ext/apc/apc_iterator.h
+--- a/ext/apc/apc_iterator.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_iterator.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,117 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_iterator.h 300979 2010-07-04 10:15:05Z kalle $ */
++/* $Id: apc_iterator.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_ITERATOR_H
+#define APC_ITERATOR_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_lock.h
-@@ -0,0 +1,101 @@
+diff -Naur a/ext/apc/apc_lock.h b/ext/apc/apc_lock.h
+--- a/ext/apc/apc_lock.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_lock.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,160 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+ +----------------------------------------------------------------------+
+ | Authors: George Schlossnagle <george@omniti.com> |
+ | Rasmus Lerdorf <rasmus@php.net> |
++ | Pierre Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+
+ This software was contributed to PHP by Community Connect Inc. in 2002
+
+ */
+
-+/* $Id: apc_lock.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_lock.h 311339 2011-05-22 17:18:49Z gopalv $ */
+
+#ifndef APC_LOCK
+#define APC_LOCK
+
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
+#include "apc.h"
+#include "apc_sem.h"
+#include "apc_fcntl.h"
+#include "apc_pthreadmutex.h"
++#include "apc_pthreadrwlock.h"
+#include "apc_spin.h"
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
++#include "apc_windows_srwlock_kernel.h"
+
+/* {{{ generic locking macros */
+#define CREATE_LOCK(lock) apc_lck_create(NULL, 0, 1, lock)
+#define LOCK(lock) { HANDLE_BLOCK_INTERRUPTIONS(); apc_lck_lock(lock); }
+#define RDLOCK(lock) { HANDLE_BLOCK_INTERRUPTIONS(); apc_lck_rdlock(lock); }
+#define UNLOCK(lock) { apc_lck_unlock(lock); HANDLE_UNBLOCK_INTERRUPTIONS(); }
++#define RDUNLOCK(lock) { apc_lck_rdunlock(lock); HANDLE_UNBLOCK_INTERRUPTIONS(); }
+/* }}} */
+
++/* atomic operations : rdlocks are impossible without these */
++#if HAVE_ATOMIC_OPERATIONS
++# ifdef PHP_WIN32
++# define ATOMIC_INC(a) InterlockedIncrement(&a)
++# define ATOMIC_DEC(a) InterlockedDecrement(&a)
++# else
++# define ATOMIC_INC(a) __sync_add_and_fetch(&a, 1)
++# define ATOMIC_DEC(a) __sync_sub_and_fetch(&a, 1)
++# endif
++#endif
++
+#if defined(APC_SEM_LOCKS)
-+#define APC_LOCK_TYPE "IPC Semaphore"
-+#define RDLOCK_AVAILABLE 0
-+#define NONBLOCKING_LOCK_AVAILABLE 1
-+#define apc_lck_t int
-+#define apc_lck_create(a,b,c,d) d=apc_sem_create((b),(c) TSRMLS_CC)
-+#define apc_lck_destroy(a) apc_sem_destroy(a)
-+#define apc_lck_lock(a) apc_sem_lock(a TSRMLS_CC)
-+#define apc_lck_nb_lock(a) apc_sem_nonblocking_lock(a TSRMLS_CC)
-+#define apc_lck_rdlock(a) apc_sem_lock(a TSRMLS_CC)
-+#define apc_lck_unlock(a) apc_sem_unlock(a TSRMLS_CC)
++# define APC_LOCK_TYPE "IPC Semaphore"
++# define RDLOCK_AVAILABLE 0
++# define NONBLOCKING_LOCK_AVAILABLE 1
++# define apc_lck_t int
++# define apc_lck_create(a,b,c,d) d=apc_sem_create((b),(c) TSRMLS_CC)
++# define apc_lck_destroy(a) apc_sem_destroy(a)
++# define apc_lck_lock(a) apc_sem_lock(a TSRMLS_CC)
++# define apc_lck_nb_lock(a) apc_sem_nonblocking_lock(a TSRMLS_CC)
++# define apc_lck_rdlock(a) apc_sem_lock(a TSRMLS_CC)
++# define apc_lck_unlock(a) apc_sem_unlock(a TSRMLS_CC)
++# define apc_lck_rdunlock(a) apc_sem_unlock(a TSRMLS_CC)
+#elif defined(APC_PTHREADMUTEX_LOCKS)
-+#define APC_LOCK_TYPE "pthread mutex Locks"
-+#define RDLOCK_AVAILABLE 0
-+#define NONBLOCKING_LOCK_AVAILABLE 1
-+#define apc_lck_t pthread_mutex_t
-+#define apc_lck_create(a,b,c,d) apc_pthreadmutex_create((pthread_mutex_t*)&d TSRMLS_CC)
-+#define apc_lck_destroy(a) apc_pthreadmutex_destroy(&a)
-+#define apc_lck_lock(a) apc_pthreadmutex_lock(&a TSRMLS_CC)
-+#define apc_lck_nb_lock(a) apc_pthreadmutex_nonblocking_lock(&a TSRMLS_CC)
-+#define apc_lck_rdlock(a) apc_pthreadmutex_lock(&a TSRMLS_CC)
-+#define apc_lck_unlock(a) apc_pthreadmutex_unlock(&a TSRMLS_CC)
++# define APC_LOCK_TYPE "pthread mutex Locks"
++# define RDLOCK_AVAILABLE 0
++# define NONBLOCKING_LOCK_AVAILABLE 1
++# define apc_lck_t pthread_mutex_t
++# define apc_lck_create(a,b,c,d) apc_pthreadmutex_create((pthread_mutex_t*)&d TSRMLS_CC)
++# define apc_lck_destroy(a) apc_pthreadmutex_destroy(&a)
++# define apc_lck_lock(a) apc_pthreadmutex_lock(&a TSRMLS_CC)
++# define apc_lck_nb_lock(a) apc_pthreadmutex_nonblocking_lock(&a TSRMLS_CC)
++# define apc_lck_rdlock(a) apc_pthreadmutex_lock(&a TSRMLS_CC)
++# define apc_lck_unlock(a) apc_pthreadmutex_unlock(&a TSRMLS_CC)
++# define apc_lck_rdunlock(a) apc_pthreadmutex_unlock(&a TSRMLS_CC)
++#elif defined(APC_PTHREADRW_LOCKS)
++# define APC_LOCK_TYPE "pthread read/write Locks"
++# define RDLOCK_AVAILABLE 1
++# define NONBLOCKING_LOCK_AVAILABLE 1
++# define apc_lck_t pthread_rwlock_t
++# define apc_lck_create(a,b,c,d) apc_pthreadrwlock_create((pthread_rwlock_t*)&d TSRMLS_CC)
++# define apc_lck_destroy(a) apc_pthreadrwlock_destroy(&a)
++# define apc_lck_lock(a) apc_pthreadrwlock_lock(&a TSRMLS_CC)
++# define apc_lck_nb_lock(a) apc_pthreadrwlock_nonblocking_lock(&a TSRMLS_CC)
++# define apc_lck_rdlock(a) apc_pthreadrwlock_rdlock(&a TSRMLS_CC)
++# define apc_lck_unlock(a) apc_pthreadrwlock_unlock(&a TSRMLS_CC)
++# define apc_lck_rdunlock(a) apc_pthreadrwlock_unlock(&a TSRMLS_CC)
+#elif defined(APC_SPIN_LOCKS)
-+#define APC_LOCK_TYPE "spin Locks"
-+#define RDLOCK_AVAILABLE 0
-+#define NONBLOCKING_LOCK_AVAILABLE APC_SLOCK_NONBLOCKING_LOCK_AVAILABLE
-+#define apc_lck_t slock_t
-+#define apc_lck_create(a,b,c,d) apc_slock_create((slock_t*)&(d))
-+#define apc_lck_destroy(a) apc_slock_destroy(&a)
-+#define apc_lck_lock(a) apc_slock_lock(&a TSRMLS_CC)
-+#define apc_lck_nb_lock(a) apc_slock_nonblocking_lock(&a)
-+#define apc_lck_rdlock(a) apc_slock_lock(&a TSRMLS_CC)
-+#define apc_lck_unlock(a) apc_slock_unlock(&a)
-+#else
-+#define APC_LOCK_TYPE "File Locks"
-+#define RDLOCK_AVAILABLE 1
-+#ifdef PHP_WIN32
-+#define NONBLOCKING_LOCK_AVAILABLE 0
++# define APC_LOCK_TYPE "spin Locks"
++# define RDLOCK_AVAILABLE 0
++# define NONBLOCKING_LOCK_AVAILABLE APC_SLOCK_NONBLOCKING_LOCK_AVAILABLE
++# define apc_lck_t slock_t
++# define apc_lck_create(a,b,c,d) apc_slock_create((slock_t*)&(d))
++# define apc_lck_destroy(a) apc_slock_destroy(&a)
++# define apc_lck_lock(a) apc_slock_lock(&a TSRMLS_CC)
++# define apc_lck_nb_lock(a) apc_slock_nonblocking_lock(&a)
++# define apc_lck_rdlock(a) apc_slock_lock(&a TSRMLS_CC)
++# define apc_lck_unlock(a) apc_slock_unlock(&a)
++# define apc_lck_rdunlock(a) apc_slock_unlock(&a)
++#elif defined(APC_SRWLOCK_NATIVE) && defined(PHP_WIN32)
++# define APC_LOCK_TYPE "Windows Slim RWLOCK (native)"
++# define RDLOCK_AVAILABLE 1
++# define NONBLOCKING_LOCK_AVAILABLE 0
++# define apc_lck_t SRWLOCK
++# define apc_lck_create(a,b,c,d) InitializeSRWLock((SRWLOCK*)&(d))
++# define apc_lck_destroy(a)
++# define apc_lck_lock(a) AcquireSRWLockExclusive(&a)
++# define apc_lck_rdlock(a) AcquireSRWLockShared(&a)
++# define apc_lck_unlock(a) ReleaseSRWLockExclusive(&a)
++# define apc_lck_rdunlock(a) ReleaseSRWLockShared(&a)
++# if NONBLOCKING_LOCK_AVAILABLE==1 /* Only in win7/2008 */
++# define apc_lck_nb_lock(a) (TryAcquireSRWLockExclusive(&a TSRMLS_CC) == 0 ? 1 : 0);
++# endif
++#elif defined(APC_SRWLOCK_KERNEL) && defined(PHP_WIN32)
++# define APC_LOCK_TYPE "Windows Slim RWLOCK (kernel)"
++# define RDLOCK_AVAILABLE 1
++# define NONBLOCKING_LOCK_AVAILABLE 0
++# define apc_lck_t apc_windows_cs_rwlock_t
++# define apc_lck_create(a,b,c,d) apc_windows_cs_create((apc_windows_cs_rwlock_t*)&(d) TSRMLS_CC)
++# define apc_lck_destroy(a) apc_windows_cs_destroy(&a);
++# define apc_lck_lock(a) apc_windows_cs_lock(&a TSRMLS_CC)
++# define apc_lck_rdlock(a) apc_windows_cs_rdlock(&a TSRMLS_CC)
++# define apc_lck_unlock(a) apc_windows_cs_unlock_wr(&a TSRMLS_CC)
++# define apc_lck_rdunlock(a) apc_windows_cs_unlock_rd(&a TSRMLS_CC)
+#else
-+#define NONBLOCKING_LOCK_AVAILABLE 1
-+#endif
-+#define apc_lck_t int
-+#define apc_lck_create(a,b,c,d) d=apc_fcntl_create((a) TSRMLS_CC)
-+#define apc_lck_destroy(a) apc_fcntl_destroy(a)
-+#define apc_lck_lock(a) apc_fcntl_lock(a TSRMLS_CC)
-+#define apc_lck_nb_lock(a) apc_fcntl_nonblocking_lock(a TSRMLS_CC)
-+#define apc_lck_rdlock(a) apc_fcntl_rdlock(a TSRMLS_CC)
-+#define apc_lck_unlock(a) apc_fcntl_unlock(a TSRMLS_CC)
++# define APC_LOCK_TYPE "File Locks"
++# ifdef HAVE_ATOMIC_OPERATIONS
++# define RDLOCK_AVAILABLE 1
++# endif
++# ifdef PHP_WIN32
++# define NONBLOCKING_LOCK_AVAILABLE 0
++# else
++# define NONBLOCKING_LOCK_AVAILABLE 1
++# endif
++# define apc_lck_t int
++# define apc_lck_create(a,b,c,d) d=apc_fcntl_create((a) TSRMLS_CC)
++# define apc_lck_destroy(a) apc_fcntl_destroy(a)
++# define apc_lck_lock(a) apc_fcntl_lock(a TSRMLS_CC)
++# define apc_lck_nb_lock(a) apc_fcntl_nonblocking_lock(a TSRMLS_CC)
++# define apc_lck_rdlock(a) apc_fcntl_rdlock(a TSRMLS_CC)
++# define apc_lck_unlock(a) apc_fcntl_unlock(a TSRMLS_CC)
++# define apc_lck_rdunlock(a) apc_fcntl_unlock(a TSRMLS_CC)
+#endif
+
+#endif
---- /dev/null
-+++ b/ext/apc/apc_main.c
-@@ -0,0 +1,969 @@
+diff -Naur a/ext/apc/apc_main.c b/ext/apc/apc_main.c
+--- a/ext/apc/apc_main.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_main.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,1030 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_main.c 304994 2010-10-30 20:33:46Z gopalv $ */
++/* $Id: apc_main.c 324326 2012-03-18 13:19:50Z pajoye $ */
+
+#include "apc_php.h"
+#include "apc_main.h"
+#include "ext/standard/php_var.h"
+#include "ext/standard/md5.h"
+
++#define APC_MAX_SERIALIZERS 16
++
+/* {{{ module variables */
+
+/* pointer to the original Zend engine compile_file function */
+typedef zend_op_array* (zend_compile_t)(zend_file_handle*, int TSRMLS_DC);
+static zend_compile_t *old_compile_file;
++static apc_serializer_t apc_serializers[APC_MAX_SERIALIZERS] = {{0,}};
+
+/* }}} */
+
+/* }}} */
+
+/* {{{ apc_compile_cache_entry */
-+zend_bool apc_compile_cache_entry(apc_cache_key_t key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array, apc_cache_entry_t** cache_entry TSRMLS_DC) {
++zend_bool apc_compile_cache_entry(apc_cache_key_t *key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array, apc_cache_entry_t** cache_entry TSRMLS_DC) {
+ int num_functions, num_classes;
+ apc_function_t* alloc_functions;
+ zend_op_array* alloc_op_array;
+ while((n = php_stream_read(stream, (char*)buf, sizeof(buf))) > 0) {
+ PHP_MD5Update(&context, buf, n);
+ }
-+ PHP_MD5Final(key.md5, &context);
++ PHP_MD5Final(key->md5, &context);
+ php_stream_close(stream);
+ if(n<0) {
+ apc_warning("Error while reading '%s' for md5 generation." TSRMLS_CC, filename);
+ }
+
+ path = h->opened_path;
++ if(!path && key->type == APC_CACHE_KEY_FPFILE) path = (char*)key->data.fpfile.fullpath;
+ if(!path) path=h->filename;
+
+ apc_debug("2. h->opened_path=[%s] h->filename=[%s]\n" TSRMLS_CC, h->opened_path?h->opened_path:"null",h->filename);
+ time_t t;
+ apc_context_t ctxt = {0,};
+ int bailout=0;
-+ const char* filename = NULL;
++ const char* filename = NULL;
+
+ if (!APCG(enabled) || apc_cache_busy(apc_cache)) {
+ return old_compile_file(h, type TSRMLS_CC);
+#endif
+
+ zend_try {
-+ if (apc_compile_cache_entry(key, h, type, t, &op_array, &cache_entry TSRMLS_CC) == SUCCESS) {
++ if (apc_compile_cache_entry(&key, h, type, t, &op_array, &cache_entry TSRMLS_CC) == SUCCESS) {
+ ctxt.pool = cache_entry->pool;
+ ctxt.copy = APC_COPY_IN_OPCODE;
+ if (apc_cache_insert(apc_cache, key, cache_entry, &ctxt, t TSRMLS_CC) != 1) {
+}
+/* }}} */
+
++/* {{{ apc_serializer hooks */
++static int _apc_register_serializer(const char* name, apc_serialize_t serialize,
++ apc_unserialize_t unserialize,
++ void *config TSRMLS_DC)
++{
++ int i;
++ apc_serializer_t *serializer;
++
++ for(i = 0; i < APC_MAX_SERIALIZERS; i++) {
++ serializer = &apc_serializers[i];
++ if(!serializer->name) {
++ /* empty entry */
++ serializer->name = name; /* assumed to be const */
++ serializer->serialize = serialize;
++ serializer->unserialize = unserialize;
++ serializer->config = config;
++ apc_serializers[i+1].name = NULL;
++ return 1;
++ }
++ }
++
++ return 0;
++}
++
++apc_serializer_t* apc_find_serializer(const char* name TSRMLS_DC)
++{
++ int i;
++ apc_serializer_t *serializer;
++
++ for(i = 0; i < APC_MAX_SERIALIZERS; i++) {
++ serializer = &apc_serializers[i];
++ if(serializer->name && (strcmp(serializer->name, name) == 0)) {
++ return serializer;
++ }
++ }
++ return NULL;
++}
++
++apc_serializer_t* apc_get_serializers(TSRMLS_D)
++{
++ return &(apc_serializers[0]);
++}
++/* }}} */
++
+/* {{{ module init and shutdown */
+
+int apc_module_init(int module_number TSRMLS_DC)
+ zend_compile_file = my_compile_file;
+ REGISTER_LONG_CONSTANT("\000apc_magic", (long)&set_compile_hook, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("\000apc_compile_file", (long)&my_compile_file, CONST_PERSISTENT | CONST_CS);
++ REGISTER_LONG_CONSTANT(APC_SERIALIZER_CONSTANT, (long)&_apc_register_serializer, CONST_PERSISTENT | CONST_CS);
++
++ /* test out the constant function pointer */
++ apc_register_serializer("php", APC_SERIALIZER_NAME(php), APC_UNSERIALIZER_NAME(php), NULL TSRMLS_CC);
++
++ assert(apc_serializers[0].name != NULL);
+
+ apc_pool_init();
+
+#endif
+
+#ifdef ZEND_ENGINE_2_4
++#ifndef ZTS
+ apc_interned_strings_init(TSRMLS_C);
+#endif
++#endif
+
+ APCG(initialized) = 1;
+ return 0;
+ apc_cache_release(apc_cache, cache_entry TSRMLS_CC);
+ }
+
-+ apc_cache_destroy(apc_cache TSRMLS_CC);
-+ apc_cache_destroy(apc_user_cache TSRMLS_CC);
-+ apc_sma_cleanup(TSRMLS_C);
-+
+#ifdef ZEND_ENGINE_2_4
++#ifndef ZTS
+ apc_interned_strings_shutdown(TSRMLS_C);
+#endif
++#endif
++
++ apc_cache_destroy(apc_cache TSRMLS_CC);
++ apc_cache_destroy(apc_user_cache TSRMLS_CC);
++ apc_sma_cleanup(TSRMLS_C);
+
+ APCG(initialized) = 0;
+ return 0;
+ APCG(compiled_filters) = apc_regex_compile_array(APCG(filters) TSRMLS_CC);
+ }
+
++ if (!APCG(serializer) && APCG(serializer_name)) {
++ /* Avoid race conditions between MINIT of apc and serializer exts like igbinary */
++ APCG(serializer) = apc_find_serializer(APCG(serializer_name) TSRMLS_CC);
++ }
++
+#if APC_HAVE_LOOKUP_HOOKS
+ if(APCG(lazy_functions)) {
+ APCG(lazy_function_table) = emalloc(sizeof(HashTable));
+
+int apc_request_shutdown(TSRMLS_D)
+{
-+
+#if APC_HAVE_LOOKUP_HOOKS
+ if(APCG(lazy_class_table)) {
+ zend_hash_destroy(APCG(lazy_class_table));
+#ifdef APC_FILEHITS
+ zval_ptr_dtor(&APCG(filehits));
+#endif
-+
+ return 0;
+}
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_main.h
-@@ -0,0 +1,74 @@
+diff -Naur a/ext/apc/apc_main.h b/ext/apc/apc_main.h
+--- a/ext/apc/apc_main.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_main.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,88 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_main.h 300979 2010-07-04 10:15:05Z kalle $ */
++/* $Id: apc_main.h 308594 2011-02-23 12:35:33Z gopalv $ */
+
+#ifndef APC_MAIN_H
+#define APC_MAIN_H
+
+#include "apc_pool.h"
++#include "apc_serializer.h"
+
+/*
+ * This module provides the primary interface between PHP and APC.
+ unsigned int force_update:1;
+} apc_context_t;
+
++/* {{{ struct apc_serializer_t */
++typedef struct apc_serializer_t apc_serializer_t;
++struct apc_serializer_t {
++ const char *name;
++ apc_serialize_t serialize;
++ apc_unserialize_t unserialize;
++ void *config;
++};
++/* }}} */
++
++apc_serializer_t* apc_get_serializers(TSRMLS_D);
++apc_serializer_t* apc_find_serializer(const char* name TSRMLS_DC);
++
+#endif
+
+/*
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_mmap.c
-@@ -0,0 +1,175 @@
+diff -Naur a/ext/apc/apc_mmap.c b/ext/apc/apc_mmap.c
+--- a/ext/apc/apc_mmap.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_mmap.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,177 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_mmap.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_mmap.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc.h"
+#include "apc_mmap.h"
+ }
+
+ segment.shmaddr = (void *)mmap(NULL, size, PROT_READ | PROT_WRITE, flags, fd, 0);
++ segment.size = size;
+
+#ifdef APC_MEMPROTECT
+ if(remap) {
+error:
+
+ segment.shmaddr = (void*)-1;
++ segment.size = 0;
+#ifdef APC_MEMPROTECT
+ segment.roaddr = NULL;
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_mmap.h
+diff -Naur a/ext/apc/apc_mmap.h b/ext/apc/apc_mmap.h
+--- a/ext/apc/apc_mmap.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_mmap.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,54 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_mmap.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_mmap.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_MMAP_H
+#define APC_MMAP_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc.php
+diff -Naur a/ext/apc/apc.php b/ext/apc/apc.php
+--- a/ext/apc/apc.php 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc.php 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,1362 @@
+<?php
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+$VERSION='$Id: apc.php 304410 2010-10-15 11:21:07Z gopalv $';
++$VERSION='$Id: apc.php 325483 2012-05-01 00:34:04Z rasmus $';
+
+////////// READ OPTIONAL CONFIGURATION FILE ////////////
+if (file_exists("apc.conf.php")) include("apc.conf.php");
+ 'SORT1' => '/^[AHSMCDTZ]$/', // first sort key
+ 'SORT2' => '/^[DA]$/', // second sort key
+ 'AGGR' => '/^\d+$/', // aggregation by dir level
-+ 'SEARCH' => '~^[a-zA-Z0-1/_.-]*$~' // aggregation by dir level
++ 'SEARCH' => '~^[a-zA-Z0-9/_.-]*$~' // aggregation by dir level
+);
+
+// default cache mode
+<!-- <?php echo "\nBased on APCGUI By R.Becker\n$VERSION\n"?> -->
+</body>
+</html>
---- /dev/null
-+++ b/ext/apc/apc_php.h
-@@ -0,0 +1,77 @@
+diff -Naur a/ext/apc/apc_php.h b/ext/apc/apc_php.h
+--- a/ext/apc/apc_php.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_php.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,81 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_php.h 300979 2010-07-04 10:15:05Z kalle $ */
++/* $Id: apc_php.h 313808 2011-07-28 06:17:10Z gopalv $ */
+
+#ifndef APC_PHP_H
+#define APC_PHP_H
+#include "zend_vm.h"
+#endif
+
++#ifndef IS_CONSTANT_TYPE_MASK
++#define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX)
++#endif
++
+#include "rfc1867.h"
+
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_php_pcre.h
+diff -Naur a/ext/apc/apc_php_pcre.h b/ext/apc/apc_php_pcre.h
+--- a/ext/apc/apc_php_pcre.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_php_pcre.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,98 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC/PHP Version 5 |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 1997-2010 The PHP Group |
++ | Copyright (c) 1997-2011 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 |
+ +----------------------------------------------------------------------+
+ */
+
-+/* $Id: apc_php_pcre.h 300979 2010-07-04 10:15:05Z kalle $ */
++/* $Id: apc_php_pcre.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef PHP_PCRE_H
+#define PHP_PCRE_H
+#define phpext_pcre_ptr pcre_module_ptr
+
+#endif /* PHP_PCRE_H */
---- /dev/null
-+++ b/ext/apc/apc_pool.c
-@@ -0,0 +1,488 @@
+diff -Naur a/ext/apc/apc_pool.c b/ext/apc/apc_pool.c
+--- a/ext/apc/apc_pool.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_pool.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,507 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_pool.c 301964 2010-08-07 03:34:18Z rasmus $ */
++/* $Id: apc_pool.c 307555 2011-01-18 07:17:21Z gopalv $ */
+
+
+#include "apc_pool.h"
+ size_t dsize;
+ void *owner;
+
++ unsigned long count;
++
+ pool_block *head;
+ pool_block first;
+};
+
+ rpool->parent.size += realsize;
+
++ rpool->count++;
++
+ return entry;
+}
+/* }}} */
+ size_t redsize = 0;
+ size_t *sizeinfo= NULL;
+ pool_block *entry = NULL;
++ unsigned long i;
+
+ if(APC_POOL_HAS_REDZONES(pool)) {
+ redsize = REDZONE_SIZE(size); /* redsize might be re-using word size padding */
+ realsize += ALIGNWORD(sizeof(size_t));
+ }
+
-+
-+ for(entry = rpool->head; entry != NULL; entry = entry->next) {
++ /* minimize look-back, a value of 8 seems to give similar fill-ratios (+2%)
++ * as looping through the entire list. And much faster in allocations. */
++ for(entry = rpool->head, i = 0; entry != NULL && (i < 8); entry = entry->next, i++) {
+ if(entry->avail >= realsize) {
+ goto found;
+ }
+ }
+
++ /* upgrade the pool type to reduce overhead */
++ if(rpool->count > 4 && rpool->dsize < 4096) {
++ rpool->dsize = 4096;
++ } else if(rpool->count > 8 && rpool->dsize < 8192) {
++ rpool->dsize = 8192;
++ }
++
+ poolsize = ALIGNSIZE(realsize, rpool->dsize);
+
+ entry = create_pool_block(rpool, poolsize TSRMLS_CC);
+ * Checking integrity at runtime, does an
+ * overwrite check only when the sizeinfo
+ * is set.
++ *
++ * Marked as used in gcc, so that this function
++ * is accessible from gdb, eventhough it is never
++ * used in code in non-debug builds.
+ */
-+static int apc_realpool_check_integrity(apc_realpool *rpool)
++static APC_USED int apc_realpool_check_integrity(apc_realpool *rpool)
+{
+ apc_pool *pool = &(rpool->parent);
+ pool_block *entry;
+
+ if(!APC_POOL_HAS_REDZONES(pool) ||
+ !APC_POOL_HAS_SIZEINFO(pool)) {
++ (void)pool; /* remove unused warning */
+ return 1;
+ }
+
+
+ rpool->dsize = dsize;
+ rpool->head = NULL;
++ rpool->count = 0;
+
+ INIT_POOL_BLOCK(rpool, &(rpool->first), dsize);
+
+/* }}} */
+
+/* {{{ apc_pstrdup */
-+void* apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC)
++void* APC_ALLOC apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC)
+{
+ return s != NULL ? apc_pmemcpy(s, (strlen(s) + 1), pool TSRMLS_CC) : NULL;
+}
+/* }}} */
+
+/* {{{ apc_pmemcpy */
-+void* apc_pmemcpy(const void* p, size_t n, apc_pool* pool TSRMLS_DC)
++void* APC_ALLOC apc_pmemcpy(const void* p, size_t n, apc_pool* pool TSRMLS_DC)
+{
+ void* q;
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_pool.h
+diff -Naur a/ext/apc/apc_pool.h b/ext/apc/apc_pool.h
+--- a/ext/apc/apc_pool.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_pool.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,114 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_pool.h 301682 2010-07-29 11:09:00Z gopalv $ */
++/* $Id: apc_pool.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_POOL_H
+#define APC_POOL_H
+extern void* apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC);
+
+#endif
---- /dev/null
-+++ b/ext/apc/apc_pthreadmutex.c
+diff -Naur a/ext/apc/apc_pthreadmutex.c b/ext/apc/apc_pthreadmutex.c
+--- a/ext/apc/apc_pthreadmutex.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_pthreadmutex.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,111 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_pthreadmutex.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_pthreadmutex.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc_pthreadmutex.h"
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_pthreadmutex.h
+diff -Naur a/ext/apc/apc_pthreadmutex.h b/ext/apc/apc_pthreadmutex.h
+--- a/ext/apc/apc_pthreadmutex.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_pthreadmutex.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,48 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_pthreadmutex.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_pthreadmutex.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_PTHREADMUTEX_H
+#define APC_PTHREADMUTEX_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_rfc1867.c
-@@ -0,0 +1,232 @@
+diff -Naur a/ext/apc/apc_pthreadrwlock.c b/ext/apc/apc_pthreadrwlock.c
+--- a/ext/apc/apc_pthreadrwlock.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_pthreadrwlock.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,120 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2011 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 |
++ | available through the world-wide-web at the following url: |
++ | http://www.php.net/license/3_01.txt |
++ | If you did not receive a copy of the PHP license and are unable to |
++ | obtain it through the world-wide-web, please send a note to |
++ | license@php.net so we can mail you a copy immediately. |
++ +----------------------------------------------------------------------+
++ | Authors: Gopal V <gopalv@php.net> |
++ +----------------------------------------------------------------------+
++
++ */
++
++/* $Id: $ */
++
++#include "apc_pthreadrwlock.h"
++
++#ifdef APC_PTHREADRW_LOCKS
++
++pthread_rwlock_t *apc_pthreadrwlock_create(pthread_rwlock_t *lock TSRMLS_DC)
++{
++ int result;
++ pthread_rwlockattr_t attr;
++
++ result = pthread_rwlockattr_init(&attr);
++ if(result == ENOMEM) {
++ apc_error("pthread rwlock error: Insufficient memory exists to create the rwlock attribute object." TSRMLS_CC);
++ } else if(result == EINVAL) {
++ apc_error("pthread rwlock error: attr does not point to writeable memory." TSRMLS_CC);
++ } else if(result == EFAULT) {
++ apc_error("pthread rwlock error: attr is an invalid pointer." TSRMLS_CC);
++ }
++
++#ifdef __USE_UNIX98
++ pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
++#endif
++
++ result = pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
++ if(result == EINVAL) {
++ apc_error("pthread rwlock error: attr is not an initialized rwlock attribute object, or pshared is not a valid process-shared state setting." TSRMLS_CC);
++ } else if(result == EFAULT) {
++ apc_error("pthread rwlock error: attr is an invalid pointer." TSRMLS_CC);
++ } else if(result == ENOTSUP) {
++ apc_error("pthread rwlock error: pshared was set to PTHREAD_PROCESS_SHARED." TSRMLS_CC);
++ }
++
++ if(pthread_rwlock_init(lock, &attr)) {
++ apc_error("unable to initialize pthread rwlock" TSRMLS_CC);
++ }
++
++ pthread_rwlockattr_destroy(&attr);
++
++ return lock;
++}
++
++void apc_pthreadrwlock_destroy(pthread_rwlock_t *lock)
++{
++ return; /* we don't actually destroy the rwlock, as it would destroy it for all processes */
++}
++
++void apc_pthreadrwlock_lock(pthread_rwlock_t *lock TSRMLS_DC)
++{
++ int result;
++ result = pthread_rwlock_wrlock(lock);
++ if(result == EINVAL) {
++ apc_error("unable to obtain pthread lock (EINVAL)" TSRMLS_CC);
++ } else if(result == EDEADLK) {
++ apc_error("unable to obtain pthread lock (EDEADLK)" TSRMLS_CC);
++ }
++}
++
++void apc_pthreadrwlock_rdlock(pthread_rwlock_t *lock TSRMLS_DC)
++{
++ int result;
++ result = pthread_rwlock_rdlock(lock);
++ if(result == EINVAL) {
++ apc_error("unable to obtain pthread lock (EINVAL)" TSRMLS_CC);
++ } else if(result == EDEADLK) {
++ apc_error("unable to obtain pthread lock (EDEADLK)" TSRMLS_CC);
++ }
++}
++
++void apc_pthreadrwlock_unlock(pthread_rwlock_t *lock TSRMLS_DC)
++{
++ if(pthread_rwlock_unlock(lock)) {
++ apc_error("unable to unlock pthread lock" TSRMLS_CC);
++ }
++}
++
++zend_bool apc_pthreadrwlock_nonblocking_lock(pthread_rwlock_t *lock TSRMLS_DC)
++{
++ int rval;
++ rval = pthread_rwlock_trywrlock(lock);
++ if(rval == EBUSY) { /* Lock is already held */
++ return 0;
++ } else if(rval == 0) { /* Obtained lock */
++ return 1;
++ } else { /* Other error */
++ apc_error("unable to obtain pthread trylock" TSRMLS_CC);
++ return 0;
++ }
++}
++
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
++ * vim<600: expandtab sw=4 ts=4 sts=4
++ */
+diff -Naur a/ext/apc/apc_pthreadrwlock.h b/ext/apc/apc_pthreadrwlock.h
+--- a/ext/apc/apc_pthreadrwlock.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_pthreadrwlock.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,49 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
++ | available through the world-wide-web at the following url: |
++ | http://www.php.net/license/3_01.txt |
++ | If you did not receive a copy of the PHP license and are unable to |
++ | obtain it through the world-wide-web, please send a note to |
++ | license@php.net so we can mail you a copy immediately. |
++ +----------------------------------------------------------------------+
++ | Authors: Gopal V <gopalv@php.net> |
++ +----------------------------------------------------------------------+
++
++ */
++
++/* $Id: apc_pthreadrwlock.h 302175 2010-08-13 06:20:28Z kalle $ */
++
++#ifndef APC_PTHREADRWLOCK_H
++#define APC_PTHREADRWLOCK_H
++
++#include "apc.h"
++
++#ifdef APC_PTHREADRW_LOCKS
++
++#include <pthread.h>
++
++pthread_rwlock_t *apc_pthreadrwlock_create(pthread_rwlock_t *lock TSRMLS_DC);
++void apc_pthreadrwlock_destroy(pthread_rwlock_t *lock);
++void apc_pthreadrwlock_lock(pthread_rwlock_t *lock TSRMLS_DC);
++void apc_pthreadrwlock_rdlock(pthread_rwlock_t *lock TSRMLS_DC);
++void apc_pthreadrwlock_unlock(pthread_rwlock_t *lock TSRMLS_DC);
++zend_bool apc_pthreadrwlock_nonblocking_lock(pthread_rwlock_t *lock TSRMLS_DC);
++
++#endif
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
++ * vim<600: expandtab sw=4 ts=4 sts=4
++ */
+diff -Naur a/ext/apc/apc_rfc1867.c b/ext/apc/apc_rfc1867.c
+--- a/ext/apc/apc_rfc1867.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_rfc1867.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,236 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_rfc1867.c 305798 2010-11-28 13:43:20Z gopalv $*/
++/* $Id: apc_rfc1867.c 309694 2011-03-25 18:47:38Z rasmus $*/
+
+#include "apc.h"
+#include "apc_globals.h"
+ multipart_event_file_end *data = (multipart_event_file_end *) event_data;
+ RFC1867_DATA(bytes_processed) = data->post_bytes_processed;
+ RFC1867_DATA(cancel_upload) = data->cancel_upload;
-+ RFC1867_DATA(temp_filename) = data->temp_filename;
++ if(data->temp_filename) {
++ RFC1867_DATA(temp_filename) = data->temp_filename;
++ } else {
++ RFC1867_DATA(temp_filename) = "";
++ }
+ ALLOC_INIT_ZVAL(track);
+ array_init(track);
+ add_assoc_long(track, "total", RFC1867_DATA(content_length));
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_sem.c
+diff -Naur a/ext/apc/apc_sem.c b/ext/apc/apc_sem.c
+--- a/ext/apc/apc_sem.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_sem.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,192 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_sem.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_sem.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc.h"
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_sem.h
+diff -Naur a/ext/apc/apc_sem.h b/ext/apc/apc_sem.h
+--- a/ext/apc/apc_sem.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_sem.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,52 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_sem.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_sem.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_SEM_H
+#define APC_SEM_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_shm.c
-@@ -0,0 +1,114 @@
+diff -Naur a/ext/apc/apc_serializer.h b/ext/apc/apc_serializer.h
+--- a/ext/apc/apc_serializer.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_serializer.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,84 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
++ | available through the world-wide-web at the following url: |
++ | http://www.php.net/license/3_01.txt. |
++ | If you did not receive a copy of the PHP license and are unable to |
++ | obtain it through the world-wide-web, please send a note to |
++ | license@php.net so we can mail you a copy immediately. |
++ +----------------------------------------------------------------------+
++ | Authors: Gopal Vijayaraghavan <gopalv@php.net> |
++ +----------------------------------------------------------------------+
++
++ */
++
++/* $Id: $ */
++
++#ifndef APC_SERIALIZER_H
++#define APC_SERIALIZER_H
++
++/* this is a shipped .h file, do not include any other header in this file */
++#define APC_SERIALIZER_NAME(module) module##_apc_serializer
++#define APC_UNSERIALIZER_NAME(module) module##_apc_unserializer
++
++#define APC_SERIALIZER_ARGS unsigned char **buf, size_t *buf_len, const zval *value, void *config TSRMLS_DC
++#define APC_UNSERIALIZER_ARGS zval **value, unsigned char *buf, size_t buf_len, void *config TSRMLS_DC
++
++typedef int (*apc_serialize_t)(APC_SERIALIZER_ARGS);
++typedef int (*apc_unserialize_t)(APC_UNSERIALIZER_ARGS);
++
++typedef int (*apc_register_serializer_t)(const char* name,
++ apc_serialize_t serialize,
++ apc_unserialize_t unserialize,
++ void *config TSRMLS_DC);
++
++/*
++ * ABI version for constant hooks. Increment this any time you make any changes
++ * to any function in this file.
++ */
++#define APC_SERIALIZER_ABI "0"
++#define APC_SERIALIZER_CONSTANT "\000apc_register_serializer-" APC_SERIALIZER_ABI
++
++#if !defined(APC_UNUSED)
++# if defined(__GNUC__)
++# define APC_UNUSED __attribute__((unused))
++# else
++# define APC_UNUSED
++# endif
++#endif
++
++static APC_UNUSED int apc_register_serializer(const char* name,
++ apc_serialize_t serialize,
++ apc_unserialize_t unserialize,
++ void *config TSRMLS_DC)
++{
++ zval apc_magic_constant;
++ int retval = 0;
++
++ /* zend_get_constant will return 1 on success, otherwise apc_magic_constant wouldn't be touched at all */
++ if (zend_get_constant(APC_SERIALIZER_CONSTANT, sizeof(APC_SERIALIZER_CONSTANT)-1, &apc_magic_constant TSRMLS_CC)) {
++ apc_register_serializer_t register_func = (apc_register_serializer_t)(Z_LVAL(apc_magic_constant));
++ if(register_func) {
++ retval = register_func(name, serialize, unserialize, NULL TSRMLS_CC);
++ }
++ zval_dtor(&apc_magic_constant);
++ }
++
++ return retval;
++}
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
++ * vim<600: expandtab sw=4 ts=4 sts=4
++ */
+diff -Naur a/ext/apc/apc_shm.c b/ext/apc/apc_shm.c
+--- a/ext/apc/apc_shm.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_shm.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,116 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_shm.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_shm.c 307259 2011-01-08 12:05:24Z gopalv $ */
+
+#include "apc_shm.h"
+#include "apc.h"
+ shmctl(shmid, IPC_RMID, 0);
+}
+
-+apc_segment_t apc_shm_attach(int shmid TSRMLS_DC)
++apc_segment_t apc_shm_attach(int shmid, size_t size TSRMLS_DC)
+{
+ apc_segment_t segment; /* shm segment */
+
+
+#endif
+
++ segment.size = size;
++
+ /*
+ * We set the shmid for removal immediately after attaching to it. The
+ * segment won't disappear until all processes have detached from it.
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_shm.h
+diff -Naur a/ext/apc/apc_shm.h b/ext/apc/apc_shm.h
+--- a/ext/apc/apc_shm.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_shm.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,56 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_shm.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_shm.h 307259 2011-01-08 12:05:24Z gopalv $ */
+
+#ifndef APC_SHM_H
+#define APC_SHM_H
+
+extern int apc_shm_create(int proj, size_t size TSRMLS_DC);
+extern void apc_shm_destroy(int shmid);
-+extern apc_segment_t apc_shm_attach(int shmid TSRMLS_DC);
++extern apc_segment_t apc_shm_attach(int shmid, size_t size TSRMLS_DC);
+extern void apc_shm_detach(apc_segment_t* segment TSRMLS_DC);
+
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_signal.c
+diff -Naur a/ext/apc/apc_signal.c b/ext/apc/apc_signal.c
+--- a/ext/apc/apc_signal.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_signal.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,197 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+ All other licensing and usage conditions are those of the PHP Group.
+ */
+
-+ /* $Id: apc_signal.c 302175 2010-08-13 06:20:28Z kalle $ */
++ /* $Id: apc_signal.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+ /* Allows apc to install signal handlers and maintain signalling
+ to already registered handlers. Registers all signals that
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_signal.h
+diff -Naur a/ext/apc/apc_signal.h b/ext/apc/apc_signal.h
+--- a/ext/apc/apc_signal.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_signal.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,51 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_signal.h 300986 2010-07-04 14:41:33Z felipe $ */
++/* $Id: apc_signal.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_SIGNAL_H
+#define APC_SIGNAL_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_sma.c
+diff -Naur a/ext/apc/apc_sma.c b/ext/apc/apc_sma.c
+--- a/ext/apc/apc_sma.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_sma.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,765 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_sma.c 305260 2010-11-10 19:23:02Z gopalv $ */
++/* $Id: apc_sma.c 309489 2011-03-21 00:00:54Z pajoye $ */
+
+#include "apc_sma.h"
+#include "apc.h"
+#endif
+
+/* {{{ sma_allocate: tries to allocate at least size bytes in a segment */
-+static size_t sma_allocate(sma_header_t* header, size_t size, size_t fragment, size_t *allocated)
++static APC_HOTSPOT size_t sma_allocate(sma_header_t* header, size_t size, size_t fragment, size_t *allocated)
+{
+ void* shmaddr; /* header of shared memory segment */
+ block_t* prv; /* block prior to working block */
+/* }}} */
+
+/* {{{ sma_deallocate: deallocates the block at the given offset */
-+static size_t sma_deallocate(void* shmaddr, size_t offset)
++static APC_HOTSPOT size_t sma_deallocate(void* shmaddr, size_t offset)
+{
+ sma_header_t* header; /* header of shared memory segment */
+ block_t* cur; /* the new block to insert */
+ sma_segments[i] = apc_mmap(mmap_file_mask, sma_segsize TSRMLS_CC);
+ if(sma_numseg != 1) memcpy(&mmap_file_mask[strlen(mmap_file_mask)-6], "XXXXXX", 6);
+#else
-+ sma_segments[i] = apc_shm_attach(apc_shm_create(i, sma_segsize TSRMLS_CC) TSRMLS_CC);
++ sma_segments[i] = apc_shm_attach(apc_shm_create(i, sma_segsize TSRMLS_CC), sma_segsize TSRMLS_CC);
+#endif
+
+ sma_segments[i].size = sma_segsize;
+ /* I've tried being nice, but now you're just asking for it */
+ if(!nuked) {
+ apc_cache->expunge_cb(apc_cache, (n+fragment) TSRMLS_CC);
-+ apc_user_cache->expunge_cb(apc_cache, (n+fragment) TSRMLS_CC);
++ apc_user_cache->expunge_cb(apc_user_cache, (n+fragment) TSRMLS_CC);
+ nuked = 1;
+ goto restart;
+ }
+#endif
+
+ }
-+ UNLOCK(SMA_LCK(i));
++ RDUNLOCK(SMA_LCK(i));
+ }
+
+ return info;
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_sma.h
+diff -Naur a/ext/apc/apc_sma.h b/ext/apc/apc_sma.h
+--- a/ext/apc/apc_sma.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_sma.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,103 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_sma.h 303274 2010-09-11 14:31:32Z iliaa $ */
++/* $Id: apc_sma.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_SMA_H
+#define APC_SMA_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_spin.c
+diff -Naur a/ext/apc/apc_spin.c b/ext/apc/apc_spin.c
+--- a/ext/apc/apc_spin.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_spin.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,66 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_spin.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_spin.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc_spin.h"
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_spin.h
+diff -Naur a/ext/apc/apc_spin.h b/ext/apc/apc_spin.h
+--- a/ext/apc/apc_spin.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_spin.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,48 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_spin.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_spin.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_SPIN_H
+#define APC_SPIN_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_stack.c
+diff -Naur a/ext/apc/apc_stack.c b/ext/apc/apc_stack.c
+--- a/ext/apc/apc_stack.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_stack.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,106 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_stack.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_stack.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc.h"
+#include "apc_stack.h"
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_stack.h
+diff -Naur a/ext/apc/apc_stack.h b/ext/apc/apc_stack.h
+--- a/ext/apc/apc_stack.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_stack.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,58 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_stack.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: apc_stack.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+#ifndef APC_STACK_H
+#define APC_STACK_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_string.c
-@@ -0,0 +1,247 @@
+diff -Naur a/ext/apc/apc_string.c b/ext/apc/apc_string.c
+--- a/ext/apc/apc_string.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_string.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,261 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: $ */
++/* $Id: apc_string.c 326089 2012-06-11 04:29:57Z rasmus $ */
+
+#include "apc.h"
+#include "apc_globals.h"
+
+#ifdef ZEND_ENGINE_2_4
+
++#ifndef ZTS
+typedef struct _apc_interned_strings_data_t {
+ char *interned_strings_start;
+ char *interned_strings_end;
+
+static char *old_interned_strings_start;
+static char *old_interned_strings_end;
-+static char *(*old_new_interned_string)(char *str, int len, int free_src TSRMLS_DC);
++static const char *(*old_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
+static void (*old_interned_strings_snapshot)(TSRMLS_D);
+static void (*old_interned_strings_restore)(TSRMLS_D);
+
-+static char *apc_dummy_new_interned_string_for_php(char *str, int len, int free_src TSRMLS_DC)
++static const char *apc_dummy_new_interned_string_for_php(const char *str, int len, int free_src TSRMLS_DC)
+{
+ return str;
+}
+static void apc_dummy_interned_strings_restore_for_php(TSRMLS_D)
+{
+}
++#endif
+
-+char *apc_new_interned_string(char *arKey, int nKeyLength TSRMLS_DC)
++const char *apc_new_interned_string(const char *arKey, int nKeyLength TSRMLS_DC)
+{
++#ifndef ZTS
+ ulong h;
+ uint nIndex;
+ Bucket *p;
+ p = p->pNext;
+ }
+
-+ if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
++ if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1) >=
+ APCSG(interned_strings_end)) {
+ /* no memory */
+ return NULL;
+ }
+
+ p = (Bucket *) APCSG(interned_strings_top);
-+ APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength);
++ APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1);
+
+ p->arKey = (char*)(p+1);
+ memcpy(p->arKey, arKey, nKeyLength);
++ ((char *)p->arKey)[nKeyLength] = '\0';
+ p->nKeyLength = nKeyLength;
+ p->h = h;
+ p->pData = &p->pDataPtr;
+ APCSG(interned_strings).nNumOfElements++;
+
+ return p->arKey;
++#else
++ return zend_new_interned_string(arKey, nKeyLength, 0 TSRMLS_CC);
++#endif
+}
+
++#ifndef ZTS
+static void apc_copy_internal_strings(TSRMLS_D)
+{
+ Bucket *p, *q;
+ p->arKey = apc_new_interned_string(p->arKey, p->nKeyLength TSRMLS_CC);
+ }
+
++ if (ce->name) {
++ ce->name = apc_new_interned_string(ce->name, ce->name_length+1 TSRMLS_CC);
++ }
++
+ q = ce->properties_info.pListHead;
+ while (q) {
+ zend_property_info *info = (zend_property_info*)(q->pData);
+ int count = APCG(shm_strings_buffer) / (sizeof(Bucket) + sizeof(Bucket*) * 2);
+
+ apc_interned_strings_data = (apc_interned_strings_data_t*) apc_sma_malloc(APCG(shm_strings_buffer) TSRMLS_CC);
++ memset((void *)apc_interned_strings_data, 0, APCG(shm_strings_buffer));
+
+ CREATE_LOCK(APCSG(lock));
+
+ old_interned_strings_snapshot = zend_interned_strings_snapshot;
+ old_interned_strings_restore = zend_interned_strings_restore;
+
-+ CG(interned_strings_start) = APCSG(interned_strings_start);
-+ CG(interned_strings_end) = APCSG(interned_strings_end);
-+ zend_new_interned_string = apc_dummy_new_interned_string_for_php;
-+ zend_interned_strings_snapshot = apc_dummy_interned_strings_snapshot_for_php;
-+ zend_interned_strings_restore = apc_dummy_interned_strings_restore_for_php;
++ CG(interned_strings_start) = APCSG(interned_strings_start);
++ CG(interned_strings_end) = APCSG(interned_strings_end);
++ zend_new_interned_string = apc_dummy_new_interned_string_for_php;
++ zend_interned_strings_snapshot = apc_dummy_interned_strings_snapshot_for_php;
++ zend_interned_strings_restore = apc_dummy_interned_strings_restore_for_php;
++
++ apc_copy_internal_strings(TSRMLS_C);
++}
++
++void apc_interned_strings_shutdown(TSRMLS_D)
++{
++ zend_hash_clean(CG(function_table));
++ zend_hash_clean(CG(class_table));
++ zend_hash_clean(EG(zend_constants));
++
++ CG(interned_strings_start) = old_interned_strings_start;
++ CG(interned_strings_end) = old_interned_strings_end;
++ zend_new_interned_string = old_new_interned_string;
++ zend_interned_strings_snapshot = old_interned_strings_snapshot;
++ zend_interned_strings_restore = old_interned_strings_restore;
++
++ DESTROY_LOCK(APCSG(lock));
++}
++#endif
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
++ * vim<600: expandtab sw=4 ts=4 sts=4
++ */
+diff -Naur a/ext/apc/apc_string.h b/ext/apc/apc_string.h
+--- a/ext/apc/apc_string.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_string.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,51 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2011 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 |
++ | available through the world-wide-web at the following url: |
++ | http://www.php.net/license/3_01.txt |
++ | If you did not receive a copy of the PHP license and are unable to |
++ | obtain it through the world-wide-web, please send a note to |
++ | license@php.net so we can mail you a copy immediately. |
++ +----------------------------------------------------------------------+
++ | Authors: Dmitry Stogov <dmitry@zend.com> |
++ +----------------------------------------------------------------------+
++
++ This software was contributed to PHP by Community Connect Inc. in 2002
++ and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1.
++ Future revisions and derivatives of this source code must acknowledge
++ Community Connect Inc. as the original contributor of this module by
++ leaving this note intact in the source code.
++
++ All other licensing and usage conditions are those of the PHP Group.
++
++ */
++
++/* $Id: apc_string.h 324145 2012-03-12 11:38:28Z pajoye $ */
++
++#ifndef APC_STRING
++#define APC_STRING
++
++#include "apc.h"
++
++#ifndef ZTS
++void apc_interned_strings_init(TSRMLS_D);
++void apc_interned_strings_shutdown(TSRMLS_D);
++#endif
++
++const char *apc_new_interned_string(const char *arKey, int nKeyLength TSRMLS_DC);
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
++ * vim<600: expandtab sw=4 ts=4 sts=4
++ */
+diff -Naur a/ext/apc/apc_windows_srwlock_kernel.c b/ext/apc/apc_windows_srwlock_kernel.c
+--- a/ext/apc/apc_windows_srwlock_kernel.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_windows_srwlock_kernel.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,133 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2011 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 |
++ | available through the world-wide-web at the following url: |
++ | http://www.php.net/license/3_01.txt |
++ | If you did not receive a copy of the PHP license and are unable to |
++ | obtain it through the world-wide-web, please send a note to |
++ | license@php.net so we can mail you a copy immediately. |
++ +----------------------------------------------------------------------+
++ | Authors: Pierre Joye <pierre@php.net> |
++ +----------------------------------------------------------------------+
++ */
++/* $Id$ */
++/*
++ These APIs are not actually exposed nor documented. But should work fine
++ from a binary as available since XP without signature changes.
++*/
++/*
++TODOs:
++non blocking could be possible using the fWait argument (to 0). However
++I'm not sure whether the wait handlers is actually implemented in all
++supported platforms (xp+). could be enabled later once really tested.
++ */
++/* $Id: $ */
++
++#include <php.h>
++
++#ifdef APC_SRWLOCK_KERNEL
++#include "apc_windows_srwlock_kernel.h"
++
++/*
++For references:
++void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl);
++void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl);
++BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait);
++BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait);
++void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl);
++*/
++typedef void (WINAPI *tRtlInitializeResource)(LPRTL_RWLOCK rwl);
++typedef void (WINAPI *tRtlDeleteResource)(LPRTL_RWLOCK rwl);
++typedef BYTE (WINAPI *tRtlAcquireResourceExclusive)(LPRTL_RWLOCK rwl, BYTE fWait);
++typedef BYTE (WINAPI *tRtlAcquireResourceShared)(LPRTL_RWLOCK rwl, BYTE fWait);
++typedef void (WINAPI *tRtlReleaseResource)(LPRTL_RWLOCK rwl);
++typedef void (WINAPI *tRtlDumpResource)(LPRTL_RWLOCK rwl);
++
++tRtlInitializeResource pRtlInitializeResource = 0;
++tRtlDeleteResource pRtlDeleteResource = 0;
++tRtlAcquireResourceExclusive pRtlAcquireResourceExclusive = 0;
++tRtlAcquireResourceShared pRtlAcquireResourceShared = 0;
++tRtlReleaseResource pRtlReleaseResource = 0;
++tRtlDumpResource pRtlDumpResource = 0;
++
++HINSTANCE ntdll;
++
++void apc_windows_cs_status(apc_windows_cs_rwlock_t *lock );
++apc_windows_cs_rwlock_t *apc_windows_cs_create(apc_windows_cs_rwlock_t *lock TSRMLS_DC)
++{
++ ntdll = LoadLibrary("ntdll.dll");
++ if (ntdll == 0) {
++ return NULL;
++ }
++
++ pRtlInitializeResource = (tRtlInitializeResource) GetProcAddress(ntdll, "RtlInitializeResource");
++ pRtlDeleteResource = (tRtlDeleteResource) GetProcAddress(ntdll, "RtlDeleteResource");
++ pRtlAcquireResourceExclusive = (tRtlAcquireResourceExclusive) GetProcAddress(ntdll, "RtlAcquireResourceExclusive");
++ pRtlAcquireResourceShared = (tRtlAcquireResourceShared) GetProcAddress(ntdll, "RtlAcquireResourceShared");
++ pRtlReleaseResource = (tRtlReleaseResource) GetProcAddress(ntdll, "RtlReleaseResource");
++ pRtlDumpResource = (tRtlReleaseResource) GetProcAddress(ntdll, "RtlDumpResource");
++ if (pRtlInitializeResource == 0 || pRtlDeleteResource == 0 || pRtlAcquireResourceExclusive == 0 ||
++ pRtlAcquireResourceShared == 0 || pRtlReleaseResource == 0 || pRtlDumpResource == 0) {
++ return NULL;
++ }
++ pRtlInitializeResource(lock);
++ return lock;
++}
++
++void apc_windows_cs_destroy(apc_windows_cs_rwlock_t *lock)
++{
++ __try
++ {
++ pRtlDeleteResource(lock);
++ }
++ __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ?
++ EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
++ {
++ /* Ignore exception (resource was freed during shutdown of another thread) */
++ }
++ FreeLibrary(ntdll);
++ return;
++}
+
-+ apc_copy_internal_strings(TSRMLS_C);
++void apc_windows_cs_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC)
++{
++ pRtlAcquireResourceExclusive(lock, 1);
+}
+
-+void apc_interned_strings_shutdown(TSRMLS_D)
-+{
-+ zend_hash_clean(CG(function_table));
-+ zend_hash_clean(CG(class_table));
-+ zend_hash_clean(EG(zend_constants));
++void apc_windows_cs_rdlock(apc_windows_cs_rwlock_t *lock TSRMLS_DC)
++{
++ pRtlAcquireResourceShared(lock, 1);
++}
+
-+ CG(interned_strings_start) = old_interned_strings_start;
-+ CG(interned_strings_end) = old_interned_strings_end;
-+ zend_new_interned_string = old_new_interned_string;
-+ zend_interned_strings_snapshot = old_interned_strings_snapshot;
-+ zend_interned_strings_restore = old_interned_strings_restore;
++void apc_windows_cs_unlock_rd(apc_windows_cs_rwlock_t *lock TSRMLS_DC)
++{
++ pRtlReleaseResource(lock);
++}
+
-+ DESTROY_LOCK(APCSG(lock));
++void apc_windows_cs_unlock_wr(apc_windows_cs_rwlock_t *lock TSRMLS_DC)
++{
++ pRtlReleaseResource(lock);
++}
++
++/* debugging purposes, output using trace msgs */
++void apc_windows_cs_status(apc_windows_cs_rwlock_t *lock)
++{
++ pRtlDumpResource(lock);
++ return;
+}
+
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_string.h
-@@ -0,0 +1,49 @@
+diff -Naur a/ext/apc/apc_windows_srwlock_kernel.h b/ext/apc/apc_windows_srwlock_kernel.h
+--- a/ext/apc/apc_windows_srwlock_kernel.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_windows_srwlock_kernel.h 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,74 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
-+ | Authors: Dmitry Stogov <dmitry@zend.com> |
++ | Authors: Pierre Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
++ */
++/* $Id$ */
+
-+ This software was contributed to PHP by Community Connect Inc. in 2002
-+ and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1.
-+ Future revisions and derivatives of this source code must acknowledge
-+ Community Connect Inc. as the original contributor of this module by
-+ leaving this note intact in the source code.
++#ifndef APC_WINDOWS_CS_RWLOCK_H
++#define APC_WINDOWS_CS_RWLOCK_H
+
-+ All other licensing and usage conditions are those of the PHP Group.
++#include "apc.h"
+
-+ */
++#ifdef APC_SRWLOCK_KERNEL
+
-+/* $Id: $ */
++typedef struct _RTL_RWLOCK {
++ RTL_CRITICAL_SECTION rtlCS;
+
-+#ifndef APC_STRING
-+#define APC_STRING
++ HANDLE hSharedReleaseSemaphore;
++ UINT uSharedWaiters;
+
-+#include "apc.h"
++ HANDLE hExclusiveReleaseSemaphore;
++ UINT uExclusiveWaiters;
+
-+void apc_interned_strings_init(TSRMLS_D);
-+void apc_interned_strings_shutdown(TSRMLS_D);
++ INT iNumberActive;
++ HANDLE hOwningThreadId;
++ DWORD dwTimeoutBoost;
++ PVOID pDebugInfo;
++} RTL_RWLOCK, *LPRTL_RWLOCK;
++
++#define apc_windows_cs_rwlock_t RTL_RWLOCK
+
-+char *apc_new_interned_string(char *arKey, int nKeyLength TSRMLS_DC);
++struct apc_windows_cs_rwlock_t {
++ CRITICAL_SECTION cs;
++ LONG writers_waiting_count;
++ LONG readers_waiting_count;
++ DWORD active_writers_readers_flag;
++ HANDLE ready_to_read;
++ HANDLE ready_to_write;
++ DWORD reader_races_lost;
++};
++
++apc_windows_cs_rwlock_t *apc_windows_cs_create(apc_windows_cs_rwlock_t *lock TSRMLS_DC);
++void apc_windows_cs_destroy(apc_windows_cs_rwlock_t *lock);
++void apc_windows_cs_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC);
++void apc_windows_cs_rdlock(apc_windows_cs_rwlock_t *lock TSRMLS_DC);
++void apc_windows_cs_unlock_rd(apc_windows_cs_rwlock_t *lock TSRMLS_DC);
++void apc_windows_cs_unlock_wr(apc_windows_cs_rwlock_t *lock TSRMLS_DC);
++# if NONBLOCKING_LOCK_AVAILABLE==1 /* Only in win7/2008 */
++zend_bool apc_pthreadrwlock_nonblocking_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC);
++# endif
++#endif
+
+#endif
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_zend.c
+diff -Naur a/ext/apc/apc_zend.c b/ext/apc/apc_zend.c
+--- a/ext/apc/apc_zend.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_zend.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,271 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_zend.c 303426 2010-09-16 16:39:08Z iliaa $ */
++/* $Id: apc_zend.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+#include "apc_zend.h"
+#include "apc_globals.h"
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/apc_zend.h
+diff -Naur a/ext/apc/apc_zend.h b/ext/apc/apc_zend.h
+--- a/ext/apc/apc_zend.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/apc_zend.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,191 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: apc_zend.h 303464 2010-09-17 12:19:29Z gopalv $ */
++/* $Id: apc_zend.h 326712 2012-07-19 21:33:27Z rasmus $ */
+
+#ifndef APC_ZEND_H
+#define APC_ZEND_H
+# if PHP_MAJOR_VERSION >= 6
+# define APC_OPCODE_HANDLER_COUNT ((25 * 152) + 1)
+# elif defined(ZEND_ENGINE_2_4)
-+# define APC_OPCODE_HANDLER_COUNT ((25 * 157) + 1) /* 3 new opcodes in 5.4? - separate, bind_trais, add_trait */
++# define APC_OPCODE_HANDLER_COUNT ((25 * 159) + 1) /* 5 new opcodes in 5.4 - qm_assign_var, jmp_set_var, separate, bind_trais, add_trait */
+# elif PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3
+# define APC_OPCODE_HANDLER_COUNT ((25 * 154) + 1) /* 3 new opcodes in 5.3 - unused, lambda, jmp_set */
+# else
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/CHANGELOG
+diff -Naur a/ext/apc/CHANGELOG b/ext/apc/CHANGELOG
+--- a/ext/apc/CHANGELOG 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/CHANGELOG 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,249 @@
+
+3.1.2 : 2008-12-12
+
+1.0.1:
+- added optional file modification time check [djc 2001-01-12]
---- /dev/null
-+++ b/ext/apc/config.m4
-@@ -0,0 +1,246 @@
+diff -Naur a/ext/apc/config.m4 b/ext/apc/config.m4
+--- a/ext/apc/config.m4 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/config.m4 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,404 @@
+dnl
-+dnl $Id: config.m4 304101 2010-10-05 14:37:36Z kalle $
++dnl $Id: config.m4 326700 2012-07-19 11:56:57Z ab $
+dnl
+
+PHP_ARG_ENABLE(apc, whether to enable APC support,
+AC_ARG_ENABLE(apc-debug,
+[ --enable-apc-debug Enable APC debugging],
+[
-+ PHP_APC_DEBUG=yes
++ PHP_APC_DEBUG=$enableval
+],
+[
+ PHP_APC_DEBUG=no
+ return -1;
+ }
+
-+ puts("pthread mutex's are supported!");
++ puts("pthread mutexs are supported!");
+ return 0;
+ }
+ ],
+ PHP_ADD_LIBRARY(pthread)
+ ],
+ [ dnl -Failure-
-+ AC_MSG_WARN([It doesn't appear that pthread mutex's are supported on your system])
++ AC_MSG_WARN([It doesn't appear that pthread mutexes are supported on your system])
+ PHP_APC_PTHREADMUTEX=no
+ ],
+ [
+ LIBS="$orig_LIBS"
+fi
+
++AC_MSG_CHECKING(whether we should use pthread read/write locking)
++AC_ARG_ENABLE(apc-pthreadrwlocks,
++[ --enable-apc-pthreadrwlocks
++ Enable pthread read/write locking ],
++[
++ PHP_APC_PTHREADRWLOCK=$enableval
++ AC_MSG_RESULT($enableval)
++],
++[
++ PHP_APC_PTHREADRWLOCK=no
++ AC_MSG_RESULT(no)
++])
++
++if test "$PHP_APC_PTHREADRWLOCK" != "no"; then
++ orig_LIBS="$LIBS"
++ LIBS="$LIBS -lpthread"
++ AC_TRY_RUN(
++ [
++ #include <sys/types.h>
++ #include <pthread.h>
++ main() {
++ pthread_rwlock_t rwlock;
++ pthread_rwlockattr_t attr;
++
++ if(pthread_rwlockattr_init(&attr)) {
++ puts("Unable to initialize pthread attributes (pthread_rwlockattr_init).");
++ return -1;
++ }
++ if(pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) {
++ puts("Unable to set PTHREAD_PROCESS_SHARED (pthread_rwlockattr_setpshared), your system may not support shared rwlock's.");
++ return -1;
++ }
++ if(pthread_rwlock_init(&rwlock, &attr)) {
++ puts("Unable to initialize the rwlock (pthread_rwlock_init).");
++ return -1;
++ }
++ if(pthread_rwlockattr_destroy(&attr)) {
++ puts("Unable to destroy rwlock attributes (pthread_rwlockattr_destroy).");
++ return -1;
++ }
++ if(pthread_rwlock_destroy(&rwlock)) {
++ puts("Unable to destroy rwlock (pthread_rwlock_destroy).");
++ return -1;
++ }
++
++ puts("pthread rwlocks are supported!");
++ return 0;
++ }
++ ],
++ [ dnl -Success-
++ PHP_ADD_LIBRARY(pthread)
++ APC_CFLAGS="-D_GNU_SOURCE"
++ ],
++ [ dnl -Failure-
++ AC_MSG_WARN([It doesn't appear that pthread rwlocks are supported on your system])
++ PHP_APC_PTHREADRWLOCK=no
++ ],
++ [
++ PHP_ADD_LIBRARY(pthread)
++ ]
++ )
++ LIBS="$orig_LIBS"
++fi
++
++ AC_CACHE_CHECK([whether the target compiler supports builtin atomics], PHP_cv_APC_GCC_ATOMICS, [
++
++ AC_TRY_LINK([],[
++ int foo = 0;
++ __sync_fetch_and_add(&foo, 1);
++ __sync_bool_compare_and_swap(&foo, 0, 1);
++ return __sync_fetch_and_add(&foo, 1);
++ ],
++ [PHP_cv_APC_GCC_ATOMICS=yes],
++ [PHP_cv_APC_GCC_ATOMICS=no])
++ ])
++
++ if test "x${PHP_cv_APC_GCC_ATOMICS}" != "xno"; then
++ AC_DEFINE(HAVE_ATOMIC_OPERATIONS, 1,
++ [Define this if your target compiler supports builtin atomics])
++ else
++ if test "$PHP_APC_PTHREADRWLOCK" != "no"; then
++ AC_MSG_WARN([Disabling pthread rwlocks, because of missing atomic operations])
++ dnl - fall back would most likely be pthread mutexes
++ PHP_APC_PTHREADRWLOCK=no
++ fi
++ fi
++
+AC_MSG_CHECKING(whether we should use spin locks)
+AC_ARG_ENABLE(apc-spinlocks,
+[ --enable-apc-spinlocks
+ AC_MSG_RESULT(no)
+])
+
++
+AC_MSG_CHECKING(whether we should enable memory protection)
+AC_ARG_ENABLE(apc-memprotect,
+[ --enable-apc-memprotect
+ AC_DEFINE(APC_SEM_LOCKS, 1, [ ])
+ elif test "$PHP_APC_SPINLOCKS" != "no"; then
+ AC_DEFINE(APC_SPIN_LOCKS, 1, [ ])
++ elif test "$PHP_APC_PTHREADRWLOCK" != "no"; then
++ AC_DEFINE(APC_PTHREADRW_LOCKS, 1, [ ])
+ elif test "$PHP_APC_PTHREADMUTEX" != "no"; then
+ AC_DEFINE(APC_PTHREADMUTEX_LOCKS, 1, [ ])
+ else
+ apc_sem.c \
+ apc_shm.c \
+ apc_pthreadmutex.c \
++ apc_pthreadrwlock.c \
+ apc_spin.c \
+ pgsql_s_lock.c \
+ apc_sma.c \
+ PHP_NEW_EXTENSION(apc, $apc_sources, $ext_shared,, \\$(APC_CFLAGS))
+ PHP_SUBST(APC_SHARED_LIBADD)
+ PHP_SUBST(APC_CFLAGS)
++ PHP_INSTALL_HEADERS(ext/apc, [apc_serializer.h])
+ AC_DEFINE(HAVE_APC, 1, [ ])
+fi
+
---- /dev/null
-+++ b/ext/apc/config.w32
-@@ -0,0 +1,48 @@
-+// $Id: config.w32 305410 2010-11-16 16:47:18Z pajoye $
-+// vim:ft=javascript
++PHP_ARG_ENABLE(coverage, whether to include code coverage symbols,
++[ --enable-coverage DEVELOPERS ONLY!!], no, no)
++
++if test "$PHP_COVERAGE" = "yes"; then
++
++ if test "$GCC" != "yes"; then
++ AC_MSG_ERROR([GCC is required for --enable-coverage])
++ fi
++
++ dnl Check if ccache is being used
++ case `$php_shtool path $CC` in
++ *ccache*[)] gcc_ccache=yes;;
++ *[)] gcc_ccache=no;;
++ esac
++
++ if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
++ AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
++ fi
++
++ lcov_version_list="1.5 1.6 1.7 1.9"
++
++ AC_CHECK_PROG(LCOV, lcov, lcov)
++ AC_CHECK_PROG(GENHTML, genhtml, genhtml)
++ PHP_SUBST(LCOV)
++ PHP_SUBST(GENHTML)
++
++ if test "$LCOV"; then
++ AC_CACHE_CHECK([for lcov version], php_cv_lcov_version, [
++ php_cv_lcov_version=invalid
++ lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` #'
++ for lcov_check_version in $lcov_version_list; do
++ if test "$lcov_version" = "$lcov_check_version"; then
++ php_cv_lcov_version="$lcov_check_version (ok)"
++ fi
++ done
++ ])
++ else
++ lcov_msg="To enable code coverage reporting you must have one of the following LCOV versions installed: $lcov_version_list"
++ AC_MSG_ERROR([$lcov_msg])
++ fi
++
++ case $php_cv_lcov_version in
++ ""|invalid[)]
++ lcov_msg="You must have one of the following versions of LCOV: $lcov_version_list (found: $lcov_version)."
++ AC_MSG_ERROR([$lcov_msg])
++ LCOV="exit 0;"
++ ;;
++ esac
++
++ if test -z "$GENHTML"; then
++ AC_MSG_ERROR([Could not find genhtml from the LCOV package])
++ fi
++
++ PHP_ADD_MAKEFILE_FRAGMENT
++
++ dnl Remove all optimization flags from CFLAGS
++ changequote({,})
++ CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
++ CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
++ changequote([,])
+
++ dnl Add the special gcc flags
++ CFLAGS="$CFLAGS -O0 -ggdb -fprofile-arcs -ftest-coverage"
++ CXXFLAGS="$CXXFLAGS -ggdb -O0 -fprofile-arcs -ftest-coverage"
++fi
++dnl vim: set ts=2
+diff -Naur a/ext/apc/config.w32 b/ext/apc/config.w32
+--- a/ext/apc/config.w32 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/config.w32 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,60 @@
++// $Id: config.w32 309203 2011-03-14 06:47:16Z pajoye $
++// vim:ft=javascript
+
+ARG_ENABLE('apc', 'Whether to enable APC support', 'no');
+ARG_ENABLE('apc-debug', 'Whether to enable APC debugging', 'no');
+ARG_ENABLE('apc-filehits', 'Whether to enable cache request file info', 'no');
+ARG_ENABLE('apc-spinlocks', 'Whether to use spin locks (experimental)', 'no');
+ARG_ENABLE('apc-memprotect', 'Whether to enable memory protection (experimental)', 'no');
++ARG_ENABLE('apc-srwlock-native', 'Whether to use SRWLOCK locks native (win7/2008 only)', 'no');
++ARG_ENABLE('apc-srwlock-kernel', 'Whether to use SRWLOCK locks (loaded at runtime)', 'no');
+
+if(PHP_APC != 'no')
+{
+ AC_DEFINE('APC_MEMPROTECT', 1);
+ }
+
-+ if(PHP_APC_SPINLOCKS != 'no')
-+ {
-+ AC_DEFINE('APC_SPIN_LOCKS', 1);
-+ ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1');
++ if(PHP_APC_SRWLOCK_NATIVE != 'no') {
++ AC_DEFINE('APC_SRWLOCK_NATIVE', 1);
++ } else {
++ if(PHP_APC_SRWLOCK_KERNEL != 'no') {
++ AC_DEFINE('APC_SRWLOCK_KERNEL', 1);
++ ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1');
+
-+ apc_sources += ' apc_spin.c pgsql_s_lock.c';
-+ }
-+ else
-+ {
-+ AC_DEFINE('APC_FCNTL_LOCKS', 1);
++ apc_sources += ' apc_windows_srwlock_kernel.c';
++ } else {
++ if(PHP_APC_SPINLOCKS != 'no') {
++ AC_DEFINE('APC_SPIN_LOCKS', 1);
++ ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1');
++
++ apc_sources += ' apc_spin.c pgsql_s_lock.c';
++ } else {
++ AC_DEFINE('APC_FCNTL_LOCKS', 1);
++ }
++ }
+ }
+
+ AC_DEFINE('HAVE_APC', 1);
++ AC_DEFINE('HAVE_ATOMIC_OPERATIONS', 1);
++
++ PHP_INSTALL_HEADERS("ext/apc", "apc_serializer.h");
+
+ EXTENSION('apc', apc_sources);
+}
-\ No newline at end of file
---- /dev/null
-+++ b/ext/apc/INSTALL
-@@ -0,0 +1,400 @@
+diff -Naur a/ext/apc/INSTALL b/ext/apc/INSTALL
+--- a/ext/apc/INSTALL 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/INSTALL 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,407 @@
+Installation Instructions for APC
+---------------------------------
+
+----------------------------------------------
+ extension=apc.so
+ apc.enabled=1
-+ apc.shm_size=128
++ apc.shm_size=128M
+ apc.ttl=7200
+ apc.user_ttl=7200
+ apc.enable_cli=1
+ apc.shm_size The size of each shared memory segment in MB.
+ By default, some systems (including most BSD
+ variants) have very low limits on the size of a
-+ shared memory segment.
++ shared memory segment. M/G suffixes must be used.
+ (Default: 30)
++
+
+ apc.optimization This option has been deprecated.
+ (Default: 0)
+ Optimize include_once and require_once calls and avoid the
+ expensive system calls used.
+ (Default: 0)
---- /dev/null
-+++ b/ext/apc/LICENSE
++
++ apc.serializer
++ Defines which serializer should be used. Default is the
++ standard PHP serializer. Other can be used without having
++ to re compile apc, like igbinary for example.
++ (apc.serializer=igbinary)
+diff -Naur a/ext/apc/LICENSE b/ext/apc/LICENSE
+--- a/ext/apc/LICENSE 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/LICENSE 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,68 @@
+--------------------------------------------------------------------
+ The PHP License, version 3.01
-+Copyright (c) 1999 - 2010 The PHP Group. All rights reserved.
++Copyright (c) 1999 - 2011 The PHP Group. All rights reserved.
+--------------------------------------------------------------------
+
+Redistribution and use in source and binary forms, with or without
+
+PHP includes the Zend Engine, freely available at
+<http://www.zend.com>.
---- /dev/null
-+++ b/ext/apc/NOTICE
+diff -Naur a/ext/apc/NOTICE b/ext/apc/NOTICE
+--- a/ext/apc/NOTICE 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/NOTICE 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,43 @@
+This is the NOTICE file that holds acknowledgements and stuff.
+
+ Angel Li diffs for ANSI comment compliance
+ Christian Rishøj help debugging phplib problems
+ Sascha Schumann memory error bug fix
---- /dev/null
-+++ b/ext/apc/package.xml
-@@ -0,0 +1,827 @@
-+<?xml version="1.0" encoding="UTF-8"?>
-+<package packagerversion="1.9.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
-+ <name>APC</name>
-+ <channel>pecl.php.net</channel>
-+ <summary>Alternative PHP Cache</summary>
-+ <description>APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.</description>
-+ <lead>
-+ <name>Daniel Cowgill</name>
-+ <user>dcowgill</user>
-+ <email>dan@mail.communityconnect.com</email>
-+ <active>no</active>
-+ </lead>
-+ <lead>
-+ <name>George Schlossnagle</name>
-+ <user>gschlossnagle</user>
-+ <email>george@omniti.com</email>
-+ <active>no</active>
-+ </lead>
-+ <lead>
-+ <name>Rasmus Lerdorf</name>
-+ <user>rasmus</user>
-+ <email>rasmus@php.net</email>
-+ <active>yes</active>
-+ </lead>
-+ <lead>
-+ <name>Gopal Vijayaraghavan</name>
-+ <user>gopalv</user>
-+ <email>gopalv@php.net</email>
-+ <active>yes</active>
-+ </lead>
-+ <developer>
-+ <name>Edin Kadribasic</name>
-+ <user>edink</user>
-+ <email>edink@emini.dk</email>
-+ <active>no</active>
-+ </developer>
-+ <developer>
-+ <name>Ilia Alshanetsky</name>
-+ <user>iliaa</user>
-+ <email>ilia@prohost.org</email>
-+ <active>yes</active>
-+ </developer>
-+ <developer>
-+ <name>Marcus Börger</name>
-+ <user>helly</user>
-+ <email>helly@php.net</email>
-+ <active>no</active>
-+ </developer>
-+ <developer>
-+ <name>Sara Golemon</name>
-+ <user>pollita</user>
-+ <email>pollita@php.net</email>
-+ <active>no</active>
-+ </developer>
-+ <developer>
-+ <name>Brian Shire</name>
-+ <user>shire</user>
-+ <email>shire@php.net</email>
-+ <active>yes</active>
-+ </developer>
-+ <developer>
-+ <name>Kalle Sommer Nielsen</name>
-+ <user>kalle</user>
-+ <email>kalle@php.net</email>
-+ <active>yes</active>
-+ </developer>
-+ <developer>
-+ <name>Pierre Joye</name>
-+ <user>pajoye</user>
-+ <email>pierre@php.net</email>
-+ <active>yes</active>
-+ </developer>
-+ <date>2010-11-30</date>
-+ <time>15:48:31</time>
-+ <version>
-+ <release>3.1.6</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <notes>
-+- make slam_defense a little more optimistic, allow a thread/process to write to cache in a loop
-+- ensure realpaths hit the realpath_cache, in no-stat mode
-+- prevent memory starvation, nuke all caches when expunging just one doesn't work
-+- fix uploadprogress keylength issues (NUL is part of keylen, pecl bug #20016)
-+ </notes>
-+ <contents>
-+ <dir name="/">
-+ <file md5sum="d8778d844e157a2bb49e11858057050f" name="tests/apc_001.phpt" role="test" />
-+ <file md5sum="cc1dba4e429ff93dce1ca7dea01c2899" name="tests/apc_002.phpt" role="test" />
-+ <file md5sum="04c800594e9934cf8e15157e9bd4c52f" name="tests/apc_003.phpt" role="test" />
-+ <file md5sum="538f198f432614d9f2c0819fea5193a7" name="tests/apc_003b.phpt" role="test" />
-+ <file md5sum="43c8e1c89fad5bb25ded528837e63b2b" name="tests/apc_004.phpt" role="test" />
-+ <file md5sum="06432141cbc82df8ddde7fac52e9f65e" name="tests/apc_005.phpt" role="test" />
-+ <file md5sum="74f802b99f111d1cdab6abaf20edae95" name="tests/apc_006.phpt" role="test" />
-+ <file md5sum="b724592cd9629ab5e9dac9f1ef5d3e10" name="tests/apc_007.phpt" role="test" />
-+ <file md5sum="0674cbe2e88fe5c331bee3fbb1395d4f" name="tests/apc_008.phpt" role="test" />
-+ <file md5sum="4f15ba9d73035c6c0493f05e57ee70f0" name="tests/apc_009.phpt" role="test" />
-+ <file md5sum="6640964ee33a683b1693b545d1ff2ed0" name="tests/apc_010.phpt" role="test" />
-+ <file md5sum="611e5e725d57fcca216bf79778238290" name="tests/apc53_001.phpt" role="test" />
-+ <file md5sum="1cd474d5a3567601d66d1078699fd587" name="tests/apc53_002.phpt" role="test" />
-+ <file md5sum="3d863bb88c5f2624320b7b72e368d668" name="tests/apc53_003.phpt" role="test" />
-+ <file md5sum="128e9590ff8d3d0791a1ef9ce9c078f5" name="tests/apc53_004.phpt" role="test" />
-+ <file md5sum="c710a33310dfacef4d51cb721855857e" name="tests/apc53_005.phpt" role="test" />
-+ <file md5sum="5001c1cd063b4c2032189fcb74d04644" name="tests/apc_bin_001.phpt" role="test" />
-+ <file md5sum="c992d44557b849a10984b089419d2e01" name="tests/apc_bin_002-1.inc" role="test" />
-+ <file md5sum="409cadd9efc9d863421b15d63d8c6515" name="tests/apc_bin_002-2.inc" role="test" />
-+ <file md5sum="2667d74094dac9e366020c11b3a9bd47" name="tests/apc_bin_002.phpt" role="test" />
-+ <file md5sum="1bb542e50a5e6eb06b54a89ceaa81976" name="tests/iterator_001.phpt" role="test" />
-+ <file md5sum="7ee077f992cd81940f74b5f1b0e885c0" name="tests/iterator_002.phpt" role="test" />
-+ <file md5sum="eccbaee4d483213ee8ba0583c705224b" name="tests/iterator_003.phpt" role="test" />
-+ <file md5sum="4ec172b4fc8ed2f45f3d7426865a0db5" name="tests/iterator_004.phpt" role="test" />
-+ <file md5sum="eec4bf6bdfa4936cb122845216cad7e0" name="tests/iterator_005.phpt" role="test" />
-+ <file md5sum="3b0a6f2a4e03382a0d56d66b7f7324bc" name="tests/iterator_006.phpt" role="test" />
-+ <file md5sum="82a40b37c545631cd87c3e1e421353b5" name="tests/iterator_007.phpt" role="test" />
-+ <file md5sum="92e7b033fac8b625c6ad52e21d1222bf" name="tests/php_5_3_ns.inc" role="test" />
-+ <file md5sum="6ecba4154b6bd6f8703000f5198710cc" name="tests/skipif.inc" role="test" />
-+ <file md5sum="ed9a4192d7ab7f953856b92c5e689cf5" name="CHANGELOG" role="doc" />
-+ <file md5sum="530c37a06cb3d2f7dc578399e08dc532" name="INSTALL" role="doc" />
-+ <file md5sum="cb564efdf78cce8ea6e4b5a4f7c05d97" name="LICENSE" role="doc" />
-+ <file md5sum="eea150699d3dffb2cdf7d243854189d7" name="NOTICE" role="doc" />
-+ <file md5sum="4bcb366801c544b5d9df03a445f33b3f" name="TODO" role="doc" />
-+ <file md5sum="1a12ed6c0aa4124837cc96cefa507fe1" name="TECHNOTES.txt" role="doc" />
-+ <file md5sum="f1df0d7f7d913424082440bd1c456f57" name="apc.c" role="src" />
-+ <file md5sum="db933bf95d955bdac3756ff64aa68e00" name="apc.h" role="src" />
-+ <file md5sum="94a046b4eb5890778dc0f78173d0d4cc" name="apc_bin.c" role="src" />
-+ <file md5sum="7f88578dc04a829b8b66a4992241b93c" name="apc_bin.h" role="src" />
-+ <file md5sum="0960b84970794199b1d303097bbb6ace" name="apc_cache.c" role="src" />
-+ <file md5sum="f4e3dc54d403741e3d62caa5a5ba0f22" name="apc_cache.h" role="src" />
-+ <file md5sum="0a7155470ba3df4718883710122abb2b" name="apc_compile.c" role="src" />
-+ <file md5sum="c8f3eb20167f2c4274e0d851c16bd9e0" name="apc_compile.h" role="src" />
-+ <file md5sum="5b5a25592270765352ef45ffd5b514d9" name="apc_debug.c" role="src" />
-+ <file md5sum="3d8d0bd66ed185f6fbb9b4612b20bd2a" name="apc_debug.h" role="src" />
-+ <file md5sum="e874b4944016989e23801dae5ad7c5ad" name="apc_fcntl.c" role="src" />
-+ <file md5sum="e6d336752e1a0c7768e8d013de60c861" name="apc_fcntl.h" role="src" />
-+ <file md5sum="972d4372d466abca82b531f448501331" name="apc_globals.h" role="src" />
-+ <file md5sum="fe05863f7a9e156a3494ff2e3012e2fb" name="apc_lock.h" role="src" />
-+ <file md5sum="bda9b7cd75b85fda2dad3c9cb20ed293" name="apc_main.c" role="src" />
-+ <file md5sum="248fc93a72f5b6beba82c3d29eba3f24" name="apc_main.h" role="src" />
-+ <file md5sum="f49d49907ef24e6698b1c85aeb89bcd4" name="apc_mmap.c" role="src" />
-+ <file md5sum="d86e21617ad249ab5b2be1a7d7fcfd21" name="apc_mmap.h" role="src" />
-+ <file md5sum="9a82909be30c52b1ca267886d832b129" name="apc_php.h" role="src" />
-+ <file md5sum="7d193d20531dbc39acf2e828a757f01b" name="apc_php_pcre.h" role="php" />
-+ <file md5sum="e1e4fc3330b2e6497259caf08b27100c" name="apc_pthreadmutex.c" role="src" />
-+ <file md5sum="52fa7e9b676a9e6264dbb4425320aa7f" name="apc_pthreadmutex.h" role="src" />
-+ <file md5sum="88028345c8f453573975ec59241442ef" name="apc_sem.c" role="src" />
-+ <file md5sum="15c5e77be5e97cf089a8b4b0719e2ec6" name="apc_sem.h" role="src" />
-+ <file md5sum="05f78a27fbf80993c1f35933e16bbe6d" name="apc_shm.c" role="src" />
-+ <file md5sum="0bb9ac1689d846570a819b708af1105a" name="apc_shm.h" role="src" />
-+ <file md5sum="b16c47e998f8092c5e6c61368e1d4a24" name="apc_sma.c" role="src" />
-+ <file md5sum="3e5265ba778a5b9de42148b27c199c7d" name="apc_sma.h" role="src" />
-+ <file md5sum="a107ff01a0df3349a96d38ae5fc84f5f" name="apc_spin.c" role="src" />
-+ <file md5sum="8a44c26956bf889155cb24088712dc50" name="apc_spin.h" role="src" />
-+ <file md5sum="0939854bf2b61f1d88201da833243e37" name="apc_stack.c" role="src" />
-+ <file md5sum="1c36a4153b213cb6f9b3ccad26606791" name="apc_stack.h" role="src" />
-+ <file md5sum="aba4b2d34f04ba69d10bd9bcff696e84" name="apc_string.h" role="src" />
-+ <file md5sum="0c8e5033f2bf7189badf50954a2c99a0" name="apc_string.c" role="src" />
-+ <file md5sum="458f49fb5f03544e94ac5f530d0a9c68" name="apc_zend.c" role="src" />
-+ <file md5sum="15b6b1e684e6b22390f0a3783d2bc134" name="apc_zend.h" role="src" />
-+ <file md5sum="b94678c89b8f0b6f5bd1a8aba00e77a7" name="apc_signal.c" role="src" />
-+ <file md5sum="596f0878de5ae6cf8ccd9d8242a203c4" name="apc_signal.h" role="src" />
-+ <file md5sum="ac0ac4ad53248999d41ae83c9a460086" name="apc_iterator.c" role="src" />
-+ <file md5sum="8bad478e9e94682a185cf22167be5e84" name="apc_iterator.h" role="src" />
-+ <file md5sum="a4ad70727d8a4302a80aca9be6b267c2" name="apc_pool.c" role="src" />
-+ <file md5sum="95d87754c41bb7cd919bd02c08fcbead" name="apc_pool.h" role="src" />
-+ <file md5sum="0635ec3025ca2eac5b146ecd74240697" name="config.m4" role="src" />
-+ <file md5sum="45ef21f58c191413ff5c06e708dec2f8" name="config.w32" role="src" />
-+ <file md5sum="aee455af2782bed51730fa8e85deff5f" name="php_apc.c" role="src" />
-+ <file md5sum="6b52620bc10e2d49ca33dbaa9c037002" name="php_apc.h" role="src" />
-+ <file md5sum="3bdccc0fa74ea0b6c2539fcb0b5a6253" name="pgsql_s_lock.c" role="src" />
-+ <file md5sum="c63703a3966a0486150ea5b780d6ebec" name="pgsql_s_lock.h" role="src" />
-+ <file md5sum="3b737f451ebf7175e00ebe0246c97e16" name="apc_fcntl_win32.c" role="src" />
-+ <file md5sum="48817fe8f775ad3861dc7c5307c88c59" name="apc_rfc1867.c" role="src" />
-+ <file md5sum="f1d6a8535a55ed9129088066e18867b4" name="apc.php" role="php" />
-+ </dir>
-+ </contents>
-+ <dependencies>
-+ <required>
-+ <php>
-+ <min>5.1.0</min>
-+ </php>
-+ <pearinstaller>
-+ <min>1.4.0</min>
-+ </pearinstaller>
-+ </required>
-+ </dependencies>
-+ <providesextension>apc</providesextension>
-+ <extsrcrelease>
-+ <configureoption default="no" name="enable-apc-filehits" prompt="Enable per request file info about files used from the APC cache" />
-+ <configureoption default="no" name="enable-apc-spinlocks" prompt="Enable spin locks (EXPERIMENTAL)" />
-+ </extsrcrelease>
-+ <changelog>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>2.0.0</release>
-+ <api>2.0.0</api>
-+ </version>
-+ <date>2003-07-01</date>
-+ <notes>
-+Complete rework.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>2.0.1</release>
-+ <api>2.0.0</api>
-+ </version>
-+ <date>2003-07-01</date>
-+ <notes>
-+Win32 support added.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>2.0.2</release>
-+ <api>2.0.0</api>
-+ </version>
-+ <date>2004-03-12</date>
-+ <notes>
-+Fixed non-existant class bug.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.0</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-05</date>
-+ <notes>
-+PHP-5.1 Support and numerous fixes
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.1</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-05</date>
-+ <notes>
-+PHP4 build fix
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.2</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-05</date>
-+ <notes>
-+Default to mmap and add a better error message for shmget failures
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.3</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-07</date>
-+ <notes>
-+Fix compile problem against PHP 5.0.x
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.4</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-18</date>
-+ <notes>
-+Add win32 support from Edin.
-+Add --with-apxs switch to work around problem when loading APC into Apache binary compiled with LFS switches
-+A couple of other minor fixes.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.5</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-27</date>
-+ <notes>
-+Make it easier for sapis that only populate file_handle->filename to use APC. (Rasmus)
-+Support extensions such as bcompiler that need to hook into compile_file. (Val)
-+Ralf Becker's apcgui code has now become the default apc.php status page. (Ralf, Rasmus, Ilia)
-+Segfault in cache cleanup code (Ilia, Rasmus)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.6</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-07-30</date>
-+ <notes>
-+Added apc.php to package.xml file.
-+Track per-entry memory usage. (Val)
-+Various apc.php fixes and enhancements. (Ralf, Ilia, Rasmus)
-+fcntl locking robustness fixes. (Rasmus)
-+Shared read-locks where possible. (Rasmus)
-+Added file_update_protection configuration parameter. (Rasmus)
-+Windows ZTS fixes (Frank)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.7</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-08-16</date>
-+ <notes>
-+Fix to apc.php to show final segment in frag chart. (Ilia)
-+A couple of win32 fixes. (Frank)
-+Add apc.enable_cli ini directive. (Rasmus)
-+Add test cases. (Marcus)
-+Fix apc_define_constants() bug - http://pecl.php.net/bugs/5084 (Rasmus)
-+Simplify user cache handling by removing the user_cache_stack (Rasmus)
-+Fix apc_fetch() memory corruption (Andrei,Rasmus)
-+Added apc.max_file_size INI setting that allows exclusion of large files from being cached. Default file size limit, 1 megabyte. (Ilia)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.8</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2005-08-24</date>
-+ <notes>
-+Fix invalid free in globals destructor introduced in 3.0.7 (Rasmus)
-+Cache corruption fix in cache-full cleanup code (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.9</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2006-03-04</date>
-+ <notes>
-+Eliminate rand() call when slam_defense is not set (Rasmus)
-+Fix for __isset problem (Gopal)
-+Rewrite allocator from a "best fit" to a "next fit" algorithm (Rasmus)
-+Added a Cache Full counter so we have an idea how many times the segment has filled up causing an expunge (Rasmus)
-+Report back the correct number of available bytes in the segment instead of the allocated bytes. (Rasmus)
-+Add cache busy flag which is set when an expunge is underway (Rasmus)
-+Add automatic serialization of objects in apc_store() (Marcus)
-+64-bit .ini flag fix (Rasmus)
-+Static members fix (Gopal)
-+sma_cleanup() mem leak fix (Rasmus)
-+Fix for http://pecl.php.net/bugs/5311 (Rasmus)
-+Fix autoglobals JIT bug (Gopal)
-+Fix instance bug (Gopal)
-+Add a lock cleanup safety net to request shutdown (Rasmus)
-+Fix apc.slam_defense edge-case bug (Rasmus)
-+User entry memory usage tracking support (Ilia)
-+Allow keys used in apc_store/apc_fetch/apc_delete to be binary safe and prevent conflicts between keys that are found at the start of other keys. (Ilia)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.10</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2006-03-11</date>
-+ <notes>
-+* Add apc.stat ini flag which defaults to 1. If set to 0, the main script and any fullpath
-+ includes will not be stat'ed for any changes. You will have to restart the server if you
-+ change anything. This mode increases performance quite a bit, especially if you have a
-+ lot of includes.
-+
-+* Get rid of the lock safety net hack I added in 3.0.9. It seems to cause more problems
-+ than it solves. I'll need to revisit locking and signal handling at some point soon.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.11</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2006-08-16</date>
-+ <notes>
-+* Made --enable-apc-mmap the default compile option (for real this time)
-+
-+* Add an optional flag to apc_cache_info() and some apc.php tweaks to make it
-+ only fetch header information to make it useful when you have tens of
-+ thousands of entries. (Brian Shire)
-+
-+* 64-bit fixes (George)
-+
-+* Don't mix Full Path and Inode keys (George)
-+
-+* Override ZEND_INCLUDE_OR_EVAL opcode (when possible) to speed up use of
-+ require_once() and include_once() statements. (Sara)
-+
-+* Add a non-blocking write_lock for cache inserts. This is a better approach
-+ to prevent cache slams and deprecates the slam_defense setting. (Rasmus)
-+
-+* A bit of work on the optimizer. (Sara)
-+
-+* Various memory issues resolved. (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.12</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2006-09-04</date>
-+ <notes>
-+* Fix stray debug message
-+
-+* Work on the optimizer - still not stable (Gopal, Ilia, Sara)
-+
-+* Performance boost - Replace multiple loops over the opcode
-+ array with a single loop for copying, jump fixups and auto
-+ global pre-fetches. (Gopal)
-+
-+* Perform fetch_global checks only in php5 and only if
-+ auto_globals_jit is enabled. (Gopal)
-+
-+* Fix bug #8579 - scrub php4 classes' function_table and default
-+ properties before inserting into cache. (Gopal)
-+
-+* Fix bug #8606 - ZEND_FETCH_GLOBAL is not an opcode, but is a
-+ op1->type. The opcodes applicable are ZEND_FETCH_R and
-+ ZEND_FETCH_W. (Gopal)
-+
-+* PHP 5.2 Compatibility (Gopal)
-+
-+* Make the include_once override optional - default off (Sara)
-+
-+* Fixed crash when apc run in CLI, but enable_cli is off. (Ilia)
-+
-+* Ensure that the apc_globals->cache_stack is cleared before the
-+ shm cache is destroyed. Fixes segfault for corner-case i.e request
-+ shutdown (apc_deactivate) is not called before module shutdown
-+ calls (php_apc_shutdown_globals) (Gopal)
-+
-+* TSRM fixes (ensure ts_free_id before apc.so is dlclosed) (Gopal)
-+
-+* Fix memory leak of apc_cache_info_t->deleted_list (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.12p1</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2006-09-05</date>
-+ <notes>
-+* The only change here is a trivial PHP 4 build fix.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.12p2</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2006-09-05</date>
-+ <notes>
-+* Let's get the version number right. 3.0.12p2 now.
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.13</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2007-02-24</date>
-+ <notes>
-+* PHP 5.2 file upload progress tracking support (Rasmus)
-+* Pthread mutex and spin locks (Shire)
-+* Recursive zval support for apc_fetch/_store (Shire, Gopal)
-+* apc.stat_ctime flag for ctime checks (Rasmus)
-+* Multiple key fetches with apc_fetch (Shire)
-+* Canary checks for shm memory deallocation (Gopal)
-+* Add hooks for external optimizer (Shire)
-+* Obsolete and remove apc optimizer (Gopal)
-+* APC info changes - cache insert rate, hit and miss rates (Shire)
-+* Fix apc_load_constants (Gopal)
-+* Rewrite dump opcode code to use vld (Gopal)
-+* Use apc_[ewn]print functions for error reporting (Shire)
-+* Auto global fixes and refactoring (Gopal, Shire)
-+* Fix memory leaks in object serialization (Ilia)
-+* Memory cleanup code for destructor order (Gopal)
-+* Win32 build fixes (Ilia, Wez)
-+* ZTS and Php 4 build fixes (Bjori)
-+* Add apc_add() function (Rasmus)
-+* Add optional limited flag to apc_sma_info() (Rasmus)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.14</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2007-04-02</date>
-+ <notes>
-+* Build fix (Shire)
-+* Don't hook the upload hook if APC is disabled (Rasmus)
-+* Local shadow cache support (Gopal)
-+* Avoid uneccessary loops over op_arrays for "known" auto-globals (Gopal)
-+* Fix apc_add() to overwrite timed out user entries (Rasmus)
-+* Fix double inclusion of files with conditional classes in php4 (Gopal)
-+* Allocator fixes to reduce fragmentation (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <version>
-+ <release>3.0.15</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <date>2007-10-18</date>
-+ <notes>
-+* Eliminate a per-request time() syscall (Rasmus)
-+* Added rfc1867 prefix, name, and freq ini options (Shire)
-+* Allow deletion of individual user cache entries via apc.php (Sara)
-+* Fix overzealous cleanup during RSHUTDOWN (Gopal)
-+* Fix memory alignment and locking issues (Gopal)
-+* Make apc_compile insert/replace entries (Shire)
-+* Make mixed inheritance recompile & cache afresh (Gopal)
-+* Make nostat mode search include_path for canonicalization (Gopal)
-+* ZTS & other compile fixes (Gopal, Edin, Shire)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.0.16</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2008-03-26</date>
-+ <notes>
-+* Fix for longstanding cache-full crash (Christian Seiler)
-+ http://news.php.net/php.pecl.dev/4951 for the details
-+* Added optional shm unmap on a fatal signal feature (Lucas Nealan)
-+* Added PTHREAD_MUTEX_ADAPTIVE_NP option pthread locks (Paul Saab)
-+* Minor cleanups (Lucas Nealan)
-+* Added configure option to enable apc_cache_info('filehits') (Shire)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.0.17</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2008-03-29</date>
-+ <notes>
-+* Crash fixes
-+* Fix apc_add() cache expunge bug (Rasmus)
-+* Added parameter to apc_fetch to determine success/failure when fetching booleans (shire)
-+* Fix misc. memleaks (shire)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.0.18</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2008-03-29</date>
-+ <notes>
-+- Revert apc_expunge_cb bug-fix
-+- Misc memleaks
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.0.19</release>
-+ <api>3.0.0</api>
-+ </version>
-+ <stability>
-+ <release>stable</release>
-+ <api>stable</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2008-05-15</date>
-+ <notes>
-+- Safe-mode and fast-cgi fixes
-+- Fix double-free of builtin_functions
-+- php 5.3 fixes
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.1.1</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>beta</release>
-+ <api>beta</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2008-12-12</date>
-+ <notes>
-+- PHP4 compatibilty break
-+- apc_pool allocator (Gopal)
-+- doubly-linked sma allocator (Shire)
-+- php 5.3 gc compatibility (Gopal)
-+- APCIterator for easy access (Shire)
-+- apc_delete_file (Shire)
-+- apc_inc/apc_dec/apc_cas functions (Shire)
-+- apc.canonicalize (Gopal)
-+- apc.preload_path (Gopal)
-+- apc.rfc1867_ttl (Shire)
-+- apc.file_md5 (Shire)
-+- consolidate locking macros (Shire)
-+- remove futex/TSRM locks (Shire)
-+- non-blocking semaphore locks (Shire)
-+- zval* object rework (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.1.2</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>beta</release>
-+ <api>beta</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2008-12-12</date>
-+ <notes>
-+- pecl package.xml/build fixes (bjori)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.1.3</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>beta</release>
-+ <api>beta</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2009-08-13</date>
-+ <notes>
-+- pecl package.xml/build fixes (bjori)
-+- 5.3 support + test-cases (Gopal)
-+- Lazy loading support (Shire)
-+- Fix PCRE module init order issues (Shire)
-+- APCIterator fixes (Shire)
-+- Cache slam checks (Gopal)
-+- ZEND_JMP_SET support (Shire)
-+- apc.use_request_time option (shire)
-+- apc.php hostname fixes (Shire)
-+- memprotect framework (Gopal)
-+- Win32 build-fixes (Kalle)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.1.3p1</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>beta</release>
-+ <api>beta</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2009-08-14</date>
-+ <notes>
-+- fix pecl build / package.xml (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.1.4</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>beta</release>
-+ <api>beta</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2010-08-05</date>
-+ <notes>
-+- Windows builds may now have filehits and memory protection if enabled (Kalle)
-+- Renamed the memory protection configure option to --enable-apc-memprotect (Kalle, Shire)
-+- ZTS fixes and optimizations (Kalle, Felipe)
-+- Win32 stat support (Pierre, Kalle)
-+- Added support for interned strings, run-time caches and Zend Engine 2.4 (Dmitry)
-+- Added apc_exists() (Rasmus)
-+- Fixed potential XSS in apc.php, CVE-2010-3294 (Pierre, Matt Chapman)
-+- Fixed pecl bug #17597 (keys with embedded NUL) (Gopal)
-+- Fixed pecl bug #17650 (Fix goto jump offsets) (Gopal)
-+- Fixed pecl bug #17527 (Standardized error reporting) (Gopal, Paul Dragoonis)
-+- Fixed pecl bug #17089 (Scrub the constant table of all inherited members before caching) (Gopal)
-+- Fixed pecl bug #16860 (files can be included more than once even when include/require_once are used) (Pierre)
-+- Fixed pecl bug #16717 (apc_fetch dies after 1 hour, regardless of ttl settings) (Kalle)
-+- Fixed pecl bug #17597 (apc user cache keys with embedded NULs) (Gopal)
-+- Fixed pecl bug #13583 (apc upload progress fixes) (Gopal)
-+ </notes>
-+ </release>
-+ <release>
-+ <version>
-+ <release>3.1.5</release>
-+ <api>3.1.0</api>
-+ </version>
-+ <stability>
-+ <release>beta</release>
-+ <api>stable</api>
-+ </stability>
-+ <license uri="http://www.php.net/license">PHP License</license>
-+ <date>2010-11-01</date>
-+ <notes>
-+- Reduce usage of CG(open_files) (mkoppanen at php dot net)
-+- Add support for php-trunk, new op code, new internals string format, etc. (Dmitry)
-+- apc_debug are not compiler-valid NOPs for non-debug builds
-+
-+- Fixed relative paths resolution when ./foo/a.php or ../foo/a.php (or similar path)
-+ are used. 'foo/a.php' path behaviors remain unchanged
-+- Fixed a possible memory corruption, when partial path cannot be resolved
-+ by expand_filepath()
-+- Fixed notices in apc.php (Tomasz Krawczyk)
-+
-+- Fixed Bug #17978: standardize user keys to include NULs in identifier_len. Z_STRLEN_P() doesn't, so add to it.
-+- Fixed bug #16966, apc produces tons of warnings "Unable to allocate memory for pool".
-+
-+- Added --enable-apc-debug configuration argument to enable debugging (Kalle)
-+- Added support for internal debugging on Windows (Kalle)
-+- ZTS optimizations (Kalle)
-+ </notes>
-+ </release>
-+ </changelog>
-+</package>
---- /dev/null
-+++ b/ext/apc/pgsql_s_lock.c
+diff -Naur a/ext/apc/pgsql_s_lock.c b/ext/apc/pgsql_s_lock.c
+--- a/ext/apc/pgsql_s_lock.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/pgsql_s_lock.c 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,391 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: pgsql_s_lock.c 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: pgsql_s_lock.c 307048 2011-01-03 23:53:17Z kalle $ */
+
+/*-------------------------------------------------------------------------
+ *
+#endif /* HAVE_SPINLOCKS */
+
+#endif /* APC_SPIN_LOCKS */
---- /dev/null
-+++ b/ext/apc/pgsql_s_lock.h
+diff -Naur a/ext/apc/pgsql_s_lock.h b/ext/apc/pgsql_s_lock.h
+--- a/ext/apc/pgsql_s_lock.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/pgsql_s_lock.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,928 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: pgsql_s_lock.h 302175 2010-08-13 06:20:28Z kalle $ */
++/* $Id: pgsql_s_lock.h 307048 2011-01-03 23:53:17Z kalle $ */
+
+/*-------------------------------------------------------------------------
+ *
+#endif
+
+#endif /* S_LOCK_H */
---- /dev/null
-+++ b/ext/apc/php_apc.c
-@@ -0,0 +1,1812 @@
+diff -Naur a/ext/apc/php_apc.c b/ext/apc/php_apc.c
+--- a/ext/apc/php_apc.c 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/php_apc.c 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,1716 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: php_apc.c 303642 2010-09-21 15:42:01Z kalle $ */
++/* $Id: php_apc.c 325875 2012-05-27 17:15:26Z felipe $ */
+
+#include "apc_zend.h"
+#include "apc_cache.h"
+ apc_globals->use_request_time = 1;
+ apc_globals->lazy_class_table = NULL;
+ apc_globals->lazy_function_table = NULL;
++ apc_globals->serializer_name = NULL;
++ apc_globals->serializer = NULL;
+}
+
+static void php_apc_shutdown_globals(zend_apc_globals* apc_globals TSRMLS_DC)
+static long apc_atol(const char *str, int str_len)
+{
+#if PHP_MAJOR_VERSION >= 6 || PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3
-+ return zend_atol(str, str_len);
++ return zend_atol(str, str_len);
+#else
-+ /* Re-implement zend_atol() for 5.2.x */
-+ long retval;
-+
-+ if (!str_len) {
-+ str_len = strlen(str);
-+ }
-+
-+ retval = strtol(str, NULL, 0);
-+
-+ if (str_len > 0) {
-+ switch (str[str_len - 1]) {
-+ case 'g':
-+ case 'G':
-+ retval *= 1024;
-+ /* break intentionally missing */
-+ case 'm':
-+ case 'M':
-+ retval *= 1024;
-+ /* break intentionally missing */
-+ case 'k':
-+ case 'K':
-+ retval *= 1024;
-+ break;
-+ }
-+ }
++ /* Re-implement zend_atol() for 5.2.x */
++ long retval;
++
++ if (!str_len) {
++ str_len = strlen(str);
++ }
++
++ retval = strtol(str, NULL, 0);
++
++ if (str_len > 0) {
++ switch (str[str_len - 1]) {
++ case 'g':
++ case 'G':
++ retval *= 1024;
++ /* break intentionally missing */
++ case 'm':
++ case 'M':
++ retval *= 1024;
++ /* break intentionally missing */
++ case 'k':
++ case 'K':
++ retval *= 1024;
++ break;
++ }
++ }
+
-+ return retval;
++ return retval;
+#endif
+}
+
+
+static PHP_INI_MH(OnUpdateShmSize) /* {{{ */
+{
-+ long s = apc_atol(new_value, new_value_length);
++ long s = apc_atol(new_value, new_value_length);
+
-+ if(s <= 0) {
-+ return FAILURE;
-+ }
++ if(s <= 0) {
++ return FAILURE;
++ }
+
-+ if(s < 1048576L) {
-+ /* if it's less than 1Mb, they are probably using the old syntax */
-+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "apc.shm_size now uses M/G suffixes, please update your ini files");
-+ s = s * 1048576L;
-+ }
++ if(s < 1048576L) {
++ /* if it's less than 1Mb, they are probably using the old syntax */
++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "apc.shm_size now uses M/G suffixes, please update your ini files");
++ s = s * 1048576L;
++ }
+
-+ APCG(shm_size) = s;
++ APCG(shm_size) = s;
+
-+ return SUCCESS;
++ return SUCCESS;
+}
+/* }}} */
+
+STD_PHP_INI_BOOLEAN("apc.use_request_time", "1", PHP_INI_ALL, OnUpdateBool, use_request_time, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.lazy_functions", "0", PHP_INI_SYSTEM, OnUpdateBool, lazy_functions, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.lazy_classes", "0", PHP_INI_SYSTEM, OnUpdateBool, lazy_classes, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.serializer", "default", PHP_INI_SYSTEM, OnUpdateStringUnempty, serializer_name, zend_apc_globals, apc_globals)
+PHP_INI_END()
+
+/* }}} */
+/* {{{ PHP_MINFO_FUNCTION(apc) */
+static PHP_MINFO_FUNCTION(apc)
+{
++ apc_serializer_t *serializer = NULL;
++ smart_str names = {0,};
++ int i;
++
+ php_info_print_table_start();
+ php_info_print_table_header(2, "APC Support", APCG(enabled) ? "enabled" : "disabled");
+ php_info_print_table_row(2, "Version", PHP_APC_VERSION);
+ php_info_print_table_row(2, "MMAP Support", "Disabled");
+#endif
+ php_info_print_table_row(2, "Locking type", APC_LOCK_TYPE);
-+ php_info_print_table_row(2, "Revision", "$Revision: 303642 $");
++
++ for( i = 0, serializer = apc_get_serializers(TSRMLS_C);
++ serializer->name != NULL;
++ serializer++, i++) {
++ if(i != 0) smart_str_appends(&names, ", ");
++ smart_str_appends(&names, serializer->name);
++ }
++
++ if(names.c) {
++ smart_str_0(&names);
++ php_info_print_table_row(2, "Serialization Support", names.c);
++ smart_str_free(&names);
++ } else {
++ php_info_print_table_row(2, "Serialization Support", "broken");
++ }
++
++ php_info_print_table_row(2, "Revision", "$Revision: 325875 $");
+ php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
+ php_info_print_table_end();
+ DISPLAY_INI_ENTRIES();
+/* {{{ proto array apc_cache_info([string type [, bool limited]]) */
+PHP_FUNCTION(apc_cache_info)
+{
-+ apc_cache_info_t* info;
-+ apc_cache_link_t* p;
-+ zval* list;
++ zval* info;
+ char *cache_type;
+ int ct_len;
-+ zend_bool limited=0;
-+ char md5str[33];
++ zend_bool limited = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &cache_type, &ct_len, &limited) == FAILURE) {
+ return;
+ RETURN_FALSE;
+ }
+
-+ array_init(return_value);
-+ add_assoc_long(return_value, "num_slots", info->num_slots);
-+ add_assoc_long(return_value, "ttl", info->ttl);
-+
-+ add_assoc_double(return_value, "num_hits", (double)info->num_hits);
-+ add_assoc_double(return_value, "num_misses", (double)info->num_misses);
-+ add_assoc_double(return_value, "num_inserts", (double)info->num_inserts);
-+ add_assoc_double(return_value, "expunges", (double)info->expunges);
-+
-+ add_assoc_long(return_value, "start_time", info->start_time);
-+ add_assoc_double(return_value, "mem_size", (double)info->mem_size);
-+ add_assoc_long(return_value, "num_entries", info->num_entries);
-+#ifdef MULTIPART_EVENT_FORMDATA
-+ add_assoc_long(return_value, "file_upload_progress", 1);
-+#else
-+ add_assoc_long(return_value, "file_upload_progress", 0);
-+#endif
-+#if APC_MMAP
-+ add_assoc_stringl(return_value, "memory_type", "mmap", sizeof("mmap")-1, 1);
-+#else
-+ add_assoc_stringl(return_value, "memory_type", "IPC shared", sizeof("IPC shared")-1, 1);
-+#endif
-+#if APC_SEM_LOCKS
-+ add_assoc_stringl(return_value, "locking_type", "IPC semaphore", sizeof("IPC semaphore")-1, 1);
-+#elif APC_PTHREADMUTEX_LOCKS
-+ add_assoc_stringl(return_value, "locking_type", "pthread mutex", sizeof("pthread mutex")-1, 1);
-+#elif APC_SPIN_LOCKS
-+ add_assoc_stringl(return_value, "locking_type", "spin", sizeof("spin")-1, 1);
-+#else
-+ add_assoc_stringl(return_value, "locking_type", "file", sizeof("file")-1, 1);
-+#endif
-+ if(limited) {
-+ apc_cache_free_info(info TSRMLS_CC);
-+ return;
-+ }
-+
-+ ALLOC_INIT_ZVAL(list);
-+ array_init(list);
-+
-+ for (p = info->list; p != NULL; p = p->next) {
-+ zval* link;
-+
-+ ALLOC_INIT_ZVAL(link);
-+ array_init(link);
-+
-+ if(p->type == APC_CACHE_ENTRY_FILE) {
-+ add_assoc_string(link, "filename", p->data.file.filename, 1);
-+#ifdef PHP_WIN32
-+ {
-+ char buf[20];
-+ sprintf(buf, "%I64d", p->data.file.device);
-+ add_assoc_string(link, "device", buf, 1);
-+
-+ sprintf(buf, "%I64d", p->data.file.inode);
-+ add_assoc_string(link, "inode", buf, 1);
-+ }
-+#else
-+ add_assoc_long(link, "device", p->data.file.device);
-+ add_assoc_long(link, "inode", p->data.file.inode);
-+#endif
-+
-+
-+ add_assoc_string(link, "type", "file", 1);
-+ if(APCG(file_md5)) {
-+ make_digest(md5str, p->data.file.md5);
-+ add_assoc_string(link, "md5", md5str, 1);
-+ }
-+ } else if(p->type == APC_CACHE_ENTRY_USER) {
-+ add_assoc_string(link, "info", p->data.user.info, 1);
-+ add_assoc_long(link, "ttl", (long)p->data.user.ttl);
-+ add_assoc_string(link, "type", "user", 1);
-+ }
-+
-+ add_assoc_double(link, "num_hits", (double)p->num_hits);
-+
-+ add_assoc_long(link, "mtime", p->mtime);
-+ add_assoc_long(link, "creation_time", p->creation_time);
-+ add_assoc_long(link, "deletion_time", p->deletion_time);
-+ add_assoc_long(link, "access_time", p->access_time);
-+ add_assoc_long(link, "ref_count", p->ref_count);
-+ add_assoc_long(link, "mem_size", p->mem_size);
-+
-+
-+ add_next_index_zval(list, link);
-+ }
-+ add_assoc_zval(return_value, "cache_list", list);
-+
-+ ALLOC_INIT_ZVAL(list);
-+ array_init(list);
-+
-+ for (p = info->deleted_list; p != NULL; p = p->next) {
-+ zval* link;
-+
-+ ALLOC_INIT_ZVAL(link);
-+ array_init(link);
-+
-+ if(p->type == APC_CACHE_ENTRY_FILE) {
-+ add_assoc_string(link, "filename", p->data.file.filename, 1);
-+#ifdef PHP_WIN32
-+ {
-+ char buf[20];
-+ sprintf(buf, "%I64d", p->data.file.device);
-+ add_assoc_string(link, "device", buf, 1);
-+
-+ sprintf(buf, "%I64d", p->data.file.inode);
-+ add_assoc_string(link, "inode", buf, 1);
-+ }
-+#else
-+ add_assoc_long(link, "device", p->data.file.device);
-+ add_assoc_long(link, "inode", p->data.file.inode);
-+#endif
-+
-+ add_assoc_string(link, "type", "file", 1);
-+ if(APCG(file_md5)) {
-+ make_digest(md5str, p->data.file.md5);
-+ add_assoc_string(link, "md5", md5str, 1);
-+ }
-+ } else if(p->type == APC_CACHE_ENTRY_USER) {
-+ add_assoc_string(link, "info", p->data.user.info, 1);
-+ add_assoc_long(link, "ttl", (long)p->data.user.ttl);
-+ add_assoc_string(link, "type", "user", 1);
-+ }
-+
-+ add_assoc_double(link, "num_hits", (double)p->num_hits);
-+
-+ add_assoc_long(link, "mtime", p->mtime);
-+ add_assoc_long(link, "creation_time", p->creation_time);
-+ add_assoc_long(link, "deletion_time", p->deletion_time);
-+ add_assoc_long(link, "access_time", p->access_time);
-+ add_assoc_long(link, "ref_count", p->ref_count);
-+ add_assoc_long(link, "mem_size", p->mem_size);
-+ add_next_index_zval(list, link);
-+ }
-+ add_assoc_zval(return_value, "deleted_list", list);
++ RETURN_ZVAL(info, 0, 1);
+
-+ apc_cache_free_info(info TSRMLS_CC);
+}
+/* }}} */
+
+ return 0;
+ }
+
++ if (!APCG(serializer) && APCG(serializer_name)) {
++ /* Avoid race conditions between MINIT of apc and serializer exts like igbinary */
++ APCG(serializer) = apc_find_serializer(APCG(serializer_name) TSRMLS_CC);
++ }
++
+ HANDLE_BLOCK_INTERRUPTIONS();
+ APCG(current_cache) = apc_user_cache;
+
+
+ if(!APCG(enabled)) return 0;
+
++ if (!APCG(serializer) && APCG(serializer_name)) {
++ /* Avoid race conditions between MINIT of apc and serializer exts like igbinary */
++ APCG(serializer) = apc_find_serializer(APCG(serializer_name) TSRMLS_CC);
++ }
++
+ HANDLE_BLOCK_INTERRUPTIONS();
+
+ APCG(current_cache) = apc_user_cache;
+ goto freepool;
+ }
+
-+ if (apc_cache_is_last_key(apc_user_cache, &key, 0, t TSRMLS_CC)) {
-+ goto freepool;
++ if (apc_cache_is_last_key(apc_user_cache, &key, t TSRMLS_CC)) {
++ goto freepool;
+ }
+
+ if (!(entry = apc_cache_make_user_entry(strkey, strkey_len, val, &ctxt, ttl TSRMLS_CC))) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &strkey, &strkey_len, &(args.step), &success) == FAILURE) {
+ return;
+ }
++
++ if (success) {
++ zval_dtor(success);
++ }
+
+ if(_apc_update(strkey, strkey_len, inc_updater, &args TSRMLS_CC)) {
+ if(success) ZVAL_TRUE(success);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &strkey, &strkey_len, &(args.step), &success) == FAILURE) {
+ return;
+ }
++
++ if (success) {
++ zval_dtor(success);
++ }
+
+ args.step = args.step * -1;
+
+
+ orig_current_execute_data = EG(current_execute_data);
+ zend_try {
-+ if (apc_compile_cache_entry(keys[i], &file_handle, ZEND_INCLUDE, t, &op_arrays[i], &cache_entries[i] TSRMLS_CC) != SUCCESS) {
++ if (apc_compile_cache_entry(&keys[i], &file_handle, ZEND_INCLUDE, t, &op_arrays[i], &cache_entries[i] TSRMLS_CC) != SUCCESS) {
+ op_arrays[i] = NULL;
+ cache_entries[i] = NULL;
+ add_assoc_long(return_value, Z_STRVAL_PP(hentry), -2); /* -2: input or cache insertion error */
+
+PHP_APC_ARGINFO
+ZEND_BEGIN_ARG_INFO(arginfo_apc_delete_file, 0)
-+ ZEND_ARG_INFO(0, keys)
++ ZEND_ARG_INFO(0, keys)
+ZEND_END_ARG_INFO()
+
+PHP_APC_ARGINFO
+ZEND_BEGIN_ARG_INFO(arginfo_apc_delete, 0)
-+ ZEND_ARG_INFO(0, keys)
++ ZEND_ARG_INFO(0, keys)
+ZEND_END_ARG_INFO()
+
+PHP_APC_ARGINFO
+
+PHP_APC_ARGINFO
+ZEND_BEGIN_ARG_INFO(arginfo_apc_exists, 0)
-+ ZEND_ARG_INFO(0, keys)
++ ZEND_ARG_INFO(0, keys)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/php_apc.h
+diff -Naur a/ext/apc/php_apc.h b/ext/apc/php_apc.h
+--- a/ext/apc/php_apc.h 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/php_apc.h 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,54 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2010 The PHP Group |
++ | Copyright (c) 2006-2011 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 |
+
+ */
+
-+/* $Id: php_apc.h 305846 2010-11-30 09:36:57Z gopalv $ */
++/* $Id: php_apc.h 326713 2012-07-19 22:07:31Z rasmus $ */
+
+#ifndef PHP_APC_H
+#define PHP_APC_H
+#include "apc_php.h"
+#include "apc_globals.h"
+
-+#define PHP_APC_VERSION "3.1.6"
++#define PHP_APC_VERSION "3.1.11"
+
+extern zend_module_entry apc_module_entry;
+#define apc_module_ptr &apc_module_entry
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
---- /dev/null
-+++ b/ext/apc/TECHNOTES.txt
+diff -Naur a/ext/apc/TECHNOTES.txt b/ext/apc/TECHNOTES.txt
+--- a/ext/apc/TECHNOTES.txt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/TECHNOTES.txt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,361 @@
+APC Quick-Start Braindump
+
+ };
+
+ Since this is at the start of the shared memory segment, these values are accessible
-+ across all the yapache processes and hence access to them has to be locked.
++ across all the apache processes and hence access to them has to be locked.
+
+ After the header we have an array of slots. The number of slots is user-defined
+ through the apc.num_slots ini hint. Each slot is described by:
+If you made it to the end of this, you should have a pretty good idea of where things are in
+the code. I skimmed over a lot of things, so plan on spending some time reading through the code.
+
---- /dev/null
-+++ b/ext/apc/tests/apc_001.phpt
+diff -Naur a/ext/apc/tests/apc_001.phpt b/ext/apc/tests/apc_001.phpt
+--- a/ext/apc/tests/apc_001.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_001.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,32 @@
+--TEST--
+APC: apc_store/fetch with strings
+string(4) "nice"
+string(11) "hello world"
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_002.phpt
+diff -Naur a/ext/apc/tests/apc_002.phpt b/ext/apc/tests/apc_002.phpt
+--- a/ext/apc/tests/apc_002.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_002.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,34 @@
+--TEST--
+APC: apc_store/fetch with objects
+ bool(true)
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_003b.phpt
+diff -Naur a/ext/apc/tests/apc_003b.phpt b/ext/apc/tests/apc_003b.phpt
+--- a/ext/apc/tests/apc_003b.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_003b.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,117 @@
+--TEST--
+APC: apc_store/fetch with objects (php 5.3)
+ bool(true)
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_003.phpt
+diff -Naur a/ext/apc/tests/apc_003.phpt b/ext/apc/tests/apc_003.phpt
+--- a/ext/apc/tests/apc_003.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_003.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,117 @@
+--TEST--
+APC: apc_store/fetch with objects (php pre-5.3)
+ bool(true)
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_004.phpt
+diff -Naur a/ext/apc/tests/apc_004.phpt b/ext/apc/tests/apc_004.phpt
+--- a/ext/apc/tests/apc_004.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_004.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,38 @@
+--TEST--
+APC: apc_store/fetch with bools
+bool(false)
+bool(false)
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_005.phpt
+diff -Naur a/ext/apc/tests/apc_005.phpt b/ext/apc/tests/apc_005.phpt
+--- a/ext/apc/tests/apc_005.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_005.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,50 @@
+--TEST--
+APC: apc_store/fetch with arrays of objects
+ }
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_006.phpt
-@@ -0,0 +1,72 @@
+diff -Naur a/ext/apc/tests/apc_006.phpt b/ext/apc/tests/apc_006.phpt
+--- a/ext/apc/tests/apc_006.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_006.phpt 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,73 @@
+--TEST--
+APC: apc_store/fetch reference test
+--SKIPIF--
+apc.enabled=1
+apc.enable_cli=1
+apc.file_update_protection=0
++apc.serializer=default
+report_memleaks=0
+--FILE--
+<?php
+ }
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_007.phpt
+diff -Naur a/ext/apc/tests/apc_007.phpt b/ext/apc/tests/apc_007.phpt
+--- a/ext/apc/tests/apc_007.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_007.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,46 @@
+--TEST--
+APC: apc_inc/apc_dec test
+$foobar -= 1 = 2
+pass by ref success 1
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_008.phpt
+diff -Naur a/ext/apc/tests/apc_008.phpt b/ext/apc/tests/apc_008.phpt
+--- a/ext/apc/tests/apc_008.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_008.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,34 @@
+--TEST--
+APC: apc_cas test
+$perfection == 2 ? 1 : 2 = epic fail
+$foobar = 1
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_009.phpt
+diff -Naur a/ext/apc/tests/apc_009.phpt b/ext/apc/tests/apc_009.phpt
+--- a/ext/apc/tests/apc_009.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_009.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,97 @@
+--TEST--
+APC: apc_delete_file test
+apc_009-2.php Not Found
+nofile.php Not Found
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_010.phpt
+diff -Naur a/ext/apc/tests/apc_010.phpt b/ext/apc/tests/apc_010.phpt
+--- a/ext/apc/tests/apc_010.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_010.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,83 @@
+--TEST--
+APC: apc_store/fetch/add with array of key/value pairs.
+ int(4)
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc53_001.phpt
+diff -Naur a/ext/apc/tests/apc53_001.phpt b/ext/apc/tests/apc53_001.phpt
+--- a/ext/apc/tests/apc53_001.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc53_001.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,33 @@
+--TEST--
+APC: classes with namespaces (php 5.3)
+ string(11) "hello world"
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc53_002.phpt
+diff -Naur a/ext/apc/tests/apc53_002.phpt b/ext/apc/tests/apc53_002.phpt
+--- a/ext/apc/tests/apc53_002.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc53_002.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,47 @@
+--TEST--
+APC: global spaces (php 5.3)
+}
+string(8) "IT WORKS"
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc53_003.phpt
+diff -Naur a/ext/apc/tests/apc53_003.phpt b/ext/apc/tests/apc53_003.phpt
+--- a/ext/apc/tests/apc53_003.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc53_003.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,31 @@
+--TEST--
+APC: anonymous functions (php 5.3)
+Hello World
+Hello PHP
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc53_004.phpt
+diff -Naur a/ext/apc/tests/apc53_004.phpt b/ext/apc/tests/apc53_004.phpt
+--- a/ext/apc/tests/apc53_004.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc53_004.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,33 @@
+--TEST--
+APC: closures (php 5.3)
+double of 9 is 18
+triple of 4 is 12
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc53_005.phpt
+diff -Naur a/ext/apc/tests/apc53_005.phpt b/ext/apc/tests/apc53_005.phpt
+--- a/ext/apc/tests/apc53_005.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc53_005.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,35 @@
+--TEST--
+APC: goto (php 5.3)
+8
+10
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_bin_001.phpt
+diff -Naur a/ext/apc/tests/apc_bin_001.phpt b/ext/apc/tests/apc_bin_001.phpt
+--- a/ext/apc/tests/apc_bin_001.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_bin_001.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,24 @@
+--TEST--
+APC: bindump user cache
+bool(false)
+string(9) "testvalue"
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/apc_bin_002-1.inc
+diff -Naur a/ext/apc/tests/apc_bin_002-1.inc b/ext/apc/tests/apc_bin_002-1.inc
+--- a/ext/apc/tests/apc_bin_002-1.inc 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_bin_002-1.inc 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,42 @@
+<?php
+
+ function dummy() { return 1; }
+}
+
---- /dev/null
-+++ b/ext/apc/tests/apc_bin_002-2.inc
+diff -Naur a/ext/apc/tests/apc_bin_002-2.inc b/ext/apc/tests/apc_bin_002-2.inc
+--- a/ext/apc/tests/apc_bin_002-2.inc 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_bin_002-2.inc 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,5 @@
+<?php
+
+echo "Failed to use cached version!\n";
+
+?>
---- /dev/null
-+++ b/ext/apc/tests/apc_bin_002.phpt
+diff -Naur a/ext/apc/tests/apc_bin_002.phpt b/ext/apc/tests/apc_bin_002.phpt
+--- a/ext/apc/tests/apc_bin_002.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/apc_bin_002.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,53 @@
+--TEST--
+APC: bindump file cache part 1
+inherited class constant: Success
+
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_001.phpt
+diff -Naur a/ext/apc/tests/iterator_001.phpt b/ext/apc/tests/iterator_001.phpt
+--- a/ext/apc/tests/iterator_001.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_001.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,110 @@
+--TEST--
+APC: APCIterator general
+ string(4) "key9"
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_002.phpt
+diff -Naur a/ext/apc/tests/iterator_002.phpt b/ext/apc/tests/iterator_002.phpt
+--- a/ext/apc/tests/iterator_002.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_002.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,36 @@
+--TEST--
+APC: APCIterator regex
+ string(5) "key40"
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_003.phpt
+diff -Naur a/ext/apc/tests/iterator_003.phpt b/ext/apc/tests/iterator_003.phpt
+--- a/ext/apc/tests/iterator_003.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_003.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,110 @@
+--TEST--
+APC: APCIterator chunk size
+ string(4) "key9"
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_004.phpt
+diff -Naur a/ext/apc/tests/iterator_004.phpt b/ext/apc/tests/iterator_004.phpt
+--- a/ext/apc/tests/iterator_004.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_004.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,36 @@
+--TEST--
+APC: APCIterator regex & chunk size & list
+ string(5) "key40"
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_005.phpt
+diff -Naur a/ext/apc/tests/iterator_005.phpt b/ext/apc/tests/iterator_005.phpt
+--- a/ext/apc/tests/iterator_005.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_005.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,112 @@
+--TEST--
+APC: APCIterator delete
+ string(4) "key9"
+}
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_006.phpt
-@@ -0,0 +1,1535 @@
+diff -Naur a/ext/apc/tests/iterator_006.phpt b/ext/apc/tests/iterator_006.phpt
+--- a/ext/apc/tests/iterator_006.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_006.phpt 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,1536 @@
+--TEST--
+APC: APCIterator formats
+--SKIPIF--
+apc.enabled=1
+apc.enable_cli=1
+apc.file_update_protection=0
++apc.user_entries_hint=4096
+--FILE--
+<?php
+
+============================
+
+===DONE===
---- /dev/null
-+++ b/ext/apc/tests/iterator_007.phpt
+diff -Naur a/ext/apc/tests/iterator_007.phpt b/ext/apc/tests/iterator_007.phpt
+--- a/ext/apc/tests/iterator_007.phpt 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/iterator_007.phpt 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,36 @@
+--TEST--
+APC: APCIterator Overwriting the ctor
+bool(false)
+bool(false)
+
---- /dev/null
-+++ b/ext/apc/tests/php_5_3_ns.inc
+diff -Naur a/ext/apc/tests/php_5_3_ns.inc b/ext/apc/tests/php_5_3_ns.inc
+--- a/ext/apc/tests/php_5_3_ns.inc 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/php_5_3_ns.inc 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,18 @@
+<?php
+namespace Foo\Bar;
+ sort();
+ }
+}
---- /dev/null
-+++ b/ext/apc/tests/skipif.inc
+diff -Naur a/ext/apc/tests/skipif.inc b/ext/apc/tests/skipif.inc
+--- a/ext/apc/tests/skipif.inc 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/tests/skipif.inc 2012-07-20 00:10:35.000000000 +0200
@@ -0,0 +1,6 @@
+<?php
+
+//if (!ini_get('apc.enabled')) die("skip apc not enabled");
+
+?>
---- /dev/null
-+++ b/ext/apc/TODO
-@@ -0,0 +1,32 @@
+diff -Naur a/ext/apc/TODO b/ext/apc/TODO
+--- a/ext/apc/TODO 1970-01-01 01:00:00.000000000 +0100
++++ b/ext/apc/TODO 2012-07-20 00:10:35.000000000 +0200
+@@ -0,0 +1,35 @@
+Known Bugs
+
+1. Gallery2 doesn't work with PHP5+APC. There is something wrong
+
+1. The following configurations (build arguments) have not been implemented yet
+
-+ (*) --enable-apc-mmap Memory mapping support
-+ (*) --enable-apc-sem Semaphore locking support (FCNTL replacement)
-+ (*) --enable-apc-phreadmutex Thread mutexes, while implemented we should probably rename the internals to thread
++ (*) --enable-apc-mmap Memory mapping support
++ (*) --enable-apc-sem Semaphore locking support (FCNTL replacement)
++ (*) --enable-apc-phreadmutex Thread mutexes, while implemented we should probably rename the internals to thread
++ (*) --enable-apc-pthreadrwlocks Thread mutexes, read/write locking
+
+2. Non-blocking locks is not supported either
+
+3. Update fileinfo to support stat info in a more portable way (see PECL #17903)
-\ No newline at end of file
++
++4. Check whether the signal handling needs to be enabled, and if it makes sense on Windows
+\ Kein Zeilenumbruch am Dateiende.