-diff -Naur php-5.3.1.orig/ext/apc/apc_bin.c php-5.3.1/ext/apc/apc_bin.c
---- php-5.3.1.orig/ext/apc/apc_bin.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_bin.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,946 @@
+--- /dev/null
++++ b/ext/apc/apc_bin.c
+@@ -0,0 +1,987 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2009 The PHP Group |
++ | Copyright (c) 2006-2010 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 284580 2009-07-22 06:05:31Z kalle $ */
++/* $Id: apc_bin.c 303383 2010-09-15 08:15:58Z dmitry $ */
+
+/* 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
+ ptr = (void*)((long)(ptr) - (long)(bd)); \
+ printf("%x in %s on line %d", ptr, __FILE__, __LINE__); \
+ } else if((long)ptr > bd->size) { /* not swizzled */ \
-+ apc_eprint("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d", (long)bd, ptr, ((long)bd + bd->size), __FILE__, __LINE__); \
++ 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__); \
+ } \
+ printf("\n"); \
+ } while(0);
+ if((long)bd < (long)ptr && (ulong)ptr < ((long)bd + bd->size)) { \
+ ptr = (void*)((long)(ptr) - (long)(bd)); \
+ } else if((ulong)ptr > bd->size) { /* not swizzled */ \
-+ apc_eprint("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d", (long)bd, ptr, ((long)bd + bd->size), __FILE__, __LINE__); \
++ 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__); \
+ } \
+ } while(0);
+
+#endif
+
+
-+static void *apc_bd_alloc(size_t size);
-+static void apc_bd_free(void *ptr);
-+static void *apc_bd_alloc_ex(void *ptr_new, size_t size);
++static void *apc_bd_alloc(size_t size TSRMLS_DC);
++static void apc_bd_free(void *ptr TSRMLS_DC);
++static void *apc_bd_alloc_ex(void *ptr_new, size_t size TSRMLS_DC);
+
+typedef void (*apc_swizzle_cb_t)(apc_bd_t *bd, zend_llist *ll, void *ptr TSRMLS_DC);
+
+
+/* {{{ apc_bd_alloc
+ * callback for copy_* functions */
-+static void *apc_bd_alloc(size_t size) {
-+ return apc_bd_alloc_ex(NULL, size);
++static void *apc_bd_alloc(size_t size TSRMLS_DC) {
++ return apc_bd_alloc_ex(NULL, size TSRMLS_CC);
+} /* }}} */
+
+
+/* {{{ apc_bd_free
+ * callback for copy_* functions */
-+static void apc_bd_free(void *ptr) {
++static void apc_bd_free(void *ptr TSRMLS_DC) {
+ size_t *size;
-+ TSRMLS_FETCH();
+ if(zend_hash_index_find(&APCG(apc_bd_alloc_list), (ulong)ptr, (void**)&size) == FAILURE) {
-+ apc_eprint("apc_bd_free could not free pointer (not found in list: %x)", ptr);
++ apc_error("apc_bd_free could not free pointer (not found in list: %x)" TSRMLS_CC, ptr);
+ }
+ 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);
+ * with a range of size. If ptr_new is NULL, returns the next available
+ * block of given size.
+ */
-+static void *apc_bd_alloc_ex(void *ptr_new, size_t size) {
++static void *apc_bd_alloc_ex(void *ptr_new, size_t size TSRMLS_DC) {
+ void *rval;
-+ TSRMLS_FETCH();
+
+ rval = APCG(apc_bd_alloc_ptr);
+ if(ptr_new != NULL) { /* reset ptrs */
+ } else { /* alloc block */
+ APCG(apc_bd_alloc_ptr) = (void*)((size_t)APCG(apc_bd_alloc_ptr) + size);
+#if APC_BINDUMP_DEBUG
-+ apc_nprint("apc_bd_alloc: rval: 0x%x ptr: 0x%x ubptr: 0x%x size: %d", rval, APCG(apc_bd_alloc_ptr), APCG(apc_bd_alloc_ubptr), size);
++ apc_notice("apc_bd_alloc: rval: 0x%x ptr: 0x%x ubptr: 0x%x size: %d" TSRMLS_CC, rval, APCG(apc_bd_alloc_ptr), APCG(apc_bd_alloc_ubptr), size);
+#endif
+ if(APCG(apc_bd_alloc_ptr) > APCG(apc_bd_alloc_ubptr)) {
-+ apc_eprint("Exceeded bounds check in apc_bd_alloc_ex by %d bytes.", (unsigned char *) APCG(apc_bd_alloc_ptr) - (unsigned char *) 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));
+ }
+ zend_hash_index_update(&APCG(apc_bd_alloc_list), (ulong)rval, &size, sizeof(size_t), NULL);
+ }
+ printf(" in %s on line %d \n", file, line);
+#endif
+ } else if((ulong)ptr > bd->size) {
-+ apc_eprint("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d", (long)bd, *ptr, ((long)bd + bd->size), file, line); \
++ 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); \
+ }
+ }
+} /* }}} */
+
+ /* swizzle op_array */
+ for(i=0; i < op_array->last; i++) {
++#ifndef ZEND_ENGINE_2_4
+ if(op_array->opcodes[i].result.op_type == IS_CONST) {
+ apc_swizzle_zval(bd, ll, &op_array->opcodes[i].result.u.constant TSRMLS_CC);
+ }
+ if(op_array->opcodes[i].op2.op_type == IS_CONST) {
+ apc_swizzle_zval(bd, ll, &op_array->opcodes[i].op2.u.constant TSRMLS_CC);
+ }
++#endif
+ switch (op_array->opcodes[i].opcode) {
+ case ZEND_JMP:
++#ifdef ZEND_ENGINE_2_4
++ apc_swizzle_ptr(bd, ll, &op_array->opcodes[i].op1.jmp_addr);
++#else
+ apc_swizzle_ptr(bd, ll, &op_array->opcodes[i].op1.u.jmp_addr);
++#endif
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
++#ifdef ZEND_ENGINE_2_4
++ apc_swizzle_ptr(bd, ll, &op_array->opcodes[i].op2.jmp_addr);
++#else
+ apc_swizzle_ptr(bd, ll, &op_array->opcodes[i].op2.u.jmp_addr);
++#endif
+ }
+ }
+ apc_swizzle_ptr(bd, ll, &op_array->opcodes);
+ apc_swizzle_ptr(bd, ll, &ce->name);
+ }
+
-+ if(ce->doc_comment) {
-+ apc_swizzle_ptr(bd, ll, &ce->doc_comment);
++ if (ce->type == ZEND_USER_CLASS && ZEND_CE_DOC_COMMENT(ce)) {
++ apc_swizzle_ptr(bd, ll, &ZEND_CE_DOC_COMMENT(ce));
+ }
+
+#ifndef ZEND_ENGINE_2
+#endif
+
+ 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]);
++ apc_swizzle_zval(bd, ll, ce->default_properties_table[i] TSRMLS_CC);
++ }
++ }
++ }
++#else
+ apc_swizzle_hashtable(bd, ll, &ce->default_properties, (apc_swizzle_cb_t)apc_swizzle_zval, 1 TSRMLS_CC);
++#endif
+
+#ifdef ZEND_ENGINE_2
+ apc_swizzle_hashtable(bd, ll, &ce->properties_info, (apc_swizzle_cb_t)apc_swizzle_property_info, 0 TSRMLS_CC);
+#endif
+
++#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]);
++ apc_swizzle_zval(bd, ll, ce->default_static_members_table[i] TSRMLS_CC);
++ }
++ }
++ }
++ ce->static_members_table = ce->default_static_members_table;
++#else
+ apc_swizzle_hashtable(bd, ll, &ce->default_static_members, (apc_swizzle_cb_t)apc_swizzle_zval, 1 TSRMLS_CC);
+
+ if(ce->static_members != &ce->default_static_members) {
+ } else {
+ apc_swizzle_ptr(bd, ll, &ce->static_members);
+ }
++#endif
+
+ apc_swizzle_hashtable(bd, ll, &ce->constants_table, (apc_swizzle_cb_t)apc_swizzle_zval, 1 TSRMLS_CC);
+
-+ if(ce->builtin_functions) {
-+ for(i=0; ce->builtin_functions[i].fname; i++) {
-+ apc_swizzle_function_entry(bd, ll, &ce->builtin_functions[i] TSRMLS_CC);
++ if(ce->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(ce)) {
++ for(i=0; ZEND_CE_BUILTIN_FUNCTIONS(ce)[i].fname; i++) {
++ apc_swizzle_function_entry(bd, ll, &ZEND_CE_BUILTIN_FUNCTIONS(ce)[i] TSRMLS_CC);
+ }
+ }
+
+ apc_swizzle_ptr(bd, ll, &ce->__tostring);
+#endif
+
-+ apc_swizzle_ptr(bd, ll, &ce->filename);
++ if (ce->type == ZEND_USER_CLASS) {
++ apc_swizzle_ptr(bd, ll, &ZEND_CE_FILENAME(ce));
++ }
+} /* }}} */
+
+
+ PHP_MD5Update(&context, (const unsigned char*)bd, bd->size);
+ PHP_MD5Final(digest, &context);
+ if(memcmp(md5_orig, digest, 16)) {
-+ apc_eprint("MD5 checksum of binary dump failed.");
++ apc_error("MD5 checksum of binary dump failed." TSRMLS_CC);
+ memcpy(bd->md5, md5_orig, 16); /* add back md5 checksum */
+ return -1;
+ }
+ crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*crc_p)) & 0xFF ];
+ }
+ if(crc_orig != crc) {
-+ apc_eprint("CRC32 checksum of binary dump failed.");
++ apc_error("CRC32 checksum of binary dump failed." TSRMLS_CC);
+ bd->crc = crc_orig;
+ return -1;
+ }
+
+ /* fixup hashtable destructor pointers */
+ ce->function_table.pDestructor = (dtor_func_t)zend_function_dtor;
++#ifndef ZEND_ENGINE_2_4
+ ce->default_properties.pDestructor = (dtor_func_t)zval_ptr_dtor_wrapper;
++#endif
+ ce->properties_info.pDestructor = (dtor_func_t)zval_ptr_dtor_wrapper;
++#ifndef ZEND_ENGINE_2_4
+ ce->default_static_members.pDestructor = (dtor_func_t)zval_ptr_dtor_wrapper;
+ if (ce->static_members) {
+ ce->static_members->pDestructor = (dtor_func_t)zval_ptr_dtor_wrapper;
+ }
++#endif
+ ce->constants_table.pDestructor = (dtor_func_t)zval_ptr_dtor_wrapper;
+}
+/* }}} */
+ for(i=0; i < apc_user_cache->num_slots; i++) {
+ sp = apc_user_cache->slots[i];
+ for(; sp != NULL; sp = sp->next) {
-+ if(apc_bin_checkfilter(user_vars, sp->key.data.user.identifier, sp->key.data.user.identifier_len+1)) {
++ if(apc_bin_checkfilter(user_vars, sp->key.data.user.identifier, sp->key.data.user.identifier_len)) {
+ size += sizeof(apc_bd_entry_t*) + sizeof(apc_bd_entry_t);
+ size += sp->value->mem_size - (sizeof(apc_cache_entry_t) - sizeof(apc_cache_entry_value_t));
+ count++;
+ }
+ } else {
+ /* TODO: Currently we don't support APC_CACHE_KEY_FILE type. We need to store the path and re-stat on load */
-+ apc_wprint("Excluding some files from apc_bin_dump[file]. Cached files must be included using full path with apc.stat=0.");
++ apc_warning("Excluding some files from apc_bin_dump[file]. Cached files must be included using full path with apc.stat=0." TSRMLS_CC);
+ }
+ }
+ }
+ bd = emalloc(size);
+ bd->size = size;
+ pool_ptr = emalloc(sizeof(apc_pool));
-+ apc_bd_alloc_ex(pool_ptr, sizeof(apc_pool));
-+ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_bd_alloc, apc_bd_free, NULL, NULL); /* ideally the pool wouldn't be alloc'd as part of this */
++ apc_bd_alloc_ex(pool_ptr, sizeof(apc_pool) TSRMLS_CC);
++ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_bd_alloc, apc_bd_free, NULL, NULL TSRMLS_CC); /* ideally the pool wouldn't be alloc'd as part of this */
+ if (!ctxt.pool) { /* TODO need to cleanup */
-+ apc_wprint("Unable to allocate memory for pool.");
++ apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+ return NULL;
+ }
+ ctxt.copy = APC_COPY_IN_USER; /* avoid stupid ALLOC_ZVAL calls here, hack */
-+ apc_bd_alloc_ex( (void*)((long)bd + sizeof(apc_bd_t)), bd->size - sizeof(apc_bd_t) -1);
++ apc_bd_alloc_ex((void*)((long)bd + sizeof(apc_bd_t)), bd->size - sizeof(apc_bd_t) -1 TSRMLS_CC);
+ bd->num_entries = count;
-+ bd->entries = apc_bd_alloc_ex(NULL, sizeof(apc_bd_entry_t) * count);
++ bd->entries = apc_bd_alloc_ex(NULL, sizeof(apc_bd_entry_t) * count TSRMLS_CC);
+
+ /* User entries */
+ zend_hash_init(&APCG(copied_zvals), 0, NULL, NULL, 0);
+ for(i=0; i < apc_user_cache->num_slots; i++) {
+ sp = apc_user_cache->slots[i];
+ for(; sp != NULL; sp = sp->next) {
-+ if(apc_bin_checkfilter(user_vars, sp->key.data.user.identifier, sp->key.data.user.identifier_len+1)) {
++ if(apc_bin_checkfilter(user_vars, sp->key.data.user.identifier, sp->key.data.user.identifier_len)) {
+ ep = &bd->entries[count];
+ ep->type = sp->value->type;
-+ ep->val.user.info = apc_bd_alloc(sp->value->data.user.info_len+1);
-+ memcpy(ep->val.user.info, sp->value->data.user.info, sp->value->data.user.info_len+1);
++ ep->val.user.info = apc_bd_alloc(sp->value->data.user.info_len TSRMLS_CC);
++ memcpy(ep->val.user.info, sp->value->data.user.info, sp->value->data.user.info_len);
+ ep->val.user.info_len = sp->value->data.user.info_len;
-+ ep->val.user.val = apc_copy_zval(NULL, sp->value->data.user.val, &ctxt);
++ ep->val.user.val = apc_copy_zval(NULL, sp->value->data.user.val, &ctxt TSRMLS_CC);
+ ep->val.user.ttl = sp->value->data.user.ttl;
+
+ /* swizzle pointers */
+ if(apc_bin_checkfilter(files, sp->key.data.fpfile.fullpath, sp->key.data.fpfile.fullpath_len+1)) {
+ ep = &bd->entries[count];
+ ep->type = sp->key.type;
-+ ep->val.file.filename = apc_bd_alloc(strlen(sp->value->data.file.filename)+1);
++ ep->val.file.filename = apc_bd_alloc(strlen(sp->value->data.file.filename) + 1 TSRMLS_CC);
+ strcpy(ep->val.file.filename, sp->value->data.file.filename);
+ ep->val.file.op_array = apc_copy_op_array(NULL, sp->value->data.file.op_array, &ctxt TSRMLS_CC);
+
+ for(ep->num_functions=0; sp->value->data.file.functions[ep->num_functions].function != NULL;) { ep->num_functions++; }
-+ ep->val.file.functions = apc_bd_alloc(sizeof(apc_function_t) * ep->num_functions);
++ ep->val.file.functions = apc_bd_alloc(sizeof(apc_function_t) * ep->num_functions TSRMLS_CC);
+ for(fcount=0; fcount < ep->num_functions; fcount++) {
+ memcpy(&ep->val.file.functions[fcount], &sp->value->data.file.functions[fcount], sizeof(apc_function_t));
-+ ep->val.file.functions[fcount].name = apc_xmemcpy(sp->value->data.file.functions[fcount].name, sp->value->data.file.functions[fcount].name_len+1, apc_bd_alloc);
++ ep->val.file.functions[fcount].name = apc_xmemcpy(sp->value->data.file.functions[fcount].name, sp->value->data.file.functions[fcount].name_len+1, apc_bd_alloc TSRMLS_CC);
+ ep->val.file.functions[fcount].name_len = sp->value->data.file.functions[fcount].name_len;
-+ ep->val.file.functions[fcount].function = apc_bd_alloc(sizeof(zend_function));
++ ep->val.file.functions[fcount].function = apc_bd_alloc(sizeof(zend_function) TSRMLS_CC);
+ efp = ep->val.file.functions[fcount].function;
+ sfp = sp->value->data.file.functions[fcount].function;
+ switch(sfp->type) {
+
+
+ for(ep->num_classes=0; sp->value->data.file.classes[ep->num_classes].class_entry != NULL;) { ep->num_classes++; }
-+ ep->val.file.classes = apc_bd_alloc(sizeof(apc_class_t) * ep->num_classes);
++ ep->val.file.classes = apc_bd_alloc(sizeof(apc_class_t) * ep->num_classes TSRMLS_CC);
+ for(fcount=0; fcount < ep->num_classes; fcount++) {
-+ ep->val.file.classes[fcount].name = apc_xmemcpy(sp->value->data.file.classes[fcount].name, sp->value->data.file.classes[fcount].name_len+1, apc_bd_alloc);
++ ep->val.file.classes[fcount].name = apc_xmemcpy(sp->value->data.file.classes[fcount].name, sp->value->data.file.classes[fcount].name_len + 1, apc_bd_alloc TSRMLS_CC);
+ ep->val.file.classes[fcount].name_len = sp->value->data.file.classes[fcount].name_len;
-+ ep->val.file.classes[fcount].class_entry = apc_copy_class_entry(NULL, sp->value->data.file.classes[fcount].class_entry, &ctxt);
-+ ep->val.file.classes[fcount].parent_name = apc_xstrdup(sp->value->data.file.classes[fcount].parent_name, apc_bd_alloc);
++ ep->val.file.classes[fcount].class_entry = apc_copy_class_entry(NULL, sp->value->data.file.classes[fcount].class_entry, &ctxt TSRMLS_CC);
++ ep->val.file.classes[fcount].parent_name = apc_xstrdup(sp->value->data.file.classes[fcount].parent_name, apc_bd_alloc TSRMLS_CC);
+
+ apc_swizzle_ptr(bd, &ll, &ep->val.file.classes[fcount].name);
+ apc_swizzle_ptr(bd, &ll, &ep->val.file.classes[fcount].parent_name);
+ t = apc_time();
+
+ for(i = 0; i < bd->num_entries; i++) {
-+ ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect);
++ ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
+ if (!ctxt.pool) { /* TODO need to cleanup previous pools */
-+ apc_wprint("Unable to allocate memory for pool.");
++ apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+ goto failure;
+ }
+ ep = &bd->entries[i];
+ HANDLE_BLOCK_INTERRUPTIONS();
+#if NONBLOCKING_LOCK_AVAILABLE
+ if(APCG(write_lock)) {
-+ if(!apc_cache_write_lock(apc_cache)) {
++ if(!apc_cache_write_lock(apc_cache TSRMLS_CC)) {
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return -1;
+ }
+ }
+ apc_bin_fixup_op_array(alloc_op_array);
+
-+ if(! (alloc_functions = apc_sma_malloc(sizeof(apc_function_t) * (ep->num_functions + 1)))) {
++ if(! (alloc_functions = apc_sma_malloc(sizeof(apc_function_t) * (ep->num_functions + 1) TSRMLS_CC))) {
+ goto failure;
+ }
+ for(i2=0; i2 < ep->num_functions; i2++) {
-+ if(! (alloc_functions[i2].name = apc_xmemcpy(ep->val.file.functions[i2].name, ep->val.file.functions[i2].name_len+1, apc_sma_malloc))) {
++ if(! (alloc_functions[i2].name = apc_xmemcpy(ep->val.file.functions[i2].name, ep->val.file.functions[i2].name_len + 1, apc_sma_malloc TSRMLS_CC))) {
+ goto failure;
+ }
+ alloc_functions[i2].name_len = ep->val.file.functions[i2].name_len;
-+ if(! (alloc_functions[i2].function = apc_sma_malloc(sizeof(zend_function)))) {
++ if(! (alloc_functions[i2].function = apc_sma_malloc(sizeof(zend_function) TSRMLS_CC))) {
+ goto failure;
+ }
+ switch(ep->val.file.functions[i2].function->type) {
+ alloc_functions[i2].name = NULL;
+ alloc_functions[i2].function = NULL;
+
-+ if(! (alloc_classes = apc_sma_malloc(sizeof(apc_class_t) * (ep->num_classes + 1)))) {
++ if(! (alloc_classes = apc_sma_malloc(sizeof(apc_class_t) * (ep->num_classes + 1) TSRMLS_CC))) {
+ goto failure;
+ }
+ for(i2=0; i2 < ep->num_classes; i2++) {
-+ if(! (alloc_classes[i2].name = apc_xmemcpy(ep->val.file.classes[i2].name, ep->val.file.classes[i2].name_len+1, apc_sma_malloc))) {
++ if(! (alloc_classes[i2].name = apc_xmemcpy(ep->val.file.classes[i2].name, ep->val.file.classes[i2].name_len+1, apc_sma_malloc TSRMLS_CC))) {
+ goto failure;
+ }
+ alloc_classes[i2].name_len = ep->val.file.classes[i2].name_len;
-+ if(! (alloc_classes[i2].class_entry = apc_copy_class_entry(NULL, ep->val.file.classes[i2].class_entry, &ctxt))) {
++ if(! (alloc_classes[i2].class_entry = apc_copy_class_entry(NULL, ep->val.file.classes[i2].class_entry, &ctxt TSRMLS_CC))) {
+ goto failure;
+ }
+ apc_bin_fixup_class_entry(alloc_classes[i2].class_entry);
-+ if(! (alloc_classes[i2].parent_name = apc_xstrdup(ep->val.file.classes[i2].parent_name, apc_sma_malloc))) {
++ if(! (alloc_classes[i2].parent_name = apc_xstrdup(ep->val.file.classes[i2].parent_name, apc_sma_malloc TSRMLS_CC))) {
+ if(ep->val.file.classes[i2].parent_name != NULL) {
+ goto failure;
+ }
+ alloc_classes[i2].name = NULL;
+ alloc_classes[i2].class_entry = NULL;
+
-+ if(!(cache_entry = apc_cache_make_file_entry(ep->val.file.filename, alloc_op_array, alloc_functions, alloc_classes, &ctxt))) {
++ if(!(cache_entry = apc_cache_make_file_entry(ep->val.file.filename, alloc_op_array, alloc_functions, alloc_classes, &ctxt TSRMLS_CC))) {
+ goto failure;
+ }
+
+ goto failure;
+ }
+
-+ if ((ret = apc_cache_insert(apc_cache, cache_key, cache_entry, &ctxt, t)) != 1) {
++ if ((ret = apc_cache_insert(apc_cache, cache_key, cache_entry, &ctxt, t TSRMLS_CC)) != 1) {
+ if(ret==-1) {
+ goto failure;
+ }
+
+#if NONBLOCKING_LOCK_AVAILABLE
+ if(APCG(write_lock)) {
-+ apc_cache_write_unlock(apc_cache);
++ apc_cache_write_unlock(apc_cache TSRMLS_CC);
+ }
+#endif
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return 0;
+
+failure:
-+ apc_pool_destroy(ctxt.pool);
-+ apc_wprint("Unable to allocate memory for apc binary load/dump functionality.");
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
++ apc_warning("Unable to allocate memory for apc binary load/dump functionality." TSRMLS_CC);
+#if NONBLOCKING_LOCK_AVAILABLE
+ if(APCG(write_lock)) {
-+ apc_cache_write_unlock(apc_cache);
++ apc_cache_write_unlock(apc_cache TSRMLS_CC);
+ }
+#endif
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_bin.h php-5.3.1/ext/apc/apc_bin.h
---- php-5.3.1.orig/ext/apc/apc_bin.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_bin.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_bin.h
@@ -0,0 +1,63 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2009 The PHP Group |
++ | Copyright (c) 2006-2010 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 274613 2009-01-26 06:57:57Z shire $ */
++/* $Id: apc_bin.h 300979 2010-07-04 10:15:05Z 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
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc.c php-5.3.1/ext/apc/apc.c
---- php-5.3.1.orig/ext/apc/apc.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,635 @@
+--- /dev/null
++++ b/ext/apc/apc.c
+@@ -0,0 +1,636 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 277132 2009-03-14 01:50:57Z shire $ */
++/* $Id: apc.c 305003 2010-10-31 19:45:10Z gopalv $ */
+
+#include "apc.h"
+#include "apc_zend.h"
++#include "apc_cache.h"
+#include "php.h"
+
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+
+/* {{{ memory allocation wrappers */
+
-+void* apc_emalloc(size_t n)
++void* apc_emalloc(size_t n TSRMLS_DC)
+{
+ void* p = malloc(n);
+ if (p == NULL) {
-+ apc_eprint("apc_emalloc: malloc failed to allocate %u bytes:", n);
++ apc_error("apc_emalloc: malloc failed to allocate %u bytes:" TSRMLS_CC, n);
+ }
+ return p;
+}
+
-+void* apc_erealloc(void* p, size_t n)
++void* apc_erealloc(void* p, size_t n TSRMLS_DC)
+{
+ p = realloc(p, n);
+ if (p == NULL) {
-+ apc_eprint("apc_erealloc: realloc failed to allocate %u bytes:", n);
++ apc_error("apc_erealloc: realloc failed to allocate %u bytes:" TSRMLS_CC, n);
+ }
+ return p;
+}
+
-+void apc_efree(void* p)
++void apc_efree(void* p TSRMLS_DC)
+{
+ if (p == NULL) {
-+ apc_eprint("apc_efree: attempt to free null pointer");
++ apc_error("apc_efree: attempt to free null pointer" TSRMLS_CC);
+ }
+ free(p);
+}
+
-+char* apc_estrdup(const char* s)
++char* apc_estrdup(const char* s TSRMLS_DC)
+{
+ int len;
+ char* dup;
+ len = strlen(s);
+ dup = (char*) malloc(len+1);
+ if (dup == NULL) {
-+ apc_eprint("apc_estrdup: malloc failed to allocate %u bytes:", len+1);
++ apc_error("apc_estrdup: malloc failed to allocate %u bytes:" TSRMLS_CC, len+1);
+ }
+ memcpy(dup, s, len);
+ dup[len] = '\0';
+ return dup;
+}
+
-+void* apc_xstrdup(const char* s, apc_malloc_t f)
++void* apc_xstrdup(const char* s, apc_malloc_t f TSRMLS_DC)
+{
-+ return s != NULL ? apc_xmemcpy(s, strlen(s)+1, f) : NULL;
++ 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)
++void* apc_xmemcpy(const void* p, size_t n, apc_malloc_t f TSRMLS_DC)
+{
+ void* q;
+
-+ if (p != NULL && (q = f(n)) != NULL) {
++ if (p != NULL && (q = f(n TSRMLS_CC)) != NULL) {
+ memcpy(q, p, n);
+ return q;
+ }
+/* }}} */
+
+/* {{{ console display functions */
++#ifdef ZTS
++# define APC_PRINT_FUNCTION_PARAMETER TSRMLS_C
++#else
++# define APC_PRINT_FUNCTION_PARAMETER format
++#endif
+
-+static void my_log(int level, const char* fmt, va_list args)
-+{
-+ static const char* level_strings[] = {
-+ "apc-debug",
-+ "apc-notice",
-+ "apc-warning",
-+ "apc-error"
-+ };
-+ static const int num_levels = NELEMS(level_strings);
-+
-+ time_t now;
-+ char* buf; /* for ctime */
-+
-+ TSRMLS_FETCH();
-+
-+ fflush(stdout);
-+
-+ if (level < 0)
-+ level = 0;
-+ else if (level >= num_levels)
-+ level = num_levels-1;
-+
-+ now = time(0);
-+ buf = ctime(&now); /* TODO: replace with reentrant impl */
-+ buf[24] = '\0';
-+
-+ fprintf(stderr, "[%s] [%s] ", buf, level_strings[level]);
-+ vfprintf(stderr, fmt, args);
-+
-+ if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':') {
-+ fprintf(stderr, " %s", strerror(errno));
-+ }
-+
-+ if (zend_is_compiling(TSRMLS_C)) {
-+ fprintf(stderr, " in %s on line %d.", zend_get_compiled_filename(TSRMLS_C), zend_get_compiled_lineno(TSRMLS_C));
-+ } else if (zend_is_executing(TSRMLS_C)) {
-+ fprintf(stderr, " in %s on line %d.", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C));
-+ }
-+ fprintf(stderr, "\n");
-+
-+ if (level == APC_ERROR) {
-+ exit(2);
-+ }
-+}
-+
-+void apc_eprint(const char* fmt, ...)
-+{
-+ va_list args;
-+ va_start(args, fmt);
-+ my_log(APC_ERROR, fmt, args);
-+ va_end(args);
-+}
-+
-+void apc_wprint(const char* fmt, ...)
-+{
-+ va_list args;
-+ va_start(args, fmt);
-+ my_log(APC_WARNING, fmt, args);
-+ va_end(args);
-+}
++#define APC_PRINT_FUNCTION(name, verbosity) \
++ void apc_##name(const char *format TSRMLS_DC, ...) \
++ { \
++ va_list args; \
++ \
++ va_start(args, APC_PRINT_FUNCTION_PARAMETER); \
++ php_verror(NULL, "", verbosity, format, args TSRMLS_CC); \
++ va_end(args); \
++ }
+
-+void apc_nprint(const char* fmt, ...)
-+{
-+ va_list args;
-+ va_start(args, fmt);
-+ my_log(APC_NOTICE, fmt, args);
-+ va_end(args);
-+}
++APC_PRINT_FUNCTION(error, E_ERROR)
++APC_PRINT_FUNCTION(warning, E_WARNING)
++APC_PRINT_FUNCTION(notice, E_NOTICE)
+
-+void apc_dprint(const char* fmt, ...)
-+{
-+#ifdef APC_DEBUG
-+ va_list args;
-+ va_start(args, fmt);
-+ my_log(APC_DBG, fmt, args);
-+ va_end(args);
++#ifdef __DEBUG_APC__
++APC_PRINT_FUNCTION(debug, E_NOTICE)
++#else
++void apc_debug(const char *format TSRMLS_DC, ...) {}
+#endif
-+}
-+
+/* }}} */
+
+/* {{{ string and text manipulation */
+
-+char* apc_append(const char* s, const char* t)
++char* apc_append(const char* s, const char* t TSRMLS_DC)
+{
+ int slen;
+ int tlen;
+ slen = strlen(s);
+ tlen = strlen(t);
+
-+ p = (char*) apc_emalloc((slen + tlen + 1) * sizeof(char));
++ p = (char*) apc_emalloc((slen + tlen + 1) * sizeof(char) TSRMLS_CC);
+ memcpy(p, s, slen);
+ memcpy(p + slen, t, tlen + 1);
+
+ return p;
+}
+
-+char* apc_substr(const char* s, int start, int length)
++char* apc_substr(const char* s, int start, int length TSRMLS_DC)
+{
+ char* substr;
+ int src_len = strlen(s);
+ }
+
+ /* create the substring */
-+ substr = apc_xmemcpy(s + start, length + 1, apc_emalloc);
++ substr = apc_xmemcpy(s + start, length + 1, apc_emalloc TSRMLS_CC);
+ substr[length] = '\0';
+ return substr;
+}
+
-+char** apc_tokenize(const char* s, char delim)
++char** apc_tokenize(const char* s, char delim TSRMLS_DC)
+{
+ char** tokens; /* array of tokens, NULL terminated */
+ int size; /* size of tokens array */
+ cur = 0;
+ end = strlen(s) - 1;
+
-+ tokens = (char**) apc_emalloc(size * sizeof(char*));
++ tokens = (char**) apc_emalloc(size * sizeof(char*) TSRMLS_CC);
+ tokens[n] = NULL;
+
+ while (cur <= end) {
+ /* resize token array if necessary */
+ if (n == size-1) {
+ size *= 2;
-+ tokens = (char**) apc_erealloc(tokens, size * sizeof(char*));
++ tokens = (char**) apc_erealloc(tokens, size * sizeof(char*) TSRMLS_CC);
+ }
+
+ /* save the current token */
-+ tokens[n] = apc_substr(s, cur, next-cur);
++ tokens[n] = apc_substr(s, cur, next-cur TSRMLS_CC);
+
+ tokens[++n] = NULL;
+ cur = next + 1;
+
+/* }}} */
+
-+/* {{{ apc stat */
++
++/* {{{ apc_win32_restat */
++#ifdef PHP_WIN32
++static int apc_restat(apc_fileinfo_t *fileinfo TSRMLS_DC)
++{
++ HANDLE hFile;
++ BY_HANDLE_FILE_INFORMATION hInfo;
++
++ hFile = CreateFile(fileinfo->fullpath, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);
++
++ if (!hFile) {
++ apc_debug("Cannot create a file HANDLE for %s\n" TSRMLS_CC, fileinfo->fullpath);
++ return -1;
++ }
++
++ if (!GetFileInformationByHandle(hFile, &hInfo)) {
++ apc_debug("Cannot get file information from handle\n" TSRMLS_CC);
++ CloseHandle(hFile);
++ return -1;
++ }
++
++ CloseHandle(hFile);
++
++ fileinfo->st_buf.sb.st_dev = hInfo.dwVolumeSerialNumber;
++ fileinfo->st_buf.sb.st_ino = (((apc_ino_t)(hInfo.nFileIndexHigh) << 32) | (apc_ino_t) hInfo.nFileIndexLow);
++
++ return 0;
++}
++#else
++static int apc_restat(apc_fileinfo_t *fileinfo TSRMLS_DC)
++{
++ return 0;
++}
++#endif
++/* }}} */
++
++/* {{{ apc_search_paths */
+/* similar to php_stream_stat_path */
+#define APC_URL_STAT(wrapper, filename, pstatbuf) \
+ ((wrapper)->wops->url_stat((wrapper), (filename), PHP_STREAM_URL_STAT_QUIET, (pstatbuf), NULL TSRMLS_CC))
-+int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo)
++
++/* copy out to path_buf if path_for_open isn't the same as filename */
++#define COPY_IF_CHANGED(p) \
++ (char*) (((p) == filename) ? filename : \
++ (strlcpy((char*)fileinfo->path_buf, (p), sizeof(fileinfo->path_buf))) \
++ ? (fileinfo->path_buf) : NULL)
++
++/* len checks can be skipped here because filename is NUL terminated */
++#define IS_RELATIVE_PATH(filename, len) \
++ ((filename) && (filename[0] == '.' && \
++ (IS_SLASH(filename[1]) || \
++ (filename[1] == '.' && \
++ IS_SLASH(filename[2])))))
++
++
++int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo TSRMLS_DC)
+{
-+ char** paths;
++ char** paths = NULL;
+ char *exec_fname;
+ int exec_fname_length;
+ int found = 0;
+ php_stream_wrapper *wrapper = NULL;
+ char *path_for_open = NULL;
+
-+ TSRMLS_FETCH();
-+
+ assert(filename && fileinfo);
+
+
+
+ if(wrapper != &php_plain_files_wrapper) {
+ if(APC_URL_STAT(wrapper, path_for_open, &fileinfo->st_buf) == 0) {
-+ strncpy(fileinfo->fullpath, path_for_open, MAXPATHLEN);
-+ return 0;
++ fileinfo->fullpath = COPY_IF_CHANGED(path_for_open);
++ return apc_restat(fileinfo TSRMLS_CC);
+ }
+ return -1; /* cannot stat */
+ }
+
+ if (IS_ABSOLUTE_PATH(path_for_open, strlen(path_for_open)) &&
+ APC_URL_STAT(wrapper, path_for_open, &fileinfo->st_buf) == 0) {
-+ strncpy(fileinfo->fullpath, path_for_open, MAXPATHLEN);
-+ return 0;
++ fileinfo->fullpath = COPY_IF_CHANGED(path_for_open);
++ return apc_restat(fileinfo TSRMLS_CC);
+ }
+
-+ paths = apc_tokenize(path, DEFAULT_DIR_SEPARATOR);
-+ if (!paths)
-+ return -1;
++ if (!IS_RELATIVE_PATH(path_for_open, strlen(path_for_open))) {
++ paths = apc_tokenize(path, DEFAULT_DIR_SEPARATOR TSRMLS_CC);
++ if (!paths)
++ return -1;
+
-+ /* for each directory in paths, look for filename inside */
-+ for (i = 0; paths[i]; i++) {
-+ snprintf(fileinfo->fullpath, sizeof(fileinfo->fullpath), "%s%c%s", paths[i], DEFAULT_SLASH, path_for_open);
-+ if (APC_URL_STAT(wrapper, fileinfo->fullpath, &fileinfo->st_buf) == 0) {
-+ found = 1;
-+ break;
++ /* for each directory in paths, look for filename inside */
++ for (i = 0; paths[i]; i++) {
++ snprintf(fileinfo->path_buf, sizeof(fileinfo->path_buf), "%s%c%s", paths[i], 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;
++ break;
++ }
+ }
+ }
+
+ while((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length]));
+ if((exec_fname && exec_fname[0] != '[') && exec_fname_length > 0) {
+ /* not: [no active file] or no path */
-+ memcpy(fileinfo->fullpath, exec_fname, exec_fname_length);
-+ fileinfo->fullpath[exec_fname_length] = DEFAULT_SLASH;
-+ strlcpy(fileinfo->fullpath +exec_fname_length +1, path_for_open,sizeof(fileinfo->fullpath)-exec_fname_length-1);
-+ /* apc_wprint("filename: %s, exec_fname: %s, fileinfo->fullpath: %s", path_for_open, exec_fname, fileinfo->fullpath); */
-+ if (APC_URL_STAT(wrapper, fileinfo->fullpath, &fileinfo->st_buf) == 0) {
++ memcpy(fileinfo->path_buf, exec_fname, exec_fname_length);
++ fileinfo->path_buf[exec_fname_length] = DEFAULT_SLASH;
++ strlcpy(fileinfo->path_buf +exec_fname_length +1, path_for_open,sizeof(fileinfo->path_buf)-exec_fname_length-1);
++ /* apc_warning("filename: %s, exec_fname: %s, fileinfo->path_buf: %s" TSRMLS_CC, path_for_open, exec_fname, fileinfo->path_buf); */
++ if (APC_URL_STAT(wrapper, fileinfo->path_buf, &fileinfo->st_buf) == 0) {
++ fileinfo->fullpath = (char*) fileinfo->path_buf;
+ found = 1;
+ }
+ }
+ }
+
-+ /* free the value returned by apc_tokenize */
-+ for (i = 0; paths[i]; i++) {
-+ apc_efree(paths[i]);
++ if(paths) {
++ /* free the value returned by apc_tokenize */
++ for (i = 0; paths[i]; i++) {
++ apc_efree(paths[i] TSRMLS_CC);
++ }
++ apc_efree(paths TSRMLS_CC);
+ }
-+ apc_efree(paths);
+
-+ return found ? 0 : -1;
++ return found ? apc_restat(fileinfo TSRMLS_CC) : -1;
+}
+
+/* }}} */
+#define APC_COMPILE_PATTERN(re, match) do {\
+ if(match.len > 2) { /* more than just "//" */\
+ if (((re) = pcre_get_compiled_regex(match.c, NULL, NULL TSRMLS_CC)) == NULL) {\
-+ apc_wprint("apc_regex_compile_array: invalid expression '%s'", match.c); \
++ apc_warning("apc_regex_compile_array: invalid expression '%s'" TSRMLS_CC, match.c); \
+ smart_str_free(&match);\
+ return NULL;\
+ }\
+ if (!patterns)
+ return NULL;
+
-+ regs = (apc_regex*) apc_emalloc(sizeof(apc_regex));
++ regs = (apc_regex*) apc_emalloc(sizeof(apc_regex) TSRMLS_CC);
+
+ smart_str_appendc(&pmatch, '/');
+ smart_str_appendc(&nmatch, '/');
+ return (void*) regs;
+}
+
-+void apc_regex_destroy_array(void* p)
++void apc_regex_destroy_array(void* p TSRMLS_DC)
+{
+ if (p != NULL) {
+ apc_regex* regs = (apc_regex*) p;
-+ apc_efree(regs);
++ apc_efree(regs TSRMLS_CC);
+ }
+}
+
+void* apc_regex_compile_array(char* patterns[] TSRMLS_DC)
+{
+ if(patterns && patterns[0] != NULL) {
-+ apc_wprint("pcre missing, disabling filters");
++ apc_warning("pcre missing, disabling filters" TSRMLS_CC);
+ }
+ return NULL;
+}
+ Z_ADDREF_P(data);
+ zend_hash_move_forward_ex(hash, &pos);
+ }
-+ efree(data);
++ zval_ptr_dtor(&data);
+
+ return new_hash;
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_cache.c php-5.3.1/ext/apc/apc_cache.c
---- php-5.3.1.orig/ext/apc/apc_cache.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_cache.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,1183 @@
+--- /dev/null
++++ b/ext/apc/apc_cache.c
+@@ -0,0 +1,1295 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 286717 2009-08-03 05:25:32Z gopalv $ */
++/* $Id: apc_cache.c 305771 2010-11-26 12:57:16Z gopalv $ */
+
+#include "apc_cache.h"
++#include "apc_zend.h"
+#include "apc_sma.h"
-+#include "apc_main.h"
+#include "apc_globals.h"
+#include "SAPI.h"
+
+#define key_equals(a, b) (a.inode==b.inode && a.device==b.device)
+/* }}} */
+
-+static void apc_cache_expunge(apc_cache_t* cache, size_t size);
++static void apc_cache_expunge(apc_cache_t* cache, size_t size TSRMLS_DC);
+
+/* {{{ hash */
+static unsigned int hash(apc_cache_key_t key)
+{
-+ return key.data.file.device + key.data.file.inode;
++ return (unsigned int)(key.data.file.device + key.data.file.inode);
+}
+/* }}} */
+
+#define string_nhash_8(s,len) (unsigned int)(zend_inline_hash_func(s, len))
+/* }}} */
+
++/* {{{ make_prime */
++static int const primes[] = {
++ 257, /* 256 */
++ 521, /* 512 */
++ 1031, /* 1024 */
++ 2053, /* 2048 */
++ 3079, /* 3072 */
++ 4099, /* 4096 */
++ 5147, /* 5120 */
++ 6151, /* 6144 */
++ 7177, /* 7168 */
++ 8209, /* 8192 */
++ 9221, /* 9216 */
++10243, /* 10240 */
++#if 0
++11273, /* 11264 */
++12289, /* 12288 */
++13313, /* 13312 */
++14341, /* 14336 */
++15361, /* 15360 */
++16411, /* 16384 */
++17417, /* 17408 */
++18433, /* 18432 */
++19457, /* 19456 */
++#endif
++0 /* sentinel */
++};
++
++static int make_prime(int n)
++{
++ int *k = (int*)primes;
++ while(*k) {
++ if((*k) > n) return *k;
++ k++;
++ }
++ return *(k-1);
++}
++/* }}} */
++
+/* {{{ make_slot */
-+slot_t* make_slot(apc_cache_key_t key, apc_cache_entry_t* value, slot_t* next, time_t t)
++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_pstrdup(key.data.user.identifier, value->pool);
++ 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);
++ char *fullpath = (char*) apc_pstrdup(key.data.fpfile.fullpath, value->pool TSRMLS_CC);
+ if (!fullpath) {
+ return NULL;
+ }
+/* }}} */
+
+/* {{{ free_slot */
-+static void free_slot(slot_t* slot)
++static void free_slot(slot_t* slot TSRMLS_DC)
+{
-+ apc_pool_destroy(slot->value->pool);
++ apc_pool_destroy(slot->value->pool TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ remove_slot */
-+static void remove_slot(apc_cache_t* cache, slot_t** slot)
++static void remove_slot(apc_cache_t* cache, slot_t** slot TSRMLS_DC)
+{
+ slot_t* dead = *slot;
+ *slot = (*slot)->next;
+ cache->header->mem_size -= dead->value->mem_size;
+ cache->header->num_entries--;
+ if (dead->value->ref_count <= 0) {
-+ free_slot(dead);
++ free_slot(dead TSRMLS_CC);
+ }
+ else {
+ dead->next = cache->header->deleted_list;
+/* }}} */
+
+/* {{{ process_pending_removals */
-+static void process_pending_removals(apc_cache_t* cache)
++static void process_pending_removals(apc_cache_t* cache TSRMLS_DC)
+{
+ slot_t** slot;
+ time_t now;
+ if (dead->value->ref_count > 0) {
+ switch(dead->value->type) {
+ case APC_CACHE_ENTRY_FILE:
-+ apc_wprint("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds",
++ apc_warning("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_wprint("GC cache entry '%s'was on gc-list for %d seconds", dead->value->data.user.info, gc_sec);
++ apc_warning("GC cache entry '%s'was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec);
+ break;
+ }
+ }
+ *slot = dead->next;
-+ free_slot(dead);
++ free_slot(dead TSRMLS_CC);
+ }
+ else {
+ slot = &(*slot)->next;
+/* }}} */
+
+/* {{{ apc_cache_create */
-+apc_cache_t* apc_cache_create(int size_hint, int gc_ttl, int ttl)
++apc_cache_t* apc_cache_create(int size_hint, int gc_ttl, int ttl TSRMLS_DC)
+{
+ apc_cache_t* cache;
+ int cache_size;
+ int num_slots;
-+ int i;
+
-+ num_slots = size_hint > 0 ? size_hint*2 : 2000;
++ num_slots = make_prime(size_hint > 0 ? size_hint : 2000);
+
-+ cache = (apc_cache_t*) apc_emalloc(sizeof(apc_cache_t));
++ cache = (apc_cache_t*) apc_emalloc(sizeof(apc_cache_t) TSRMLS_CC);
+ cache_size = sizeof(cache_header_t) + num_slots*sizeof(slot_t*);
+
-+ cache->shmaddr = apc_sma_malloc(cache_size);
++ cache->shmaddr = apc_sma_malloc(cache_size TSRMLS_CC);
+ if(!cache->shmaddr) {
-+ apc_eprint("Unable to allocate shared memory for cache structures. (Perhaps your shared memory size isn't large enough?). ");
++ apc_error("Unable to allocate shared memory for cache structures. (Perhaps your shared memory size isn't large enough?). " TSRMLS_CC);
+ }
+ memset(cache->shmaddr, 0, cache_size);
+
+#if NONBLOCKING_LOCK_AVAILABLE
+ CREATE_LOCK(cache->header->wrlock);
+#endif
-+ for (i = 0; i < num_slots; i++) {
-+ cache->slots[i] = NULL;
-+ }
++ memset(cache->slots, 0, sizeof(slot_t*)*num_slots);
+ cache->expunge_cb = apc_cache_expunge;
+ cache->has_lock = 0;
+
+/* }}} */
+
+/* {{{ apc_cache_destroy */
-+void apc_cache_destroy(apc_cache_t* cache)
++void apc_cache_destroy(apc_cache_t* cache TSRMLS_DC)
+{
+ DESTROY_LOCK(cache->header->lock);
+#ifdef NONBLOCKING_LOCK_AVAILABLE
+ DESTROY_LOCK(cache->header->wrlock);
+#endif
-+ apc_efree(cache);
++ apc_efree(cache TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ apc_cache_clear */
-+void apc_cache_clear(apc_cache_t* cache)
++void apc_cache_clear(apc_cache_t* cache TSRMLS_DC)
+{
+ int i;
+
+ for (i = 0; i < cache->num_slots; i++) {
+ slot_t* p = cache->slots[i];
+ while (p) {
-+ remove_slot(cache, &p);
++ remove_slot(cache, &p TSRMLS_CC);
+ }
+ cache->slots[i] = NULL;
+ }
+/* }}} */
+
+/* {{{ apc_cache_expunge */
-+static void apc_cache_expunge(apc_cache_t* cache, size_t size)
++static void apc_cache_expunge(apc_cache_t* cache, size_t size TSRMLS_DC)
+{
+ int i;
+ time_t t;
-+ TSRMLS_FETCH();
+
+ t = apc_time();
+
+ * we run out of space.
+ */
+ CACHE_SAFE_LOCK(cache);
++ 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++;
++clear_all:
+ for (i = 0; i < cache->num_slots; i++) {
+ slot_t* p = cache->slots[i];
+ while (p) {
-+ remove_slot(cache, &p);
++ remove_slot(cache, &p TSRMLS_CC);
+ }
+ cache->slots[i] = NULL;
+ }
++ memset(&cache->header->lastkey, 0, sizeof(apc_keyid_t));
+ cache->header->busy = 0;
+ CACHE_SAFE_UNLOCK(cache);
+ } else {
+ slot_t **p;
-+
+ /*
+ * If the ttl for the cache is set we walk through and delete stale
+ * entries. For the user cache that is slightly confusing since
+ */
+
+ CACHE_SAFE_LOCK(cache);
++ 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++;
+ for (i = 0; i < cache->num_slots; i++) {
+ if((*p)->value->type == APC_CACHE_ENTRY_USER) {
+ if((*p)->value->data.user.ttl) {
+ if((time_t) ((*p)->creation_time + (*p)->value->data.user.ttl) < t) {
-+ remove_slot(cache, p);
++ remove_slot(cache, p TSRMLS_CC);
+ continue;
+ }
+ } else if(cache->ttl) {
+ if((*p)->creation_time + cache->ttl < t) {
-+ remove_slot(cache, p);
++ remove_slot(cache, p TSRMLS_CC);
+ continue;
+ }
+ }
+ } else if((*p)->access_time < (t - cache->ttl)) {
-+ remove_slot(cache, p);
++ remove_slot(cache, p TSRMLS_CC);
+ continue;
+ }
+ p = &(*p)->next;
+ }
+ }
++
++ if (!apc_sma_get_avail_size(size)) {
++ /* TODO: re-do this to remove goto across locked sections */
++ goto clear_all;
++ }
++ memset(&cache->header->lastkey, 0, sizeof(apc_keyid_t));
+ cache->header->busy = 0;
+ CACHE_SAFE_UNLOCK(cache);
+ }
+ apc_cache_key_t key,
+ apc_cache_entry_t* value,
+ apc_context_t* ctxt,
-+ time_t t)
++ time_t t
++ TSRMLS_DC)
+{
+ slot_t** slot;
+
+ return 0;
+ }
+
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"Inserting [%s]\n", value->data.file.filename);
-+#endif
++ apc_debug("Inserting [%s]\n" TSRMLS_CC, value->data.file.filename);
+
-+ process_pending_removals(cache);
++ 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];
+ if(key_equals((*slot)->key.data.file, key.data.file)) {
+ /* If existing slot for the same device+inode is different, remove it and insert the new version */
+ if (ctxt->force_update || (*slot)->key.mtime != key.mtime) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ break;
+ }
+ return 0;
+ } else if(cache->ttl && (*slot)->access_time < (t - cache->ttl)) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ continue;
+ }
+ } else { /* APC_CACHE_KEY_FPFILE */
+ if(!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);
++ remove_slot(cache, slot TSRMLS_CC);
+ break;
+ } else if(cache->ttl && (*slot)->access_time < (t - cache->ttl)) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ continue;
+ }
+ }
+ slot = &(*slot)->next;
+ }
+
-+ if ((*slot = make_slot(key, value, *slot, t)) == NULL) {
++ if ((*slot = make_slot(key, value, *slot, t TSRMLS_CC)) == NULL) {
+ return -1;
+ }
+
+/* }}} */
+
+/* {{{ apc_cache_insert */
-+int apc_cache_insert(apc_cache_t* cache, apc_cache_key_t key, apc_cache_entry_t* value, apc_context_t *ctxt, time_t t)
++int apc_cache_insert(apc_cache_t* cache, apc_cache_key_t key, apc_cache_entry_t* value, apc_context_t *ctxt, time_t t TSRMLS_DC)
+{
+ int rval;
+ CACHE_LOCK(cache);
-+ rval = _apc_cache_insert(cache, key, value, ctxt, t);
++ rval = _apc_cache_insert(cache, key, value, ctxt, t TSRMLS_CC);
+ CACHE_UNLOCK(cache);
+ return rval;
+}
+/* }}} */
+
+/* {{{ apc_cache_insert */
-+int *apc_cache_insert_mult(apc_cache_t* cache, apc_cache_key_t* keys, apc_cache_entry_t** values, apc_context_t *ctxt, time_t t, int num_entries)
++int *apc_cache_insert_mult(apc_cache_t* cache, apc_cache_key_t* keys, apc_cache_entry_t** values, apc_context_t *ctxt, time_t t, int num_entries TSRMLS_DC)
+{
+ int *rval;
+ int i;
+ for (i=0; i < num_entries; i++) {
+ if (values[i]) {
+ ctxt->pool = values[i]->pool;
-+ rval[i] = _apc_cache_insert(cache, keys[i], values[i], ctxt, t);
++ rval[i] = _apc_cache_insert(cache, keys[i], values[i], ctxt, t TSRMLS_CC);
+ }
+ }
+ CACHE_UNLOCK(cache);
+int apc_cache_user_insert(apc_cache_t* cache, apc_cache_key_t key, apc_cache_entry_t* value, apc_context_t* ctxt, time_t t, int exclusive TSRMLS_DC)
+{
+ slot_t** slot;
-+ unsigned int keylen = key.data.user.identifier_len+1;
++ 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;
+
+ return 0;
+ }
+
-+ if(apc_cache_is_last_key(cache, &key, t)) {
++ if(apc_cache_is_last_key(cache, &key, h, t TSRMLS_CC)) {
+ /* potential cache slam */
++ printf("Last key warning for it!");
+ return 0;
+ }
+
+ lastkey->h = h;
+ lastkey->keylen = keylen;
+ lastkey->mtime = t;
++#ifdef ZTS
++ lastkey->tid = tsrm_thread_id();
++#else
++ lastkey->pid = getpid();
++#endif
+
+ /* we do not reset lastkey after the insert. Whether it is inserted
+ * or not, another insert in the same second is always a bad idea.
+ */
+
-+ process_pending_removals(cache);
++ process_pending_removals(cache TSRMLS_CC);
+
+ slot = &cache->slots[h % cache->num_slots];
+
+ while (*slot) {
-+ if (!memcmp((*slot)->key.data.user.identifier, key.data.user.identifier, keylen)) {
++ if (((*slot)->key.data.user.identifier_len == key.data.user.identifier_len) &&
++ (!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
+ * an exclusive insert (apc_add) we are going to bail right away if
+ ) ) {
+ goto fail;
+ }
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ break;
+ } else
+ /*
+ */
+ if((cache->ttl && (*slot)->access_time < (t - cache->ttl)) ||
+ ((*slot)->value->data.user.ttl && (time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t)) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ continue;
+ }
+ slot = &(*slot)->next;
+ }
+
-+ if ((*slot = make_slot(key, value, *slot, t)) == NULL) {
++ if ((*slot = make_slot(key, value, *slot, t TSRMLS_CC)) == NULL) {
+ goto fail;
+ }
+
+/* }}} */
+
+/* {{{ apc_cache_find_slot */
-+slot_t* apc_cache_find_slot(apc_cache_t* cache, apc_cache_key_t key, time_t t)
++slot_t* apc_cache_find_slot(apc_cache_t* cache, apc_cache_key_t key, time_t t TSRMLS_DC)
+{
+ slot_t** slot;
+ volatile slot_t* retval = NULL;
+ if(key.type == APC_CACHE_KEY_FILE) {
+ if(key_equals((*slot)->key.data.file, key.data.file)) {
+ if((*slot)->key.mtime != key.mtime) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ cache->header->num_misses++;
+ CACHE_UNLOCK(cache);
+ return NULL;
+/* }}} */
+
+/* {{{ apc_cache_find */
-+apc_cache_entry_t* apc_cache_find(apc_cache_t* cache, apc_cache_key_t key, time_t t)
++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);
++ slot_t * slot = apc_cache_find_slot(cache, key, t TSRMLS_CC);
+ return (slot) ? slot->value : NULL;
+}
+/* }}} */
+
+/* {{{ apc_cache_user_find */
-+apc_cache_entry_t* apc_cache_user_find(apc_cache_t* cache, char *strkey, int keylen, time_t t)
++apc_cache_entry_t* apc_cache_user_find(apc_cache_t* cache, char *strkey, int keylen, time_t t TSRMLS_DC)
+{
+ slot_t** slot;
+ volatile apc_cache_entry_t* value = NULL;
+ if (!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) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ cache->header->num_misses++;
+ CACHE_UNLOCK(cache);
+ return NULL;
+}
+/* }}} */
+
++/* {{{ apc_cache_user_exists */
++apc_cache_entry_t* apc_cache_user_exists(apc_cache_t* cache, char *strkey, int keylen, time_t t TSRMLS_DC)
++{
++ slot_t** slot;
++ volatile apc_cache_entry_t* value = NULL;
++
++ if(apc_cache_busy(cache))
++ {
++ /* cache cleanup in progress */
++ return NULL;
++ }
++
++ CACHE_LOCK(cache);
++
++ slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots];
++
++ while (*slot) {
++ if (!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 NULL;
++ }
++ /* Return the cache entry ptr */
++ value = (*slot)->value;
++ CACHE_UNLOCK(cache);
++ return (apc_cache_entry_t*)value;
++ }
++ slot = &(*slot)->next;
++ }
++ CACHE_UNLOCK(cache);
++ return NULL;
++}
++/* }}} */
++
+/* {{{ apc_cache_user_update */
+int _apc_cache_user_update(apc_cache_t* cache, char *strkey, int keylen, apc_cache_updater_t updater, void* data TSRMLS_DC)
+{
+/* }}} */
+
+/* {{{ apc_cache_user_delete */
-+int apc_cache_user_delete(apc_cache_t* cache, char *strkey, int keylen)
++int apc_cache_user_delete(apc_cache_t* cache, char *strkey, int keylen TSRMLS_DC)
+{
+ slot_t** slot;
+
+
+ while (*slot) {
+ if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ CACHE_UNLOCK(cache);
+ return 1;
+ }
+/* }}} */
+
+/* {{{ apc_cache_delete */
-+int apc_cache_delete(apc_cache_t* cache, char *filename, int filename_len)
++int apc_cache_delete(apc_cache_t* cache, char *filename, int filename_len TSRMLS_DC)
+{
+ slot_t** slot;
+ time_t t;
+ apc_cache_key_t key;
+
-+ TSRMLS_FETCH();
-+
+ t = apc_time();
+
+ /* try to create a cache key; if we fail, give up on caching */
+ if (!apc_cache_make_file_key(&key, filename, PG(include_path), t TSRMLS_CC)) {
-+ apc_wprint("Could not stat file %s, unable to delete from cache.", filename);
++ apc_warning("Could not stat file %s, unable to delete from cache." TSRMLS_CC, filename);
+ return -1;
+ }
+
+ if(key.type == (*slot)->key.type) {
+ if(key.type == APC_CACHE_KEY_FILE) {
+ if(key_equals((*slot)->key.data.file, key.data.file)) {
-+ remove_slot(cache, slot);
++ remove_slot(cache, slot TSRMLS_CC);
+ CACHE_UNLOCK(cache);
+ return 1;
+ }
+ } else { /* APC_CACHE_KEY_FPFILE */
-+ if(!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) {
-+ remove_slot(cache, slot);
++ if(((*slot)->key.data.fpfile.fullpath_len == key.data.fpfile.fullpath_len) &&
++ (!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);
+ return 1;
+ }
+ }
+ slot = &(*slot)->next;
+ }
-+
++
++ memset(&cache->header->lastkey, 0, sizeof(apc_keyid_t));
++
+ CACHE_UNLOCK(cache);
+ return 0;
+
+/* }}} */
+
+/* {{{ apc_cache_release */
-+void apc_cache_release(apc_cache_t* cache, apc_cache_entry_t* entry)
++void apc_cache_release(apc_cache_t* cache, apc_cache_entry_t* entry TSRMLS_DC)
+{
+ CACHE_LOCK(cache);
+ entry->ref_count--;
+ TSRMLS_DC)
+{
+ struct stat *tmp_buf=NULL;
-+ struct apc_fileinfo_t fileinfo = { {0}, };
++ struct apc_fileinfo_t *fileinfo = NULL;
+ int len;
+
+ assert(key != NULL);
+
+ if (!filename || !SG(request_info).path_translated) {
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"No filename and no path_translated - bailing\n");
-+#endif
-+ return 0;
++ apc_debug("No filename and no path_translated - bailing\n" TSRMLS_CC);
++ goto cleanup;
+ }
+
+ len = strlen(filename);
+ key->data.fpfile.fullpath_len = len;
+ key->mtime = t;
+ key->type = APC_CACHE_KEY_FPFILE;
-+ return 1;
++ goto success;
+ } else if(APCG(canonicalize)) {
-+ if (apc_search_paths(filename, include_path, &fileinfo) != 0) {
-+ apc_wprint("apc failed to locate %s - bailing", filename);
-+ return 0;
++
++ fileinfo = apc_php_malloc(sizeof(apc_fileinfo_t) TSRMLS_CC);
++
++ if (apc_search_paths(filename, include_path, fileinfo TSRMLS_CC) != 0) {
++ apc_warning("apc failed to locate %s - bailing" TSRMLS_CC, filename);
++ goto cleanup;
+ }
+
-+ if(!realpath(fileinfo.fullpath, APCG(canon_path))) {
-+ apc_wprint("realpath failed to canonicalize %s - bailing", filename);
-+ return 0;
++ if(!VCWD_REALPATH(fileinfo->fullpath, APCG(canon_path))) {
++ apc_warning("realpath failed to canonicalize %s - bailing" TSRMLS_CC, filename);
++ goto cleanup;
+ }
+
+ key->data.fpfile.fullpath = APCG(canon_path);
+ key->data.fpfile.fullpath_len = strlen(APCG(canon_path));
+ key->mtime = t;
+ key->type = APC_CACHE_KEY_FPFILE;
-+ return 1;
++ goto success;
+ }
+ /* fall through to stat mode */
+ }
+
++ fileinfo = apc_php_malloc(sizeof(apc_fileinfo_t) TSRMLS_CC);
++
++ assert(fileinfo != NULL);
++
+ if(!strcmp(SG(request_info).path_translated, filename)) {
+ tmp_buf = sapi_get_stat(TSRMLS_C); /* Apache has already done this stat() for us */
+ }
++
+ if(tmp_buf) {
-+ fileinfo.st_buf.sb = *tmp_buf;
++ fileinfo->st_buf.sb = *tmp_buf;
+ } else {
-+ if (apc_search_paths(filename, include_path, &fileinfo) != 0) {
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"Stat failed %s - bailing (%s) (%d)\n",filename,SG(request_info).path_translated);
-+#endif
-+ return 0;
++ if (apc_search_paths(filename, include_path, fileinfo TSRMLS_CC) != 0) {
++ apc_debug("Stat failed %s - bailing (%s) (%d)\n" TSRMLS_CC, filename,SG(request_info).path_translated);
++ goto cleanup;
+ }
+ }
+
-+ if(APCG(max_file_size) < fileinfo.st_buf.sb.st_size) {
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"File is too big %s (%d - %ld) - bailing\n",filename,t,fileinfo.st_buf.sb.st_size);
-+#endif
-+ return 0;
++ if(APCG(max_file_size) < fileinfo->st_buf.sb.st_size) {
++ apc_debug("File is too big %s (%d - %ld) - bailing\n" TSRMLS_CC, filename,t,fileinfo->st_buf.sb.st_size);
++ goto cleanup;
+ }
+
+ /*
+ * tiny safety is easier than educating the world. This is now
+ * configurable, but the default is still 2 seconds.
+ */
-+ if(APCG(file_update_protection) && (t - fileinfo.st_buf.sb.st_mtime < APCG(file_update_protection)) && !APCG(force_file_update)) {
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"File is too new %s (%d - %d) - bailing\n",filename,t,fileinfo.st_buf.sb.st_mtime);
-+#endif
-+ return 0;
++ if(APCG(file_update_protection) && (t - fileinfo->st_buf.sb.st_mtime < APCG(file_update_protection)) && !APCG(force_file_update)) {
++ apc_debug("File is too new %s (%d - %d) - bailing\n" TSRMLS_CC,filename,t,fileinfo->st_buf.sb.st_mtime);
++ goto cleanup;
+ }
+
-+ key->data.file.device = fileinfo.st_buf.sb.st_dev;
-+ key->data.file.inode = fileinfo.st_buf.sb.st_ino;
++ key->data.file.device = fileinfo->st_buf.sb.st_dev;
++ key->data.file.inode = fileinfo->st_buf.sb.st_ino;
++
+ /*
+ * If working with content management systems that like to munge the mtime,
+ * it might be appropriate to key off of the ctime to be immune to systems
+ * set the apc.stat_ctime=true to enable this check.
+ */
+ if(APCG(stat_ctime)) {
-+ key->mtime = (fileinfo.st_buf.sb.st_ctime > fileinfo.st_buf.sb.st_mtime) ? fileinfo.st_buf.sb.st_ctime : fileinfo.st_buf.sb.st_mtime;
++ key->mtime = (fileinfo->st_buf.sb.st_ctime > fileinfo->st_buf.sb.st_mtime) ? fileinfo->st_buf.sb.st_ctime : fileinfo->st_buf.sb.st_mtime;
+ } else {
-+ key->mtime = fileinfo.st_buf.sb.st_mtime;
++ key->mtime = fileinfo->st_buf.sb.st_mtime;
+ }
+ key->type = APC_CACHE_KEY_FILE;
++
++success:
++
++ if(fileinfo != NULL) {
++ apc_php_free(fileinfo TSRMLS_CC);
++ }
++
+ return 1;
++
++cleanup:
++
++ if(fileinfo != NULL) {
++ apc_php_free(fileinfo TSRMLS_CC);
++ }
++
++ return 0;
+}
+/* }}} */
+
+ zend_op_array* op_array,
+ apc_function_t* functions,
+ apc_class_t* classes,
-+ apc_context_t* ctxt)
++ apc_context_t* ctxt
++ TSRMLS_DC)
+{
+ apc_cache_entry_t* entry;
+ apc_pool* pool = ctxt->pool;
+ entry = (apc_cache_entry_t*) apc_pool_alloc(pool, sizeof(apc_cache_entry_t));
+ if (!entry) return NULL;
+
-+ entry->data.file.filename = apc_pstrdup(filename, pool);
++ entry->data.file.filename = apc_pstrdup(filename, pool TSRMLS_CC);
+ if(!entry->data.file.filename) {
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"apc_cache_make_file_entry: entry->data.file.filename is NULL - bailing\n");
-+#endif
++ apc_debug("apc_cache_make_file_entry: entry->data.file.filename is NULL - bailing\n" TSRMLS_CC);
+ return NULL;
+ }
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"apc_cache_make_file_entry: entry->data.file.filename is [%s]\n",entry->data.file.filename);
-+#endif
++ apc_debug("apc_cache_make_file_entry: entry->data.file.filename is [%s]\n" TSRMLS_CC,entry->data.file.filename);
+ entry->data.file.op_array = op_array;
+ entry->data.file.functions = functions;
+ entry->data.file.classes = classes;
+
-+ entry->data.file.halt_offset = apc_file_halt_offset(filename);
++ entry->data.file.halt_offset = apc_file_halt_offset(filename TSRMLS_CC);
+
+ entry->type = APC_CACHE_ENTRY_FILE;
+ entry->ref_count = 0;
+/* }}} */
+
+/* {{{ apc_cache_store_zval */
-+zval* apc_cache_store_zval(zval* dst, const zval* src, apc_context_t* ctxt)
++zval* apc_cache_store_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
-+ TSRMLS_FETCH();
-+
+ if (Z_TYPE_P(src) == IS_ARRAY) {
+ /* Maintain a list of zvals we've copied to properly handle recursive structures */
+ zend_hash_init(&APCG(copied_zvals), 0, NULL, NULL, 0);
-+ dst = apc_copy_zval(dst, src, ctxt);
++ dst = apc_copy_zval(dst, src, ctxt TSRMLS_CC);
+ zend_hash_destroy(&APCG(copied_zvals));
+ APCG(copied_zvals).nTableSize=0;
+ } else {
-+ dst = apc_copy_zval(dst, src, ctxt);
++ dst = apc_copy_zval(dst, src, ctxt TSRMLS_CC);
+ }
+
+
+/* }}} */
+
+/* {{{ apc_cache_fetch_zval */
-+zval* apc_cache_fetch_zval(zval* dst, const zval* src, apc_context_t* ctxt)
++zval* apc_cache_fetch_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
-+ TSRMLS_FETCH();
-+
+ if (Z_TYPE_P(src) == IS_ARRAY) {
+ /* Maintain a list of zvals we've copied to properly handle recursive structures */
+ zend_hash_init(&APCG(copied_zvals), 0, NULL, NULL, 0);
-+ dst = apc_copy_zval(dst, src, ctxt);
++ dst = apc_copy_zval(dst, src, ctxt TSRMLS_CC);
+ zend_hash_destroy(&APCG(copied_zvals));
+ APCG(copied_zvals).nTableSize=0;
+ } else {
-+ dst = apc_copy_zval(dst, src, ctxt);
++ dst = apc_copy_zval(dst, src, ctxt TSRMLS_CC);
+ }
+
+
+/* }}} */
+
+/* {{{ apc_cache_make_user_entry */
-+apc_cache_entry_t* apc_cache_make_user_entry(const char* info, int info_len, const zval* val, apc_context_t* ctxt, const unsigned int ttl)
++apc_cache_entry_t* apc_cache_make_user_entry(const char* info, int info_len, const zval* val, apc_context_t* ctxt, const unsigned int ttl TSRMLS_DC)
+{
+ apc_cache_entry_t* entry;
+ apc_pool* pool = ctxt->pool;
+ entry = (apc_cache_entry_t*) apc_pool_alloc(pool, sizeof(apc_cache_entry_t));
+ if (!entry) return NULL;
+
-+ entry->data.user.info = apc_pmemcpy(info, info_len+1, pool);
++ entry->data.user.info = apc_pmemcpy(info, info_len, pool TSRMLS_CC);
+ entry->data.user.info_len = info_len;
+ if(!entry->data.user.info) {
+ return NULL;
+ }
-+ entry->data.user.val = apc_cache_store_zval(NULL, val, ctxt);
++ entry->data.user.val = apc_cache_store_zval(NULL, val, ctxt TSRMLS_CC);
+ if(!entry->data.user.val) {
+ return NULL;
+ }
+/* }}} */
+
+/* {{{ apc_cache_info */
-+apc_cache_info_t* apc_cache_info(apc_cache_t* cache, zend_bool limited)
++apc_cache_info_t* apc_cache_info(apc_cache_t* cache, zend_bool limited TSRMLS_DC)
+{
+ apc_cache_info_t* info;
+ slot_t* p;
+ int i;
+
-+ TSRMLS_FETCH();
-+
+ if(!cache) return NULL;
+
+ CACHE_LOCK(cache);
+
-+ info = (apc_cache_info_t*) apc_emalloc(sizeof(apc_cache_info_t));
++ info = (apc_cache_info_t*) apc_php_malloc(sizeof(apc_cache_info_t) TSRMLS_CC);
+ if(!info) {
+ CACHE_UNLOCK(cache);
+ return NULL;
+ for (i = 0; i < info->num_slots; i++) {
+ p = cache->slots[i];
+ for (; p != NULL; p = p->next) {
-+ apc_cache_link_t* link = (apc_cache_link_t*) apc_emalloc(sizeof(apc_cache_link_t));
++ 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_emalloc);
++ 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_emalloc);
++ 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 = 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_emalloc);
++ 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;
+ }
+
+ /* For each slot pending deletion */
+ for (p = cache->header->deleted_list; p != NULL; p = p->next) {
-+ apc_cache_link_t* link = (apc_cache_link_t*) apc_emalloc(sizeof(apc_cache_link_t));
++ 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_emalloc);
++ 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_emalloc);
++ 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 = 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_emalloc);
++ 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;
+ }
+/* }}} */
+
+/* {{{ apc_cache_free_info */
-+void apc_cache_free_info(apc_cache_info_t* 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;
+ if(q->data.file.md5) {
+ efree(q->data.file.md5);
+ }
-+ apc_efree(q->data.file.filename);
++ apc_php_free(q->data.file.filename TSRMLS_CC);
+ }
-+ else if(q->type == APC_CACHE_ENTRY_USER) apc_efree(q->data.user.info);
-+ apc_efree(q);
++ 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) {
+ if(q->data.file.md5) {
+ efree(q->data.file.md5);
+ }
-+ apc_efree(q->data.file.filename);
++ apc_php_free(q->data.file.filename TSRMLS_CC);
+ }
-+ else if(q->type == APC_CACHE_ENTRY_USER) apc_efree(q->data.user.info);
-+ apc_efree(q);
++ else if(q->type == APC_CACHE_ENTRY_USER) apc_php_free(q->data.user.info TSRMLS_CC);
++ apc_php_free(q TSRMLS_CC);
+ }
-+ apc_efree(info);
++ apc_php_free(info TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ apc_cache_unlock */
-+void apc_cache_unlock(apc_cache_t* cache)
++void apc_cache_unlock(apc_cache_t* cache TSRMLS_DC)
+{
+ CACHE_UNLOCK(cache);
+}
+/* }}} */
+
+/* {{{ apc_cache_is_last_key */
-+zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t)
++zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, unsigned int h, time_t t TSRMLS_DC)
+{
+ apc_keyid_t *lastkey = &cache->header->lastkey;
-+ unsigned int keylen = key->data.user.identifier_len+1;
-+ unsigned int h = string_nhash_8(key->data.user.identifier, keylen);
++ unsigned int keylen = key->data.user.identifier_len;
++#ifdef ZTS
++ THREAD_T tid = tsrm_thread_id();
++ #define FROM_DIFFERENT_THREAD(k) (memcmp(&((k)->tid), &tid, sizeof(THREAD_T))!=0)
++#else
++ pid_t pid = getpid();
++ #define FROM_DIFFERENT_THREAD(k) (pid != (k)->pid)
++#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->mtime == t) {
++ if(lastkey->mtime == t && FROM_DIFFERENT_THREAD(lastkey)) {
+ /* potential cache slam */
-+ apc_wprint("Potential cache slam averted for key '%s'", key->data.user.identifier);
-+ return 1;
++ if(APCG(slam_defense)) {
++ apc_warning("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);
++ return 1;
++ }
+ }
+ }
+
+
+#if NONBLOCKING_LOCK_AVAILABLE
+/* {{{ apc_cache_write_lock */
-+zend_bool apc_cache_write_lock(apc_cache_t* cache)
++zend_bool apc_cache_write_lock(apc_cache_t* cache TSRMLS_DC)
+{
+ return apc_lck_nb_lock(cache->header->wrlock);
+}
+/* }}} */
+
+/* {{{ apc_cache_write_unlock */
-+void apc_cache_write_unlock(apc_cache_t* cache)
++void apc_cache_write_unlock(apc_cache_t* cache TSRMLS_DC)
+{
+ apc_lck_unlock(cache->header->wrlock);
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_cache.h php-5.3.1/ext/apc/apc_cache.h
---- php-5.3.1.orig/ext/apc/apc_cache.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_cache.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,378 @@
+--- /dev/null
++++ b/ext/apc/apc_cache.h
+@@ -0,0 +1,403 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 281919 2009-06-10 11:23:55Z gopalv $ */
++/* $Id: apc_cache.h 305258 2010-11-10 19:02:06Z gopalv $ */
+
+#ifndef APC_CACHE_H
+#define APC_CACHE_H
+#include "apc_lock.h"
+#include "apc_pool.h"
+#include "apc_main.h"
++#include "TSRM.h"
+
+#define APC_CACHE_ENTRY_FILE 1
+#define APC_CACHE_ENTRY_USER 2
+#define APC_CACHE_KEY_USER 2
+#define APC_CACHE_KEY_FPFILE 3
+
++#ifdef PHP_WIN32
++typedef unsigned __int64 apc_ino_t;
++typedef unsigned __int64 apc_dev_t;
++#else
++typedef ino_t apc_ino_t;
++typedef dev_t apc_dev_t;
++#endif
++
+/* {{{ cache locking macros */
+#define CACHE_LOCK(cache) { LOCK(cache->header->lock); cache->has_lock = 1; }
+#define CACHE_UNLOCK(cache) { UNLOCK(cache->header->lock); cache->has_lock = 0; }
+
+typedef union _apc_cache_key_data_t {
+ struct {
-+ dev_t device; /* the filesystem device */
-+ ino_t inode; /* the filesystem inode */
++ apc_dev_t device; /* the filesystem device */
++ apc_ino_t inode; /* the filesystem inode */
+ } file;
+ struct {
+ const char *identifier;
+ unsigned int h;
+ unsigned int keylen;
+ time_t mtime;
++#ifdef ZTS
++ THREAD_T tid;
++#else
++ pid_t pid;
++#endif
+};
+/* }}} */
+
+ * is needed. This helps in cleaning up the cache and ensuring that entries
+ * hit frequently stay cached and ones not hit very often eventually disappear.
+ */
-+extern T apc_cache_create(int size_hint, int gc_ttl, int ttl);
++extern T apc_cache_create(int size_hint, int gc_ttl, int ttl TSRMLS_DC);
+
+/*
+ * apc_cache_destroy releases any OS resources associated with a cache object.
+ * Under apache, this function can be safely called by the child processes
+ * when they exit.
+ */
-+extern void apc_cache_destroy(T cache);
++extern void apc_cache_destroy(T cache TSRMLS_DC);
+
+/*
+ * apc_cache_clear empties a cache. This can safely be called at any time,
+ * even while other server processes are executing cached source files.
+ */
-+extern void apc_cache_clear(T cache);
++extern void apc_cache_clear(T cache TSRMLS_DC);
+
+/*
+ * apc_cache_insert adds an entry to the cache, using a filename as a key.
+ * value is a cache entry returned by apc_cache_make_entry (see below).
+ */
+extern int apc_cache_insert(T cache, apc_cache_key_t key,
-+ apc_cache_entry_t* value, apc_context_t* ctxt, time_t t);
++ apc_cache_entry_t* value, apc_context_t* ctxt, time_t t TSRMLS_DC);
+
+extern int apc_cache_user_insert(T cache, apc_cache_key_t key,
+ apc_cache_entry_t* value, apc_context_t* ctxt, time_t t, int exclusive TSRMLS_DC);
+
+extern int *apc_cache_insert_mult(apc_cache_t* cache, apc_cache_key_t* keys,
-+ apc_cache_entry_t** values, apc_context_t *ctxt, time_t t, int num_entries);
++ apc_cache_entry_t** values, apc_context_t *ctxt, time_t t, int num_entries TSRMLS_DC);
+
+/*
+ * apc_cache_find searches for a cache entry by filename, and returns a
+ *
+ * key is a value created by apc_cache_make_file_key for file keys.
+ */
-+extern apc_cache_entry_t* apc_cache_find(T cache, apc_cache_key_t key, time_t t);
++extern apc_cache_entry_t* apc_cache_find(T cache, apc_cache_key_t key, time_t t TSRMLS_DC);
+
+/*
+ * apc_cache_user_find searches for a cache entry by its hashed identifier,
+ * and returns a pointer to the entry if found, NULL otherwise.
+ *
+ */
-+extern apc_cache_entry_t* apc_cache_user_find(T cache, char* strkey, int keylen, time_t t);
++extern apc_cache_entry_t* apc_cache_user_find(T cache, char* strkey, int keylen, time_t t TSRMLS_DC);
++
++/*
++ * apc_cache_user_exists searches for a cache entry by its hashed identifier,
++ * and returns a pointer to the entry if found, NULL otherwise. This is a
++ * quick non-locking version of apc_cache_user_find that does not modify the
++ * shared memory segment in any way.
++ *
++ */
++extern apc_cache_entry_t* apc_cache_user_exists(T cache, char* strkey, int keylen, time_t t TSRMLS_DC);
+
+/*
+ * apc_cache_delete and apc_cache_user_delete finds an entry in the cache and deletes it.
+ */
-+extern int apc_cache_delete(apc_cache_t* cache, char *filename, int filename_len);
-+extern int apc_cache_user_delete(apc_cache_t* cache, char *strkey, int keylen);
++extern int apc_cache_delete(apc_cache_t* cache, char *filename, int filename_len TSRMLS_DC);
++extern int apc_cache_user_delete(apc_cache_t* cache, char *strkey, int keylen TSRMLS_DC);
+
+/* apc_cach_fetch_zval takes a zval in the cache and reconstructs a runtime
+ * zval from it.
+ *
+ */
-+zval* apc_cache_fetch_zval(zval* dst, const zval* src, apc_context_t* ctxt);
++zval* apc_cache_fetch_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC);
+
+/*
+ * apc_cache_release decrements the reference count associated with a cache
+ *
+ * entry is the cache entry whose ref count you want to decrement.
+ */
-+extern void apc_cache_release(T cache, apc_cache_entry_t* entry);
++extern void apc_cache_release(T cache, apc_cache_entry_t* entry TSRMLS_DC);
+
+/*
+ * apc_cache_make_file_key creates a key object given a relative or absolute
+ zend_op_array* op_array,
+ apc_function_t* functions,
+ apc_class_t* classes,
-+ apc_context_t* ctxt);
++ apc_context_t* ctxt
++ 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
+ * and the zval to be stored.
+ */
-+extern apc_cache_entry_t* apc_cache_make_user_entry(const char* info, int info_len, const zval *val, apc_context_t* ctxt, const unsigned int ttl);
++extern apc_cache_entry_t* apc_cache_make_user_entry(const char* info, int info_len, const zval *val, apc_context_t* ctxt, const unsigned int ttl TSRMLS_DC);
+
+extern int apc_cache_make_user_key(apc_cache_key_t* key, char* identifier, int identifier_len, const time_t t);
+
+typedef union _apc_cache_link_data_t {
+ struct {
+ char *filename;
-+ dev_t device;
-+ ino_t inode;
++ apc_ino_t device;
++ apc_dev_t inode;
+ unsigned char *md5;
+ } file;
+ struct {
+};
+/* }}} */
+
++
+/* {{{ struct definition: apc_cache_info_t */
+typedef struct apc_cache_info_t apc_cache_info_t;
+struct apc_cache_info_t {
+};
+/* }}} */
+
-+typedef void (*apc_expunge_cb_t)(T cache, size_t n);
++typedef void (*apc_expunge_cb_t)(T cache, size_t n TSRMLS_DC);
+
+/* {{{ struct definition: apc_cache_t */
+struct apc_cache_t {
+};
+/* }}} */
+
-+extern apc_cache_info_t* apc_cache_info(T cache, zend_bool limited);
-+extern void apc_cache_free_info(apc_cache_info_t* info);
-+extern void apc_cache_unlock(apc_cache_t* cache);
++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 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);
-+extern void apc_cache_write_unlock(apc_cache_t* cache);
-+extern zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t);
++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);
+
+/* 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
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_compile.c php-5.3.1/ext/apc/apc_compile.c
---- php-5.3.1.orig/ext/apc/apc_compile.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_compile.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,1775 @@
+--- /dev/null
++++ b/ext/apc/apc_compile.c
+@@ -0,0 +1,2102 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 284580 2009-07-22 06:05:31Z kalle $ */
++/* $Id: apc_compile.c 303796 2010-09-27 17:14:18Z gopalv $ */
+
+#include "apc_compile.h"
+#include "apc_globals.h"
+#include "apc_zend.h"
++#include "apc_string.h"
+#include "ext/standard/php_var.h"
+#include "ext/standard/php_smart_str.h"
+
+#define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX)
+#endif
+
-+typedef void* (*ht_copy_fun_t)(void*, void*, apc_context_t*);
++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);
+
+
+/* {{{ internal function declarations */
+
-+static zend_function* my_bitwise_copy_function(zend_function*, zend_function*, apc_context_t*);
++static zend_function* my_bitwise_copy_function(zend_function*, zend_function*, apc_context_t* TSRMLS_DC);
+
+/*
+ * The "copy" functions perform deep-copies on a particular data structure
+ * (passed as the second argument). They also optionally allocate space for
+ * the destination data structure if the first argument is null.
+ */
-+static zval** my_copy_zval_ptr(zval**, const zval**, apc_context_t*);
-+static zval* my_copy_zval(zval*, const zval*, apc_context_t*);
-+static znode* my_copy_znode(znode*, znode*, apc_context_t*);
-+static zend_op* my_copy_zend_op(zend_op*, zend_op*, apc_context_t*);
-+static zend_function* my_copy_function(zend_function*, zend_function*, apc_context_t*);
-+static zend_function_entry* my_copy_function_entry(zend_function_entry*, const zend_function_entry*, apc_context_t*);
-+static zend_class_entry* my_copy_class_entry(zend_class_entry*, zend_class_entry*, apc_context_t*);
-+static HashTable* my_copy_hashtable_ex(HashTable*, HashTable*, ht_copy_fun_t, int, apc_context_t*, ht_check_copy_fun_t, ...);
++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);
++static znode* my_copy_znode(znode*, znode*, apc_context_t* TSRMLS_DC);
++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);
++static zend_class_entry* my_copy_class_entry(zend_class_entry*, zend_class_entry*, apc_context_t* TSRMLS_DC);
++static HashTable* my_copy_hashtable_ex(HashTable*, HashTable* TSRMLS_DC, ht_copy_fun_t, int, apc_context_t*, ht_check_copy_fun_t, ...);
+#define my_copy_hashtable( dst, src, copy_fn, holds_ptr, ctxt) \
-+ my_copy_hashtable_ex(dst, src, copy_fn, holds_ptr, ctxt, NULL)
-+static HashTable* my_copy_static_variables(zend_op_array* src, apc_context_t*);
-+static zend_property_info* my_copy_property_info(zend_property_info* dst, zend_property_info* src, apc_context_t*);
-+static zend_arg_info* my_copy_arg_info_array(zend_arg_info*, const zend_arg_info*, uint, apc_context_t*);
-+static zend_arg_info* my_copy_arg_info(zend_arg_info*, const zend_arg_info*, apc_context_t*);
++ my_copy_hashtable_ex(dst, src TSRMLS_CC, copy_fn, holds_ptr, ctxt, NULL)
++static HashTable* my_copy_static_variables(zend_op_array* src, apc_context_t* TSRMLS_DC);
++static zend_property_info* my_copy_property_info(zend_property_info* dst, zend_property_info* src, apc_context_t* TSRMLS_DC);
++static zend_arg_info* my_copy_arg_info_array(zend_arg_info*, const zend_arg_info*, uint, apc_context_t* TSRMLS_DC);
++static zend_arg_info* my_copy_arg_info(zend_arg_info*, const zend_arg_info*, apc_context_t* TSRMLS_DC);
+
+/*
+ * The "fixup" functions need for ZEND_ENGINE_2
+static int my_check_copy_default_property(Bucket* p, va_list args);
+static int my_check_copy_property_info(Bucket* src, va_list args);
+static int my_check_copy_static_member(Bucket* src, va_list args);
++static int my_check_copy_constant(Bucket* src, va_list args);
+
+/* }}} */
+
+/* }}} */
+
+/* {{{ my_bitwise_copy_function */
-+static zend_function* my_bitwise_copy_function(zend_function* dst, zend_function* src, apc_context_t* ctxt)
++static zend_function* my_bitwise_copy_function(zend_function* dst, zend_function* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ apc_pool* pool = ctxt->pool;
+
+/* }}} */
+
+/* {{{ my_copy_zval_ptr */
-+static zval** my_copy_zval_ptr(zval** dst, const zval** src, apc_context_t* ctxt)
++static zval** my_copy_zval_ptr(zval** dst, const zval** src, apc_context_t* ctxt TSRMLS_DC)
+{
+ zval* dst_new;
+ apc_pool* pool = ctxt->pool;
+ CHECK((dst[0] = (zval*) apc_pool_alloc(pool, sizeof(zval))));
+ }
+
-+ CHECK((dst_new = my_copy_zval(*dst, *src, ctxt)));
++ CHECK((dst_new = my_copy_zval(*dst, *src, ctxt TSRMLS_CC)));
+
+ if(dst_new != *dst) {
+ if(usegc) {
-+ TSRMLS_FETCH();
+ FREE_ZVAL(dst[0]);
+ }
+ *dst = dst_new;
+/* }}} */
+
+/* {{{ my_serialize_object */
-+static zval* my_serialize_object(zval* dst, const zval* src, apc_context_t* ctxt)
++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;
+
-+ TSRMLS_FETCH();
-+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, (zval**)&src, &var_hash TSRMLS_CC);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+ if(buf.c) {
+ 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));
++ CHECK(dst->value.str.val = apc_pmemcpy(buf.c, (buf.len + 1), pool TSRMLS_CC));
+ dst->type = src->type;
+ smart_str_free(&buf);
+ }
+/* }}} */
+
+/* {{{ my_unserialize_object */
-+static zval* my_unserialize_object(zval* dst, const zval* src, apc_context_t* ctxt)
++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);
+
-+ TSRMLS_FETCH();
-+
+ 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);
+}
+/* }}} */
+
++static char *apc_string_pmemcpy(char *str, size_t len, apc_pool* pool TSRMLS_DC)
++{
++#ifdef ZEND_ENGINE_2_4
++ if (pool->type != APC_UNPOOL) {
++ char * ret = apc_new_interned_string(str, len TSRMLS_CC);
++ if (ret) {
++ return ret;
++ }
++ }
++#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)
++static zval* my_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ zval **tmp;
+ apc_pool* pool = ctxt->pool;
-+ TSRMLS_FETCH();
+
+ assert(dst != NULL);
+ assert(src != NULL);
+ case IS_CONSTANT:
+ case IS_STRING:
+ if (src->value.str.val) {
-+ CHECK(dst->value.str.val = apc_pmemcpy(src->value.str.val,
++ CHECK(dst->value.str.val = apc_string_pmemcpy(src->value.str.val,
+ src->value.str.len+1,
-+ pool));
++ pool TSRMLS_CC));
+ }
+ break;
+
+
+ dst->type = IS_NULL;
+ if(ctxt->copy == APC_COPY_IN_USER) {
-+ dst = my_serialize_object(dst, src, ctxt);
++ dst = my_serialize_object(dst, src, ctxt TSRMLS_CC);
+ } else if(ctxt->copy == APC_COPY_OUT_USER) {
-+ dst = my_unserialize_object(dst, src, ctxt);
++ dst = my_unserialize_object(dst, src, ctxt TSRMLS_CC);
+ }
+ break;
+
+}
+/* }}} */
+
++#ifdef ZEND_ENGINE_2_4
++/* {{{ my_copy_znode */
++static void my_check_znode(zend_uchar op_type, apc_context_t* ctxt TSRMLS_DC)
++{
++ assert(op_type == IS_CONST ||
++ op_type == IS_VAR ||
++ op_type == IS_CV ||
++ op_type == IS_TMP_VAR ||
++ op_type == IS_UNUSED);
++}
++/* }}} */
++
++/* {{{ my_copy_zend_op */
++static zend_op* my_copy_zend_op(zend_op* dst, zend_op* src, apc_context_t* ctxt TSRMLS_DC)
++{
++ assert(dst != NULL);
++ assert(src != NULL);
++
++ memcpy(dst, src, sizeof(src[0]));
++
++ my_check_znode(dst->result_type & ~EXT_TYPE_UNUSED, ctxt TSRMLS_CC);
++ my_check_znode(dst->op1_type, ctxt TSRMLS_CC);
++ my_check_znode(dst->op2_type, ctxt TSRMLS_CC);
++
++ return dst;
++}
++/* }}} */
++#else
+/* {{{ my_copy_znode */
-+static znode* my_copy_znode(znode* dst, znode* src, apc_context_t* ctxt)
++static znode* my_copy_znode(znode* dst, znode* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ assert(dst != NULL);
+ assert(src != NULL);
+#endif
+
+ if (src->op_type == IS_CONST) {
-+ if(!my_copy_zval(&dst->u.constant, &src->u.constant, ctxt)) {
++ if(!my_copy_zval(&dst->u.constant, &src->u.constant, ctxt TSRMLS_CC)) {
+ return NULL;
+ }
+ }
+/* }}} */
+
+/* {{{ my_copy_zend_op */
-+static zend_op* my_copy_zend_op(zend_op* dst, zend_op* src, apc_context_t* ctxt)
++static zend_op* my_copy_zend_op(zend_op* dst, zend_op* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ assert(dst != NULL);
+ assert(src != NULL);
+
+ memcpy(dst, src, sizeof(src[0]));
+
-+ CHECK(my_copy_znode(&dst->result, &src->result, ctxt));
-+ CHECK(my_copy_znode(&dst->op1, &src->op1, ctxt));
-+ CHECK(my_copy_znode(&dst->op2, &src->op2, ctxt));
++ CHECK(my_copy_znode(&dst->result, &src->result, ctxt TSRMLS_CC));
++ CHECK(my_copy_znode(&dst->op1, &src->op1, ctxt TSRMLS_CC));
++ CHECK(my_copy_znode(&dst->op2, &src->op2, ctxt TSRMLS_CC));
+
+ return dst;
+}
+/* }}} */
++#endif
+
+/* {{{ my_copy_function */
-+static zend_function* my_copy_function(zend_function* dst, zend_function* src, apc_context_t* ctxt)
++static zend_function* my_copy_function(zend_function* dst, zend_function* src, apc_context_t* ctxt TSRMLS_DC)
+{
-+ TSRMLS_FETCH();
-+
+ assert(src != NULL);
+
-+ CHECK(dst = my_bitwise_copy_function(dst, src, ctxt));
++ CHECK(dst = my_bitwise_copy_function(dst, src, ctxt TSRMLS_CC));
+
+ switch (src->type) {
+ case ZEND_INTERNAL_FUNCTION:
+/* }}} */
+
+/* {{{ my_copy_function_entry */
-+static zend_function_entry* my_copy_function_entry(zend_function_entry* dst, const zend_function_entry* src, apc_context_t* ctxt)
++static zend_function_entry* my_copy_function_entry(zend_function_entry* dst, const zend_function_entry* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ assert(src != NULL);
+
+ dst->arg_info = NULL;
+
+ if (src->fname) {
-+ CHECK((dst->fname = apc_pstrdup(src->fname, ctxt->pool)));
++ CHECK((dst->fname = apc_pstrdup(src->fname, ctxt->pool TSRMLS_CC)));
+ }
+
+ if (src->arg_info) {
+ CHECK((dst->arg_info = my_copy_arg_info_array(NULL,
+ src->arg_info,
+ src->num_args,
-+ ctxt)));
++ ctxt TSRMLS_CC)));
+ }
+
+ return dst;
+/* }}} */
+
+/* {{{ my_copy_property_info */
-+static zend_property_info* my_copy_property_info(zend_property_info* dst, zend_property_info* src, apc_context_t* ctxt)
++static zend_property_info* my_copy_property_info(zend_property_info* dst, zend_property_info* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ apc_pool* pool = ctxt->pool;
+
+ * string of the form:
+ * \0<classname>\0<membername>\0
+ */
-+ CHECK((dst->name = apc_pmemcpy(src->name, src->name_length+1, pool)));
++ CHECK((dst->name = apc_string_pmemcpy(src->name, src->name_length+1, pool TSRMLS_CC)));
+ }
+
+#if defined(ZEND_ENGINE_2) && PHP_MINOR_VERSION > 0
+ if (src->doc_comment) {
-+ CHECK((dst->doc_comment = apc_pmemcpy(src->doc_comment, src->doc_comment_len+1, pool)));
++ CHECK((dst->doc_comment = apc_pmemcpy(src->doc_comment, (src->doc_comment_len + 1), pool TSRMLS_CC)));
+ }
+#endif
+
+/* }}} */
+
+/* {{{ my_copy_property_info_for_execution */
-+static zend_property_info* my_copy_property_info_for_execution(zend_property_info* dst, zend_property_info* src, apc_context_t* ctxt)
++static zend_property_info* my_copy_property_info_for_execution(zend_property_info* dst, zend_property_info* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ assert(src != NULL);
+
+ if (!dst) {
-+ CHECK(dst = (zend_property_info*) apc_pool_alloc(ctxt->pool, (sizeof(*src))));
++ CHECK(dst = (zend_property_info*) apc_pool_alloc(ctxt->pool, sizeof(*src)));
+ }
+
+ /* We need only a shallow copy */
+/* }}} */
+
+/* {{{ my_copy_arg_info_array */
-+static zend_arg_info* my_copy_arg_info_array(zend_arg_info* dst, const zend_arg_info* src, uint num_args, apc_context_t* ctxt)
++static zend_arg_info* my_copy_arg_info_array(zend_arg_info* dst, const zend_arg_info* src, uint num_args, apc_context_t* ctxt TSRMLS_DC)
+{
+ uint i = 0;
+
+
+ if (!dst) {
-+ CHECK(dst = (zend_arg_info*) apc_pool_alloc(ctxt->pool, sizeof(*src)*num_args));
++ CHECK(dst = (zend_arg_info*) apc_pool_alloc(ctxt->pool, (sizeof(*src) * num_args)));
+ }
+
+ /* Start with a bitwise copy */
+ memcpy(dst, src, sizeof(*src)*num_args);
+
+ for(i=0; i < num_args; i++) {
-+ CHECK((my_copy_arg_info( &dst[i], &src[i], ctxt)));
++ CHECK((my_copy_arg_info( &dst[i], &src[i], ctxt TSRMLS_CC)));
+ }
+
+ return dst;
+/* }}} */
+
+/* {{{ my_copy_arg_info */
-+static zend_arg_info* my_copy_arg_info(zend_arg_info* dst, const zend_arg_info* src, apc_context_t* ctxt)
++static zend_arg_info* my_copy_arg_info(zend_arg_info* dst, const zend_arg_info* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ apc_pool* pool = ctxt->pool;
+
+ dst->class_name = NULL;
+
+ if (src->name) {
-+ CHECK((dst->name = apc_pmemcpy(src->name, src->name_len+1, pool)));
++ CHECK((dst->name = apc_string_pmemcpy((char *) src->name, src->name_len+1, pool TSRMLS_CC)));
+ }
+
+ if (src->class_name) {
-+ CHECK((dst->class_name = apc_pmemcpy(src->class_name, src->class_name_len+1, pool)));
++ CHECK((dst->class_name = apc_string_pmemcpy((char *) src->class_name, src->class_name_len+1, pool TSRMLS_CC)));
+ }
+
+ return dst;
+/* }}} */
+
+/* {{{ apc_copy_class_entry */
-+zend_class_entry* apc_copy_class_entry(zend_class_entry* dst, zend_class_entry* src, apc_context_t* ctxt)
++zend_class_entry* apc_copy_class_entry(zend_class_entry* dst, zend_class_entry* src, apc_context_t* ctxt TSRMLS_DC)
+{
-+ return my_copy_class_entry(dst, src, ctxt);
++ return my_copy_class_entry(dst, src, ctxt TSRMLS_CC);
+}
+
+/* {{{ my_copy_class_entry */
-+static zend_class_entry* my_copy_class_entry(zend_class_entry* dst, zend_class_entry* src, apc_context_t* ctxt)
++static zend_class_entry* my_copy_class_entry(zend_class_entry* dst, zend_class_entry* src, apc_context_t* ctxt TSRMLS_DC)
+{
-+ uint i = 0;
++ int i = 0;
+ apc_pool* pool = ctxt->pool;
+
+ assert(src != NULL);
+ memcpy(dst, src, sizeof(*src));
+
+ dst->name = NULL;
-+ dst->builtin_functions = NULL;
+ memset(&dst->function_table, 0, sizeof(dst->function_table));
-+ memset(&dst->default_properties, 0, sizeof(dst->default_properties));
-+ dst->static_members = NULL;
-+ dst->doc_comment = NULL;
-+ dst->filename = NULL;
++ ZEND_CE_DOC_COMMENT(dst) = NULL;
++ ZEND_CE_FILENAME(dst) = NULL;
+ memset(&dst->properties_info, 0, sizeof(dst->properties_info));
+ memset(&dst->constants_table, 0, sizeof(dst->constants_table));
-+ memset(&dst->default_static_members, 0, sizeof(dst->default_static_members));
+
+ if (src->name) {
-+ CHECK((dst->name = apc_pstrdup(src->name, pool)));
++ CHECK((dst->name = apc_pstrdup(src->name, pool TSRMLS_CC)));
+ }
+
+ if(!(my_copy_hashtable_ex(&dst->function_table,
-+ &src->function_table,
++ &src->function_table TSRMLS_CC,
+ (ht_copy_fun_t) my_copy_function,
+ 0,
+ ctxt,
+ /* the current count includes inherited interfaces as well,
+ the real dynamic ones are the first <n> which are zero'd
+ out in zend_do_end_class_declaration */
-+ for(i = 0 ; i < src->num_interfaces ; i++) {
++ for(i = 0 ; (uint)i < src->num_interfaces ; i++) {
+ if(src->interfaces[i])
+ {
+ dst->num_interfaces = i;
+
+ my_fixup_hashtable(&dst->function_table, (ht_fixup_fun_t)my_fixup_function, src, dst);
+
++#ifdef ZEND_ENGINE_2_4
++ dst->default_properties_count = src->default_properties_count;
++ if (src->default_properties_count) {
++ CHECK(dst->default_properties_table = (zval**) apc_pool_alloc(pool, (sizeof(zval*) * src->default_properties_count)));
++ for (i = 0; i < src->default_properties_count; i++) {
++ if (src->default_properties_table[i]) {
++ my_copy_zval_ptr(&dst->default_properties_table[i], (const zval**)&src->default_properties_table[i], ctxt TSRMLS_CC);
++ } else {
++ dst->default_properties_table[i] = NULL;
++ }
++ }
++ } else {
++ dst->default_properties_table = NULL;
++ }
++#else
++ memset(&dst->default_properties, 0, sizeof(dst->default_properties));
+ CHECK((my_copy_hashtable_ex(&dst->default_properties,
-+ &src->default_properties,
++ &src->default_properties TSRMLS_CC,
+ (ht_copy_fun_t) my_copy_zval_ptr,
+ 1,
+ ctxt,
+ (ht_check_copy_fun_t) my_check_copy_default_property,
+ src)));
++#endif
+
+ CHECK((my_copy_hashtable_ex(&dst->properties_info,
-+ &src->properties_info,
++ &src->properties_info TSRMLS_CC,
+ (ht_copy_fun_t) my_copy_property_info,
+ 0,
+ ctxt,
+ my_fixup_hashtable(&dst->properties_info, (ht_fixup_fun_t)my_fixup_property_info_for_execution, src, dst);
+#endif
+
++#ifdef ZEND_ENGINE_2_4
++ dst->default_static_members_count = src->default_static_members_count;
++
++ if (src->default_static_members_count) {
++ CHECK(dst->default_static_members_table = (zval**) apc_pool_alloc(pool, (sizeof(zval*) * src->default_static_members_count)));
++ for (i = 0; i < src->default_static_members_count; i++) {
++ if (src->default_static_members_table[i]) {
++ my_copy_zval_ptr(&dst->default_static_members_table[i], (const zval**)&src->default_static_members_table[i], ctxt TSRMLS_CC);
++ } else {
++ dst->default_static_members_table[i] = NULL;
++ }
++ }
++ } else {
++ dst->default_static_members_table = NULL;
++ }
++ dst->static_members_table = dst->default_static_members_table;
++#else
++ memset(&dst->default_static_members, 0, sizeof(dst->default_static_members));
++ dst->static_members = NULL;
+ CHECK(my_copy_hashtable_ex(&dst->default_static_members,
-+ &src->default_static_members,
++ &src->default_static_members TSRMLS_CC,
+ (ht_copy_fun_t) my_copy_zval_ptr,
+ 1,
+ ctxt,
+ if(src->static_members != &src->default_static_members)
+ {
+ CHECK((dst->static_members = my_copy_hashtable_ex(NULL,
-+ src->static_members,
++ src->static_members TSRMLS_CC,
+ (ht_copy_fun_t) my_copy_zval_ptr,
+ 1,
+ ctxt,
+ {
+ dst->static_members = &dst->default_static_members;
+ }
++#endif
+
-+ CHECK((my_copy_hashtable(&dst->constants_table,
-+ &src->constants_table,
++ CHECK((my_copy_hashtable_ex(&dst->constants_table,
++ &src->constants_table TSRMLS_CC,
+ (ht_copy_fun_t) my_copy_zval_ptr,
+ 1,
-+ ctxt)));
++ ctxt,
++ (ht_check_copy_fun_t) my_check_copy_constant,
++ src)));
+
-+ if (src->doc_comment) {
-+ CHECK(dst->doc_comment =
-+ apc_pmemcpy(src->doc_comment, src->doc_comment_len+1, pool));
++ if (src->type == ZEND_USER_CLASS && ZEND_CE_DOC_COMMENT(src)) {
++ CHECK(ZEND_CE_DOC_COMMENT(dst) =
++ apc_pmemcpy(ZEND_CE_DOC_COMMENT(src), (ZEND_CE_DOC_COMMENT_LEN(src) + 1), pool TSRMLS_CC));
+ }
+
-+ if (src->builtin_functions) {
++ if (src->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(src)) {
+ int i, n;
+
-+ for (n = 0; src->type == ZEND_INTERNAL_CLASS && src->builtin_functions[n].fname != NULL; n++) {}
++ for (n = 0; src->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(src)[n].fname != NULL; n++) {}
+
-+ CHECK((dst->builtin_functions =
-+ (zend_function_entry*) apc_pool_alloc(pool, (n + 1) * sizeof(zend_function_entry))));
++ CHECK((ZEND_CE_BUILTIN_FUNCTIONS(dst) =
++ (zend_function_entry*) apc_pool_alloc(pool, ((n + 1) * sizeof(zend_function_entry)))));
+
+ for (i = 0; i < n; i++) {
-+ CHECK(my_copy_function_entry((zend_function_entry*)(&dst->builtin_functions[i]),
-+ &src->builtin_functions[i],
-+ ctxt));
++ CHECK(my_copy_function_entry((zend_function_entry*)(&ZEND_CE_BUILTIN_FUNCTIONS(dst)[i]),
++ &ZEND_CE_BUILTIN_FUNCTIONS(src)[i],
++ ctxt TSRMLS_CC));
+ }
-+ *(char**)&(dst->builtin_functions[n].fname) = NULL;
++ *(char**)&(ZEND_CE_BUILTIN_FUNCTIONS(dst)[n].fname) = NULL;
+ }
+
-+ if (src->filename) {
-+ CHECK((dst->filename = apc_pstrdup(src->filename, pool)));
++ if (src->type == ZEND_USER_CLASS && ZEND_CE_FILENAME(src)) {
++ CHECK((ZEND_CE_FILENAME(dst) = apc_pstrdup(ZEND_CE_FILENAME(src), pool TSRMLS_CC)));
+ }
+
+ return dst;
+}
+/* }}} */
+
-+/* {{{ my_copy_hashtable */
++/* {{{ my_copy_hashtable_ex */
+static HashTable* my_copy_hashtable_ex(HashTable* dst,
-+ HashTable* src,
++ HashTable* src TSRMLS_DC,
+ ht_copy_fun_t copy_fn,
+ int holds_ptrs,
+ apc_context_t* ctxt,
+ memcpy(dst, src, sizeof(src[0]));
+
+ /* allocate buckets for the new hashtable */
-+ CHECK((dst->arBuckets = apc_pool_alloc(pool, dst->nTableSize * sizeof(Bucket*))));
++ CHECK((dst->arBuckets = apc_pool_alloc(pool, (dst->nTableSize * sizeof(Bucket*)))));
+
+ memset(dst->arBuckets, 0, dst->nTableSize * sizeof(Bucket*));
+ dst->pInternalPointer = NULL;
+ */
+ if(!check_fn(curr, args)) {
+ dst->nNumOfElements--;
++ va_end(args);
+ continue;
+ }
+
+ }
+
+ /* create a copy of the bucket 'curr' */
++#ifdef ZEND_ENGINE_2_4
++ if (!curr->nKeyLength) {
++ 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)));
++ } else if (pool->type != APC_UNPOOL) {
++ char *arKey;
++
++ 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);
++ } else {
++ CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
++ newp->arKey = arKey;
++ }
++ } else {
++ CHECK((newp = (Bucket*) apc_pmemcpy(curr, (sizeof(Bucket) + curr->nKeyLength), pool TSRMLS_CC)));
++ newp->arKey = ((char*)newp) + sizeof(Bucket);
++ }
++#else
+ CHECK((newp = (Bucket*) apc_pmemcpy(curr,
-+ sizeof(Bucket) + curr->nKeyLength - 1,
-+ pool)));
++ (sizeof(Bucket) + curr->nKeyLength - 1),
++ pool TSRMLS_CC)));
++#endif
+
+ /* insert 'newp' into the linked list at its hashed index */
+ if (dst->arBuckets[n]) {
+ dst->arBuckets[n] = newp;
+
+ /* copy the bucket data using our 'copy_fn' callback function */
-+ CHECK((newp->pData = copy_fn(NULL, curr->pData, ctxt)));
++ CHECK((newp->pData = copy_fn(NULL, curr->pData, ctxt TSRMLS_CC)));
+
+ if (holds_ptrs) {
+ memcpy(&newp->pDataPtr, newp->pData, sizeof(void*));
+/* }}} */
+
+/* {{{ my_copy_static_variables */
-+static HashTable* my_copy_static_variables(zend_op_array* src, apc_context_t* ctxt)
++static HashTable* my_copy_static_variables(zend_op_array* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ if (src->static_variables == NULL) {
+ return NULL;
+/* }}} */
+
+/* {{{ apc_copy_zval */
-+zval* apc_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt)
++zval* apc_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ apc_pool* pool = ctxt->pool;
+ int usegc = (ctxt->copy == APC_COPY_OUT_OPCODE) || (ctxt->copy == APC_COPY_OUT_USER);
+ }
+ }
+
-+ CHECK(dst = my_copy_zval(dst, src, ctxt));
++ CHECK(dst = my_copy_zval(dst, src, ctxt TSRMLS_CC));
+ return dst;
+}
+/* }}} */
+ zend_op *zo = &(dst->opcodes[i]);
+ /*convert opline number to jump address*/
+ switch (zo->opcode) {
++#ifdef ZEND_ENGINE_2_3
++ case ZEND_GOTO:
++#endif
+ case ZEND_JMP:
+ /*Note: if src->opcodes != dst->opcodes then we need to the opline according to src*/
++#ifdef ZEND_ENGINE_2_4
++ zo->op1.jmp_addr = dst->opcodes + (zo->op1.jmp_addr - src->opcodes);
++#else
+ zo->op1.u.jmp_addr = dst->opcodes + (zo->op1.u.jmp_addr - src->opcodes);
++#endif
+ break;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+#ifdef ZEND_ENGINE_2_3
+ case ZEND_JMP_SET:
+#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);
++#endif
+ break;
+ default:
+ break;
+zend_op_array* apc_copy_op_array(zend_op_array* dst, zend_op_array* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ int i;
-+ apc_fileinfo_t fileinfo;
++ apc_fileinfo_t *fileinfo = NULL;
+ char canon_path[MAXPATHLEN];
+ char *fullpath = NULL;
+ apc_opflags_t * flags = NULL;
+ CHECK(dst->arg_info = my_copy_arg_info_array(NULL,
+ src->arg_info,
+ src->num_args,
-+ ctxt));
++ ctxt TSRMLS_CC));
+ }
+
+ if (src->function_name) {
-+ CHECK(dst->function_name = apc_pstrdup(src->function_name, pool));
++ CHECK(dst->function_name = apc_pstrdup(src->function_name, pool TSRMLS_CC));
+ }
+ if (src->filename) {
-+ CHECK(dst->filename = apc_pstrdup(src->filename, pool));
++ CHECK(dst->filename = apc_pstrdup(src->filename, pool TSRMLS_CC));
+ }
+
+ CHECK(dst->refcount = apc_pmemcpy(src->refcount,
+ sizeof(src->refcount[0]),
-+ pool));
++ pool TSRMLS_CC));
++
++#ifdef ZEND_ENGINE_2_4
++ if (src->literals) {
++ zend_literal *p, *q, *end;
++
++ q = src->literals;
++ p = dst->literals = (zend_literal*) apc_pool_alloc(pool, (sizeof(zend_literal) * src->last_literal));
++ end = p + src->last_literal;
++ while (p < end) {
++ *p = *q;
++ my_copy_zval(&p->constant, &q->constant, ctxt TSRMLS_CC);
++ p++;
++ q++;
++ }
++ }
++#endif
+
+ /* deep-copy the opcodes */
-+ CHECK(dst->opcodes = (zend_op*) apc_pool_alloc(pool, sizeof(zend_op) * src->last));
++ CHECK(dst->opcodes = (zend_op*) apc_pool_alloc(pool, (sizeof(zend_op) * src->last)));
+
+ if(apc_reserved_offset != -1) {
+ /* Insanity alert: the void* pointer is cast into an apc_opflags_t
+ * struct. apc_zend_init() checks to ensure that it fits in a void* */
+ flags = (apc_opflags_t*) & (dst->reserved[apc_reserved_offset]);
+ memset(flags, 0, sizeof(apc_opflags_t));
-+ /* assert(sizeof(apc_opflags_t) < sizeof(dst->reserved)); */
++ /* assert(sizeof(apc_opflags_t) <= sizeof(dst->reserved)); */
+ }
+
+ for (i = 0; (uint) i < src->last; i++) {
+ zend_op *zo = &(src->opcodes[i]);
+ /* a lot of files are merely constant arrays with no jumps */
+ switch (zo->opcode) {
++#ifdef ZEND_ENGINE_2_3
++ case ZEND_GOTO:
++#endif
+ case ZEND_JMP:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_FETCH_W:
+ case ZEND_FETCH_IS:
+ case ZEND_FETCH_FUNC_ARG:
++ case ZEND_FETCH_RW:
++ case ZEND_FETCH_UNSET:
+ if(PG(auto_globals_jit) && flags != NULL)
+ {
+ /* The fetch is only required if auto_globals_jit=1 */
++#ifdef ZEND_ENGINE_2_4
++ if((zo->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_GLOBAL &&
++ zo->op1_type == IS_CONST &&
++ Z_TYPE_P(zo->op1.zv) == IS_STRING) {
++ if (Z_STRVAL_P(zo->op1.zv)[0] == '_') {
++# define SET_IF_AUTOGLOBAL(member) \
++ if(!strcmp(Z_STRVAL_P(zo->op1.zv), #member)) \
++ flags->member = 1 /* no ';' here */
++#else
+ if(zo->op2.u.EA.type == ZEND_FETCH_GLOBAL &&
+ zo->op1.op_type == IS_CONST &&
+ zo->op1.u.constant.type == IS_STRING) {
+ znode * varname = &zo->op1;
+ if (varname->u.constant.value.str.val[0] == '_') {
-+#define SET_IF_AUTOGLOBAL(member) \
++# define SET_IF_AUTOGLOBAL(member) \
+ if(!strcmp(varname->u.constant.value.str.val, #member)) \
+ flags->member = 1 /* no ';' here */
++#endif
+ SET_IF_AUTOGLOBAL(_GET);
+ else SET_IF_AUTOGLOBAL(_POST);
+ else SET_IF_AUTOGLOBAL(_COOKIE);
+ else SET_IF_AUTOGLOBAL(_ENV);
+ else SET_IF_AUTOGLOBAL(_FILES);
+ else SET_IF_AUTOGLOBAL(_REQUEST);
++ else SET_IF_AUTOGLOBAL(_SESSION);
++#ifdef ZEND_ENGINE_2_4
++ else if(zend_is_auto_global(
++ Z_STRVAL_P(zo->op1.zv),
++ Z_STRLEN_P(zo->op1.zv)
++ TSRMLS_CC))
++#else
+ else if(zend_is_auto_global(
+ varname->u.constant.value.str.val,
+ varname->u.constant.value.str.len
+ TSRMLS_CC))
++#endif
+ {
+ flags->unknown_global = 1;
+ }
++#ifdef ZEND_ENGINE_2_4
++ } else SET_IF_AUTOGLOBAL(GLOBALS);
++#else
+ }
++#endif
+ }
+ }
+ break;
+ case ZEND_RECV_INIT:
++#ifdef ZEND_ENGINE_2_4
++ if(zo->op2_type == IS_CONST &&
++ Z_TYPE_P(zo->op2.zv) == IS_CONSTANT_ARRAY) {
++#else
+ if(zo->op2.op_type == IS_CONST &&
+ zo->op2.u.constant.type == IS_CONSTANT_ARRAY) {
++#endif
+ if(flags != NULL) {
+ flags->deep_copy = 1;
+ }
+ }
+ break;
+ default:
++#ifdef ZEND_ENGINE_2_4
++ if((zo->op1_type == IS_CONST &&
++ Z_TYPE_P(zo->op1.zv) == IS_CONSTANT_ARRAY) ||
++ (zo->op2_type == IS_CONST &&
++ Z_TYPE_P(zo->op2.zv) == IS_CONSTANT_ARRAY)) {
++#else
+ if((zo->op1.op_type == IS_CONST &&
+ zo->op1.u.constant.type == IS_CONSTANT_ARRAY) ||
+ (zo->op2.op_type == IS_CONST &&
+ zo->op2.u.constant.type == IS_CONSTANT_ARRAY)) {
++#endif
+ if(flags != NULL) {
+ flags->deep_copy = 1;
+ }
+ break;
+ }
+
-+ if(!(my_copy_zend_op(dst->opcodes+i, src->opcodes+i, ctxt))) {
++ if(!(my_copy_zend_op(dst->opcodes+i, src->opcodes+i, ctxt TSRMLS_CC))) {
+ return NULL;
+ }
+
-+/* This code breaks apc's rule#1 - cache what you compile */
++#ifdef ZEND_ENGINE_2_4
++ if (zo->op1_type == IS_CONST) {
++ dst->opcodes[i].op1.literal = src->opcodes[i].op1.literal - src->literals + dst->literals;
++ }
++ if (zo->op2_type == IS_CONST) {
++ dst->opcodes[i].op2.literal = src->opcodes[i].op2.literal - src->literals + dst->literals;
++ }
++ if (zo->result_type == IS_CONST) {
++ dst->opcodes[i].result.literal = src->opcodes[i].result.literal - src->literals + dst->literals;
++ }
++#endif
++
++ /* This code breaks apc's rule#1 - cache what you compile */
+ if((APCG(fpstat)==0) && APCG(canonicalize)) {
++ /* not pool allocated, because the pool allocations eat up shm space */
++ fileinfo = (apc_fileinfo_t*) apc_php_malloc(sizeof(apc_fileinfo_t) TSRMLS_CC);
++#ifdef ZEND_ENGINE_2_4
++ if((zo->opcode == ZEND_INCLUDE_OR_EVAL) &&
++ (zo->op1_type == IS_CONST && Z_TYPE_P(zo->op1.zv) == IS_STRING)) {
++ /* constant includes */
++ if(!IS_ABSOLUTE_PATH(Z_STRVAL_P(zo->op1.zv),Z_STRLEN_P(zo->op1.zv))) {
++ if (apc_search_paths(Z_STRVAL_P(zo->op1.zv), PG(include_path), fileinfo TSRMLS_CC) == 0) {
++#else
+ if((zo->opcode == ZEND_INCLUDE_OR_EVAL) &&
+ (zo->op1.op_type == IS_CONST && zo->op1.u.constant.type == IS_STRING)) {
+ /* constant includes */
+ if(!IS_ABSOLUTE_PATH(Z_STRVAL_P(&zo->op1.u.constant),Z_STRLEN_P(&zo->op1.u.constant))) {
-+ if (apc_search_paths(Z_STRVAL_P(&zo->op1.u.constant), PG(include_path), &fileinfo) == 0) {
-+ if((fullpath = realpath(fileinfo.fullpath, canon_path))) {
++ if (apc_search_paths(Z_STRVAL_P(&zo->op1.u.constant), PG(include_path), fileinfo TSRMLS_CC) == 0) {
++#endif
++ if((fullpath = realpath(fileinfo->fullpath, canon_path))) {
+ /* everything has to go through a realpath() */
+ zend_op *dzo = &(dst->opcodes[i]);
++#ifdef ZEND_ENGINE_2_4
++ 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_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);
++#else
+ dzo->op1.u.constant.value.str.len = strlen(fullpath);
-+ dzo->op1.u.constant.value.str.val = apc_pstrdup(fullpath, pool);
++ dzo->op1.u.constant.value.str.val = apc_pstrdup(fullpath, pool TSRMLS_CC);
++#endif
+ }
+ }
+ }
+ }
++ apc_php_free(fileinfo TSRMLS_CC);
+ }
+ }
+
+ if (src->brk_cont_array) {
+ CHECK(dst->brk_cont_array = apc_pmemcpy(src->brk_cont_array,
+ sizeof(src->brk_cont_array[0]) * src->last_brk_cont,
-+ pool));
++ pool TSRMLS_CC));
+ }
+
+ /* copy the table of static variables */
+ if (src->static_variables) {
-+ CHECK(dst->static_variables = my_copy_static_variables(src, ctxt));
++ CHECK(dst->static_variables = my_copy_static_variables(src, ctxt TSRMLS_CC));
+ }
+
+ if (src->try_catch_array) {
+ CHECK(dst->try_catch_array = apc_pmemcpy(src->try_catch_array,
+ sizeof(src->try_catch_array[0]) * src->last_try_catch,
-+ pool));
++ pool TSRMLS_CC));
+ }
+
+#ifdef ZEND_ENGINE_2_1 /* PHP 5.1 */
+ if (src->vars) {
+ CHECK(dst->vars = apc_pmemcpy(src->vars,
+ sizeof(src->vars[0]) * src->last_var,
-+ pool));
++ pool TSRMLS_CC));
+
+ for(i = 0; i < src->last_var; i++) dst->vars[i].name = NULL;
+
+ for(i = 0; i < src->last_var; i++) {
-+ CHECK(dst->vars[i].name = apc_pmemcpy(src->vars[i].name,
++ CHECK(dst->vars[i].name = apc_string_pmemcpy(src->vars[i].name,
+ src->vars[i].name_len + 1,
-+ pool));
++ pool TSRMLS_CC));
+ }
+ }
+#endif
+
+ if (src->doc_comment) {
+ CHECK(dst->doc_comment
-+ = apc_pmemcpy(src->doc_comment, src->doc_comment_len+1, pool));
++ = apc_pmemcpy(src->doc_comment, (src->doc_comment_len + 1), pool TSRMLS_CC));
+ }
+
+ return dst;
+
+ CHECK(array =
+ (apc_function_t*)
-+ apc_pool_alloc(pool, sizeof(apc_function_t) * (new_count+1)));
++ apc_pool_alloc(pool, (sizeof(apc_function_t) * (new_count + 1))));
+
+ if (new_count == 0) {
+ array[0].function = NULL;
+
+ zend_hash_get_current_data(CG(function_table), (void**) &fun);
+
-+ CHECK(array[i].name = apc_pmemcpy(key, (int) key_size, pool));
++ CHECK(array[i].name = apc_pmemcpy(key, (int) key_size, pool TSRMLS_CC));
+ array[i].name_len = (int) key_size-1;
-+ CHECK(array[i].function = my_copy_function(NULL, fun, ctxt));
++ CHECK(array[i].function = my_copy_function(NULL, fun, ctxt TSRMLS_CC));
+ zend_hash_move_forward(CG(function_table));
+ }
+
+
+ CHECK(array =
+ (apc_class_t*)
-+ apc_pool_alloc(pool, sizeof(apc_class_t)*(new_count+1)));
++ apc_pool_alloc(pool, (sizeof(apc_class_t) * (new_count + 1))));
+
+ if (new_count == 0) {
+ array[0].class_entry = NULL;
+
+ elem = *((zend_class_entry**)elem);
+
-+ CHECK(array[i].name = apc_pmemcpy(key, (int) key_size, pool));
++ CHECK(array[i].name = apc_pmemcpy(key, (int) key_size, pool TSRMLS_CC));
+ array[i].name_len = (int) key_size-1;
-+ CHECK(array[i].class_entry = my_copy_class_entry(NULL, elem, ctxt));
++ CHECK(array[i].class_entry = my_copy_class_entry(NULL, elem, ctxt TSRMLS_CC));
+
+ /*
+ * If the class has a pointer to its parent class, save the parent
+ */
+
+ if (elem->parent) {
-+ CHECK(array[i].parent_name = apc_pstrdup(elem->parent->name, pool));
++ CHECK(array[i].parent_name = apc_pstrdup(elem->parent->name, pool TSRMLS_CC));
+ }
+ else {
+ array[i].parent_name = NULL;
+/* }}} */
+
+/* Used only by my_prepare_op_array_for_execution */
-+#define APC_PREPARE_FETCH_GLOBAL_FOR_EXECUTION() \
++#ifdef ZEND_ENGINE_2_4
++# define APC_PREPARE_FETCH_GLOBAL_FOR_EXECUTION() \
++ /* The fetch is only required if auto_globals_jit=1 */ \
++ if((zo->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_GLOBAL && \
++ zo->op1_type == IS_CONST && \
++ Z_TYPE_P(zo->op1.zv) == IS_STRING && \
++ Z_STRVAL_P(zo->op1.zv)[0] == '_') { \
++ (void)zend_is_auto_global(Z_STRVAL_P(zo->op1.zv), \
++ Z_STRLEN_P(zo->op1.zv) \
++ TSRMLS_CC); \
++ }
++#else
++# define APC_PREPARE_FETCH_GLOBAL_FOR_EXECUTION() \
+ /* The fetch is only required if auto_globals_jit=1 */ \
+ if(zo->op2.u.EA.type == ZEND_FETCH_GLOBAL && \
+ zo->op1.op_type == IS_CONST && \
+ (void)zend_is_auto_global(varname->u.constant.value.str.val, \
+ varname->u.constant.value.str.len \
+ TSRMLS_CC); \
-+ } \
++ }
++#endif
+
+/* {{{ my_prepare_op_array_for_execution */
+static int my_prepare_op_array_for_execution(zend_op_array* dst, zend_op_array* src, apc_context_t* ctxt TSRMLS_DC)
+ FETCH_AUTOGLOBAL(_ENV);
+ FETCH_AUTOGLOBAL(_FILES);
+ FETCH_AUTOGLOBAL(_REQUEST);
++ FETCH_AUTOGLOBAL(_SESSION);
++#ifdef ZEND_ENGINE_2_4
++ FETCH_AUTOGLOBAL(GLOBALS);
++#endif
+
+ if(needcopy) {
+
++#ifdef ZEND_ENGINE_2_4
++ if (src->literals) {
++ zend_literal *p, *q, *end;
++
++ q = src->literals;
++ p = dst->literals = (zend_literal*) apc_xmemcpy(src->literals,
++ sizeof(zend_literal) * src->last_literal,
++ apc_php_malloc TSRMLS_CC);
++ end = p + src->last_literal;
++ while (p < end) {
++ if (Z_TYPE(q->constant) == IS_CONSTANT_ARRAY) {
++ my_copy_zval(&p->constant, &q->constant, ctxt TSRMLS_CC);
++ }
++ p++;
++ q++;
++ }
++ }
++#endif
++
+ dst->opcodes = (zend_op*) apc_xmemcpy(src->opcodes,
+ sizeof(zend_op) * src->last,
-+ apc_php_malloc);
++ apc_php_malloc TSRMLS_CC);
+ zo = src->opcodes;
+ dzo = dst->opcodes;
+ while(i > 0) {
+
++#ifdef ZEND_ENGINE_2_4
++ if(zo->op1_type == IS_CONST) {
++ dzo->op1.literal = zo->op1.literal - src->literals + dst->literals;
++ }
++ if(zo->op2_type == IS_CONST) {
++ dzo->op2.literal = zo->op2.literal - src->literals + dst->literals;
++ }
++ if(zo->result_type == IS_CONST) {
++ dzo->result.literal = zo->result.literal - src->literals + dst->literals;
++ }
++#else
+ if( ((zo->op1.op_type == IS_CONST &&
+ zo->op1.u.constant.type == IS_CONSTANT_ARRAY)) ||
+ ((zo->op2.op_type == IS_CONST &&
+ zo->op2.u.constant.type == IS_CONSTANT_ARRAY))) {
+
-+ if(!(my_copy_zend_op(dzo, zo, ctxt))) {
++ if(!(my_copy_zend_op(dzo, zo, ctxt TSRMLS_CC))) {
+ assert(0); /* emalloc failed or a bad constant array */
+ }
+ }
++#endif
+
+ switch(zo->opcode) {
++#ifdef ZEND_ENGINE_2_3
++ case ZEND_GOTO:
++#endif
+ case ZEND_JMP:
++#ifdef ZEND_ENGINE_2_4
++ dzo->op1.jmp_addr = dst->opcodes +
++ (zo->op1.jmp_addr - src->opcodes);
++#else
+ dzo->op1.u.jmp_addr = dst->opcodes +
+ (zo->op1.u.jmp_addr - src->opcodes);
++#endif
+ break;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+#ifdef ZEND_ENGINE_2_3
+ case ZEND_JMP_SET:
+#endif
++#ifdef ZEND_ENGINE_2_4
++ dzo->op2.jmp_addr = dst->opcodes +
++ (zo->op2.jmp_addr - src->opcodes);
++#else
+ dzo->op2.u.jmp_addr = dst->opcodes +
+ (zo->op2.u.jmp_addr - src->opcodes);
++#endif
+ break;
+ case ZEND_FETCH_R:
+ case ZEND_FETCH_W:
+ dst = (zend_op_array*) emalloc(sizeof(src[0]));
+ }
+ memcpy(dst, src, sizeof(src[0]));
-+ dst->static_variables = my_copy_static_variables(src, ctxt);
++ dst->static_variables = my_copy_static_variables(src, ctxt TSRMLS_CC);
+
+ /* memory leak */
+ dst->refcount = apc_pmemcpy(src->refcount,
+ sizeof(src->refcount[0]),
-+ ctxt->pool);
++ ctxt->pool TSRMLS_CC);
+
+ my_prepare_op_array_for_execution(dst,src, ctxt TSRMLS_CC);
+
+/* }}} */
+
+/* {{{ apc_copy_function_for_execution */
-+zend_function* apc_copy_function_for_execution(zend_function* src, apc_context_t* ctxt)
++zend_function* apc_copy_function_for_execution(zend_function* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ zend_function* dst;
-+ TSRMLS_FETCH();
+
+ dst = (zend_function*) emalloc(sizeof(src[0]));
+ memcpy(dst, src, sizeof(src[0]));
+/* }}} */
+
+/* {{{ apc_copy_function_for_execution_ex */
-+zend_function* apc_copy_function_for_execution_ex(void *dummy, zend_function* src, apc_context_t* ctxt)
++zend_function* apc_copy_function_for_execution_ex(void *dummy, zend_function* src, apc_context_t* ctxt TSRMLS_DC)
+{
+ if(src->type==ZEND_INTERNAL_FUNCTION || src->type==ZEND_OVERLOADED_FUNCTION) return src;
-+ return apc_copy_function_for_execution(src, ctxt);
++ return apc_copy_function_for_execution(src, ctxt TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ apc_copy_class_entry_for_execution */
-+zend_class_entry* apc_copy_class_entry_for_execution(zend_class_entry* src, apc_context_t* ctxt)
++zend_class_entry* apc_copy_class_entry_for_execution(zend_class_entry* src, apc_context_t* ctxt TSRMLS_DC)
+{
++#ifdef ZEND_ENGINE_2_4
++ int i;
++#endif
+ zend_class_entry* dst = (zend_class_entry*) apc_pool_alloc(ctxt->pool, sizeof(src[0]));
+ memcpy(dst, src, sizeof(src[0]));
+
+ {
+ /* These are slots to be populated later by ADD_INTERFACE insns */
+ dst->interfaces = apc_php_malloc(
-+ sizeof(zend_class_entry*) * src->num_interfaces);
++ (sizeof(zend_class_entry*) * src->num_interfaces) TSRMLS_CC);
+ memset(dst->interfaces, 0,
+ sizeof(zend_class_entry*) * src->num_interfaces);
+ }
+
+ /* Deep-copy the class properties, because they will be modified */
+
++#ifdef ZEND_ENGINE_2_4
++ 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);
++ for (i = 0; i < src->default_properties_count; i++) {
++ if (src->default_properties_table[i]) {
++ my_copy_zval_ptr(&dst->default_properties_table[i], (const zval**)&src->default_properties_table[i], ctxt TSRMLS_CC);
++ } else {
++ dst->default_properties_table[i] = NULL;
++ }
++ }
++ } else {
++ dst->default_properties_table = NULL;
++ }
++#else
+ my_copy_hashtable(&dst->default_properties,
+ &src->default_properties,
+ (ht_copy_fun_t) my_copy_zval_ptr,
+ 1,
+ ctxt);
++#endif
+
+ /* For derived classes, we must also copy the function hashtable (although
+ * we can merely bitwise copy the functions it contains) */
+ 1,
+ ctxt);
+
++#ifdef ZEND_ENGINE_2_4
++ dst->default_static_members_count = src->default_static_members_count;
++ if (src->default_static_members_count) {
++ dst->default_static_members_table = (zval**) apc_php_malloc((sizeof(zval*) * src->default_static_members_count) TSRMLS_CC);
++ for (i = 0; i < src->default_static_members_count; i++) {
++ if (src->default_static_members_table[i]) {
++ my_copy_zval_ptr(&dst->default_static_members_table[i], (const zval**)&src->default_static_members_table[i], ctxt TSRMLS_CC);
++ } else {
++ dst->default_static_members_table[i] = NULL;
++ }
++ }
++ } else {
++ dst->default_static_members_table = NULL;
++ }
++ dst->static_members_table = dst->default_static_members_table;
++#else
+ my_copy_hashtable(&dst->default_static_members,
+ &src->default_static_members,
+ (ht_copy_fun_t) my_copy_zval_ptr,
+ {
+ dst->static_members = &(dst->default_static_members);
+ }
-+
++#endif
+
+ return dst;
+}
+/* }}} */
+
+/* {{{ apc_free_class_entry_after_execution */
-+void apc_free_class_entry_after_execution(zend_class_entry* src)
++void apc_free_class_entry_after_execution(zend_class_entry* src TSRMLS_DC)
+{
+ if(src->num_interfaces > 0 && src->interfaces) {
-+ apc_php_free(src->interfaces);
++ apc_php_free(src->interfaces TSRMLS_CC);
+ src->interfaces = NULL;
+ src->num_interfaces = 0;
+ }
+ /* my_destroy_hashtable() does not play nice with refcounts */
+
++#ifdef ZEND_ENGINE_2_4
++ if (src->default_static_members_table) {
++ int i;
++
++ for (i = 0; i < src->default_static_members_count; i++) {
++ zval_ptr_dtor(&src->default_static_members_table[i]);
++ }
++ efree(src->default_static_members_table);
++ src->default_static_members_table = NULL;
++ }
++ src->static_members_table = NULL;
++ if (src->default_properties_table) {
++ int i;
++
++ for (i = 0; i < src->default_properties_count; i++) {
++ if (src->default_properties_table[i]) {
++ zval_ptr_dtor(&src->default_properties_table[i]);
++ }
++ }
++ efree(src->default_properties_table);
++ src->default_properties_table = NULL;
++ }
++#else
+ zend_hash_clean(&src->default_static_members);
+ if(src->static_members != &(src->default_static_members))
+ {
+ zend_hash_destroy(src->static_members);
-+ apc_php_free(src->static_members);
++ apc_php_free(src->static_members TSRMLS_CC);
+ src->static_members = NULL;
+ }
+ else
+ {
+ src->static_members = NULL;
+ }
++
+ zend_hash_clean(&src->default_properties);
++#endif
+ zend_hash_clean(&src->constants_table);
+
+ /* TODO: more cleanup */
+/* }}} */
+
+/* {{{ apc_file_halt_offset */
-+long apc_file_halt_offset(const char *filename)
++long apc_file_halt_offset(const char *filename TSRMLS_DC)
+{
+ zend_constant *c;
+ char *name;
+ int len;
+ char haltoff[] = "__COMPILER_HALT_OFFSET__";
+ long value = -1;
-+ TSRMLS_FETCH();
+
+ zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, filename, strlen(filename), 0);
+
+}
+/* }}} */
+
++#ifndef ZEND_ENGINE_2_4
+/* {{{ my_check_copy_default_property */
+static int my_check_copy_default_property(Bucket* p, va_list args)
+{
+ return 1;
+}
+/* }}} */
-+
++#endif
+
+/* {{{ my_check_copy_property_info */
+static int my_check_copy_property_info(Bucket* p, va_list args)
+}
+/* }}} */
+
++#ifndef ZEND_ENGINE_2_4
+/* {{{ my_check_copy_static_member */
+static int my_check_copy_static_member(Bucket* p, va_list args)
+{
+ (zend_hash_find(&src->properties_info, member_name,
+ strlen(member_name)+1, (void**)&child_info) == SUCCESS))
+ {
-+ if(child_info->flags & ZEND_ACC_STATIC &&
-+ (parent_info->flags & ZEND_ACC_PROTECTED &&
-+ child_info->flags & ZEND_ACC_PUBLIC))
-+ {
-+ /* Do not copy into static_members. zend_do_inheritance
-+ * will automatically insert a NULL value.
-+ * TODO: decrement refcount or fixup when copying out for exec ?
-+ */
-+ return 0;
-+ }
+ if(ht == &(src->default_static_members))
+ {
+ parent_ht = &parent->default_static_members;
+ return 1;
+}
+/* }}} */
++#endif
++
++/* {{{ my_check_copy_constant */
++static int my_check_copy_constant(Bucket* p, va_list args)
++{
++ zend_class_entry* src = va_arg(args, zend_class_entry*);
++ zend_class_entry* parent = src->parent;
++ zval ** child_const = (zval**)p->pData;
++ zval ** parent_const = NULL;
++
++ if (parent &&
++ zend_hash_quick_find(&parent->constants_table, p->arKey,
++ p->nKeyLength, p->h, (void **) &parent_const)==SUCCESS) {
++
++ if((parent_const && child_const) && (*parent_const) == (*child_const))
++ {
++ return 0;
++ }
++ }
++
++ /* possibly not in the parent */
++ return 1;
++}
++/* }}} */
+
+/* {{{ apc_register_optimizer(apc_optimize_function_t optimizer)
+ * register a optimizer callback function, returns the previous callback
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_compile.h php-5.3.1/ext/apc/apc_compile.h
---- php-5.3.1.orig/ext/apc/apc_compile.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_compile.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,142 @@
+--- /dev/null
++++ b/ext/apc/apc_compile.h
+@@ -0,0 +1,146 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 275218 2009-02-05 13:16:06Z gopalv $ */
++/* $Id: apc_compile.h 303388 2010-09-15 09:50:28Z dmitry $ */
+
+#ifndef APC_COMPILE_H
+#define APC_COMPILE_H
+ unsigned int _ENV : 1;
+ unsigned int _FILES : 1;
+ unsigned int _REQUEST : 1;
++ unsigned int _SESSION : 1;
++#ifdef ZEND_ENGINE_2_4
++ unsigned int GLOBALS : 1;
++#endif
+ unsigned int unknown_global : 1;
+};
+/* }}} */
+ */
+
+extern zend_op_array* apc_copy_op_array(zend_op_array* dst, zend_op_array* src, apc_context_t* ctxt TSRMLS_DC);
-+extern zend_class_entry* apc_copy_class_entry(zend_class_entry* dst, zend_class_entry* src, apc_context_t* ctxt);
++extern zend_class_entry* apc_copy_class_entry(zend_class_entry* dst, zend_class_entry* src, apc_context_t* ctxt TSRMLS_DC);
+extern apc_function_t* apc_copy_new_functions(int old_count, apc_context_t* ctxt TSRMLS_DC);
+extern apc_class_t* apc_copy_new_classes(zend_op_array* op_array, int old_count, apc_context_t* ctxt TSRMLS_DC);
-+extern zval* apc_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt);
++extern zval* apc_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC);
+
+#if 0
+/*
+ */
+
+extern zend_op_array* apc_copy_op_array_for_execution(zend_op_array* dst, zend_op_array* src, apc_context_t* ctxt TSRMLS_DC);
-+extern zend_function* apc_copy_function_for_execution(zend_function* src, apc_context_t* ctxt);
-+extern zend_class_entry* apc_copy_class_entry_for_execution(zend_class_entry* src, apc_context_t* ctxt);
++extern zend_function* apc_copy_function_for_execution(zend_function* src, apc_context_t* ctxt TSRMLS_DC);
++extern zend_class_entry* apc_copy_class_entry_for_execution(zend_class_entry* src, apc_context_t* ctxt TSRMLS_DC);
+
+/*
+ * The "free-after-execution" function performs a cursory clean up of the class data
+ * This is required to minimize memory leak warnings and to ensure correct destructor
+ * ordering of some variables.
+ */
-+extern void apc_free_class_entry_after_execution(zend_class_entry* src);
++extern void apc_free_class_entry_after_execution(zend_class_entry* src TSRMLS_DC);
+
+/*
+ * Optimization callback definition and registration function.
+/*
+ * To handle __COMPILER_HALT_OFFSET__
+ */
-+long apc_file_halt_offset(const char* filename);
++long apc_file_halt_offset(const char* filename TSRMLS_DC);
+void apc_do_halt_compiler_register(const char *filename, long halt_offset TSRMLS_DC);
+
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_debug.c php-5.3.1/ext/apc/apc_debug.c
---- php-5.3.1.orig/ext/apc/apc_debug.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_debug.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,57 @@
+--- /dev/null
++++ b/ext/apc/apc_debug.c
+@@ -0,0 +1,70 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_debug.c 304107 2010-10-05 15:14:06Z kalle $ */
+#include "apc.h"
+#include <stdio.h>
++#include "zend.h"
+#include "zend_compile.h"
+
-+#ifdef __DEBUG_APC__
-+
-+#include <dlfcn.h>
++#if defined(__DEBUG_APC__)
+
+/* keep track of vld_dump_oparray() signature */
+typedef void (*vld_dump_f) (zend_op_array * TSRMLS_DC);
+
+void dump(zend_op_array *op_array TSRMLS_DC)
+{
-+#ifdef __DEBUG_APC__
-+ vld_dump_f dump_op_array = dlsym(NULL, "vld_dump_oparray");
++#if defined(__DEBUG_APC__)
++ vld_dump_f dump_op_array;
++ DL_HANDLE handle = NULL;
+
-+ if(dump_op_array)
-+ {
-+ dump_op_array(op_array TSRMLS_CC);
++#ifdef PHP_WIN32
++ handle = GetModuleHandle(NULL);
++
++ if (!handle) {
++ apc_warning("unable to fetch current module handle." TSRMLS_CC);
+ }
-+ else
-+ {
-+ apc_wprint("vld is not installed or something even worse.");
++#endif
++
++ dump_op_array = (vld_dump_f) DL_FETCH_SYMBOL(handle, "vld_dump_oparray");
++
++#ifdef PHP_WIN32
++ DL_UNLOAD(handle);
++#endif
++
++ if(dump_op_array) {
++ dump_op_array(op_array TSRMLS_CC);
++
++ return;
+ }
++
++ apc_warning("vld is not installed or something even worse." TSRMLS_CC);
+#endif
+}
-diff -Naur php-5.3.1.orig/ext/apc/apc_debug.h php-5.3.1/ext/apc/apc_debug.h
---- php-5.3.1.orig/ext/apc/apc_debug.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_debug.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1 @@
-+void dump(zend_op_array * TSRMLS_DC);
-diff -Naur php-5.3.1.orig/ext/apc/apc.dsp php-5.3.1/ext/apc/apc.dsp
---- php-5.3.1.orig/ext/apc/apc.dsp 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc.dsp 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,207 @@
-+# Microsoft Developer Studio Project File - Name="apc" - Package Owner=<4>
-+# Microsoft Developer Studio Generated Build File, Format Version 6.00
-+# ** DO NOT EDIT **
-+
-+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-+
-+CFG=apc - Win32 Debug_TS
-+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-+!MESSAGE use the Export Makefile command and run
-+!MESSAGE
-+!MESSAGE NMAKE /f "apc.mak".
-+!MESSAGE
-+!MESSAGE You can specify a configuration when running NMAKE
-+!MESSAGE by defining the macro CFG on the command line. For example:
-+!MESSAGE
-+!MESSAGE NMAKE /f "apc.mak" CFG="apc - Win32 Debug_TS"
-+!MESSAGE
-+!MESSAGE Possible choices for configuration are:
-+!MESSAGE
-+!MESSAGE "apc - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-+!MESSAGE "apc - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-+!MESSAGE
-+
-+# Begin Project
-+# PROP AllowPerConfigDependencies 0
-+# PROP Scc_ProjName ""
-+# PROP Scc_LocalPath ""
-+CPP=cl.exe
-+MTL=midl.exe
-+RSC=rc.exe
-+
-+!IF "$(CFG)" == "apc - Win32 Debug_TS"
-+
-+# PROP BASE Use_MFC 0
-+# PROP BASE Use_Debug_Libraries 1
-+# PROP BASE Output_Dir "Debug_TS"
-+# PROP BASE Intermediate_Dir "Debug_TS"
-+# PROP BASE Target_Dir ""
-+# PROP Use_MFC 0
-+# PROP Use_Debug_Libraries 1
-+# PROP Output_Dir "Debug_TS"
-+# PROP Intermediate_Dir "Debug_TS"
-+# PROP Ignore_Export_Lib 0
-+# PROP Target_Dir ""
-+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APC_EXPORTS" /YX /FD /GZ /c
-+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\php4" /I "..\..\..\php4\main" /I "..\..\..\php4\Zend" /I "..\..\..\php4\TSRM" /I "..\..\..\php4\win32" /I "..\..\..\php4\regex" /D "TSRM_LOCKS" /D HAVE_APC=1 /D "COMPILE_DL_APC" /D ZEND_DEBUG=1 /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APC_EXPORTS" /YX /FD /GZ /c
-+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-+# ADD BASE RSC /l 0x409 /d "_DEBUG"
-+# ADD RSC /l 0x409 /d "_DEBUG"
-+BSC32=bscmake.exe
-+# ADD BASE BSC32 /nologo
-+# ADD BSC32 /nologo
-+LINK32=link.exe
-+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-+# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_apc.dll" /pdbtype:sept /libpath:"..\..\..\php4\Debug_TS"
-+
-+!ELSEIF "$(CFG)" == "apc - Win32 Release_TS"
-+
-+# PROP BASE Use_MFC 0
-+# PROP BASE Use_Debug_Libraries 0
-+# PROP BASE Output_Dir "Release_TS"
-+# PROP BASE Intermediate_Dir "Release_TS"
-+# PROP BASE Target_Dir ""
-+# PROP Use_MFC 0
-+# PROP Use_Debug_Libraries 0
-+# PROP Output_Dir "Release_TS"
-+# PROP Intermediate_Dir "Release_TS"
-+# PROP Ignore_Export_Lib 0
-+# PROP Target_Dir ""
-+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APC_EXPORTS" /YX /FD /c
-+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\php4" /I "..\..\..\php4\main" /I "..\..\..\php4\Zend" /I "..\..\..\php4\TSRM" /I "..\..\..\php4\win32" /I "..\..\..\php4\regex" /D "TSRM_LOCKS" /D HAVE_APC=1 /D "COMPILE_DL_APC" /D ZEND_DEBUG=0 /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APC_EXPORTS" /YX /FD /c
-+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-+# ADD BASE RSC /l 0x409 /d "NDEBUG"
-+# ADD RSC /l 0x409 /d "NDEBUG"
-+BSC32=bscmake.exe
-+# ADD BASE BSC32 /nologo
-+# ADD BSC32 /nologo
-+LINK32=link.exe
-+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-+# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../Release_TS/php_apc.dll" /libpath:"..\..\..\php4\Release_TS" /libpath:"..\..\..\php4\Release_TS_Inline"
-+
-+!ENDIF
-+
-+# Begin Target
-+
-+# Name "apc - Win32 Debug_TS"
-+# Name "apc - Win32 Release_TS"
-+# Begin Group "Source Files"
-+
-+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-+# Begin Source File
-+
-+SOURCE=.\apc.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_cache.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_compile.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_debug.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_fcntl_win32.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_main.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_rfc1867.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_shm.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_sma.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_stack.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_zend.c
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\php_apc.c
-+# End Source File
-+# End Group
-+# Begin Group "Header Files"
-+
-+# PROP Default_Filter "h;hpp;hxx;hm;inl"
-+# Begin Source File
-+
-+SOURCE=.\apc.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_cache.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_compile.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_debug.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_fcntl.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_globals.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_lock.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_main.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_php.h
-+# End Source File
-+# Begin Source File
+--- /dev/null
++++ b/ext/apc/apc_debug.h
+@@ -0,0 +1,29 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2010 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: Daniel Cowgill <dcowgill@communityconnect.com> |
++ | Arun C. Murthy <arunc@yahoo-inc.com> |
++ | Gopal Vijayaraghavan <gopalv@yahoo-inc.com> |
++ +----------------------------------------------------------------------+
+
-+SOURCE=.\apc_shm.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_sma.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_stack.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\apc_zend.h
-+# End Source File
-+# Begin Source File
-+
-+SOURCE=.\php_apc.h
-+# End Source File
-+# End Group
-+# Begin Group "Resource Files"
-+
-+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-+# End Group
-+# End Target
-+# End Project
-diff -ubrN php-5.2.5-orig/ext/apc/apc_fcntl.c php-5.2.5/ext/apc/apc_fcntl.c
---- php-5.2.5-orig/ext/apc/apc_fcntl.c 1969-12-31 18:00:00.000000000 -0600
-+++ php-5.2.5/ext/apc/apc_fcntl.c 2007-12-26 16:51:32.000000000 -0600
-@@ -0,0 +1,118 @@
++ 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.
++*/
++
++void dump(zend_op_array * TSRMLS_DC);
+--- /dev/null
++++ b/ext/apc/apc_fcntl.c
+@@ -0,0 +1,123 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_fcntl.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "apc.h"
+
+#include <unistd.h>
+#include <fcntl.h>
+
-+int apc_fcntl_create(const char* pathname)
++int apc_fcntl_create(const char* pathname TSRMLS_DC)
+{
+ int fd;
+ if(pathname == NULL) {
+ unlink(lock_path);
+ return fd;
+ } else {
-+ apc_eprint("apc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:", lock_path);
++ apc_error("apc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:" TSRMLS_CC, lock_path);
+ return -1;
+ }
+ }
+ unlink(pathname);
+ return fd;
+ }
-+ apc_eprint("apc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:", pathname);
++ apc_error("apc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:" TSRMLS_CC, pathname);
+ return -1;
+}
+
+ return(ret);
+}
+
-+void apc_fcntl_lock(int fd)
++void apc_fcntl_lock(int fd TSRMLS_DC)
+{
+ if(lock_reg(fd, F_SETLKW, F_WRLCK, 0, SEEK_SET, 0) < 0) {
-+ apc_eprint("apc_fcntl_lock failed:");
++ apc_error("apc_fcntl_lock failed:" TSRMLS_CC);
+ }
+}
+
-+void apc_fcntl_rdlock(int fd)
++void apc_fcntl_rdlock(int fd TSRMLS_DC)
+{
+ if(lock_reg(fd, F_SETLKW, F_RDLCK, 0, SEEK_SET, 0) < 0) {
-+ apc_eprint("apc_fcntl_rdlock failed:");
++ apc_error("apc_fcntl_rdlock failed:" TSRMLS_CC);
+ }
+}
+
-+zend_bool apc_fcntl_nonblocking_lock(int fd)
++zend_bool apc_fcntl_nonblocking_lock(int fd TSRMLS_DC)
+{
+ if(lock_reg(fd, F_SETLK, F_WRLCK, 0, SEEK_SET, 0) < 0) {
+ if(errno==EACCES||errno==EAGAIN) return 0;
-+ else apc_eprint("apc_fcntl_lock failed:");
++ else apc_error("apc_fcntl_lock failed:" TSRMLS_CC);
+ }
+ return 1;
+}
+
-+void apc_fcntl_unlock(int fd)
++void apc_fcntl_unlock(int fd TSRMLS_DC)
+{
+ if(lock_reg(fd, F_SETLKW, F_UNLCK, 0, SEEK_SET, 0) < 0) {
-+ apc_eprint("apc_fcntl_unlock failed:");
++ apc_error("apc_fcntl_unlock failed:" TSRMLS_CC);
+ }
+}
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_fcntl.h php-5.3.1/ext/apc/apc_fcntl.h
---- php-5.3.1.orig/ext/apc/apc_fcntl.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_fcntl.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_fcntl.h
@@ -0,0 +1,50 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_fcntl.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_FCNTL_H
+#define APC_FCNTL_H
+
+
-+extern int apc_fcntl_create(const char* pathname);
++extern int apc_fcntl_create(const char* pathname TSRMLS_DC);
+extern void apc_fcntl_destroy(int fd);
-+extern void apc_fcntl_lock(int fd);
-+extern void apc_fcntl_rdlock(int fd);
-+extern void apc_fcntl_unlock(int fd);
-+extern unsigned char apc_fcntl_nonblocking_lock(int fd);
++extern void apc_fcntl_lock(int fd TSRMLS_DC);
++extern void apc_fcntl_rdlock(int fd TSRMLS_DC);
++extern void apc_fcntl_unlock(int fd TSRMLS_DC);
++extern unsigned char apc_fcntl_nonblocking_lock(int fd TSRMLS_DC);
+#endif
+
+/*
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_fcntl_win32.c php-5.3.1/ext/apc/apc_fcntl_win32.c
---- php-5.3.1.orig/ext/apc/apc_fcntl_win32.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_fcntl_win32.c 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_fcntl_win32.c
@@ -0,0 +1,117 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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_win32.c 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_fcntl_win32.c 302175 2010-08-13 06:20:28Z kalle $ */
+
-+#include "apc_fcntl.h"
+#include "apc.h"
++#include "apc_fcntl.h"
+#include <php.h>
+#include <win32/flock.h>
+#include <io.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
-+int apc_fcntl_create(const char* pathname)
++int apc_fcntl_create(const char* pathname TSRMLS_DC)
+{
+ char *lock_file = emalloc(MAXPATHLEN);
+ HANDLE fd;
+
+
+ if (fd == INVALID_HANDLE_VALUE) {
-+ apc_eprint("apc_fcntl_create: could not open %s", lock_file);
++ apc_error("apc_fcntl_create: could not open %s" TSRMLS_CC, lock_file);
+ efree(lock_file);
+ return -1;
+ }
+ CloseHandle((HANDLE)fd);
+}
+
-+void apc_fcntl_lock(int fd)
++void apc_fcntl_lock(int fd TSRMLS_DC)
+{
+ OVERLAPPED offset = {0, 0, 0, 0, NULL};
+
+ if (!LockFileEx((HANDLE)fd, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &offset)) {
-+ apc_eprint("apc_fcntl_lock failed errno:%d", GetLastError());
++ apc_error("apc_fcntl_lock failed errno:%d" TSRMLS_CC, GetLastError());
+ }
+}
+
-+void apc_fcntl_rdlock(int fd)
++void apc_fcntl_rdlock(int fd TSRMLS_DC)
+{
+ OVERLAPPED offset = {0, 0, 0, 0, NULL};
+
+ if (!LockFileEx((HANDLE)fd, 0, 0, 1, 0, &offset)) {
-+ apc_eprint("apc_fcntl_rdlock failed errno:%d", GetLastError());
++ apc_error("apc_fcntl_rdlock failed errno:%d" TSRMLS_CC, GetLastError());
+ }
+}
+
-+void apc_fcntl_unlock(int fd)
++void apc_fcntl_unlock(int fd TSRMLS_DC)
+{
+ OVERLAPPED offset = {0, 0, 0, 0, NULL};
+
+ DWORD error_code = GetLastError();
+ /* Ignore already unlocked error */
+ if (error_code != ERROR_NOT_LOCKED) {
-+ apc_eprint("apc_fcntl_unlock failed errno:%d", error_code);
++ apc_error("apc_fcntl_unlock failed errno:%d" TSRMLS_CC, error_code);
+ }
+ }
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_globals.h php-5.3.1/ext/apc/apc_globals.h
---- php-5.3.1.orig/ext/apc/apc_globals.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_globals.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,143 @@
+--- /dev/null
++++ b/ext/apc/apc_globals.h
+@@ -0,0 +1,148 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 284222 2009-07-17 01:23:57Z shire $ */
++/* $Id: apc_globals.h 301232 2010-07-13 12:23:35Z gopalv $ */
+
+#ifndef APC_GLOBALS_H
+#define APC_GLOBALS_H
+ size_t prev_bytes_processed;
+ int update_freq;
+ double rate;
++ int started;
+};
+/* }}} */
+
+ zend_bool canonicalize; /* true if relative paths should be canonicalized in no-stat mode */
+ zend_bool stat_ctime; /* true if ctime in addition to mtime should be checked */
+ zend_bool write_lock; /* true for a global write lock */
++ zend_bool slam_defense; /* true for user cache slam defense */
+ zend_bool report_autofilter; /* true for auto-filter warnings */
+ zend_bool include_once; /* Override the ZEND_INCLUDE_OR_EVAL opcode handler to avoid pointless fopen()s [still experimental] */
+ apc_optimize_function_t apc_optimize_function; /* optimizer function callback */
+ HashTable copied_zvals; /* my_copy recursion detection list */
+ zend_bool force_file_update; /* force files to be updated during apc_compile_file */
+ char canon_path[MAXPATHLEN]; /* canonical path for key data */
-+#if APC_FILEHITS
++#ifdef APC_FILEHITS
+ zval *filehits; /* Files that came from the cache for this request */
+#endif
+ zend_bool coredump_unmap; /* Trap signals that coredump and unmap shared memory */
+ HashTable *lazy_function_table; /* lazy function entry table */
+ zend_bool lazy_classes; /* enable/disable lazy class loading */
+ HashTable *lazy_class_table; /* lazy class entry table */
++#ifdef ZEND_ENGINE_2_4
++ long shm_strings_buffer;
++#endif
+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
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc.h php-5.3.1/ext/apc/apc.h
---- php-5.3.1.orig/ext/apc/apc.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,126 @@
+--- /dev/null
++++ b/ext/apc/apc.h
+@@ -0,0 +1,124 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 276125 2009-02-19 01:02:59Z shire $ */
++/* $Id: apc.h 304310 2010-10-11 12:19:24Z gopalv $ */
+
+#ifndef APC_H
+#define APC_H
+#include "php.h"
+#include "main/php_streams.h"
+
-+/* log levels constants (see my_log) */
-+enum { APC_DBG, APC_NOTICE, APC_WARNING, APC_ERROR };
-+
+/* typedefs for extensible memory allocators */
-+typedef void* (*apc_malloc_t)(size_t);
-+typedef void (*apc_free_t) (void*);
++typedef void* (*apc_malloc_t)(size_t TSRMLS_DC);
++typedef void (*apc_free_t) (void * TSRMLS_DC);
+
+/* wrappers for memory allocation routines */
-+extern void* apc_emalloc(size_t n);
-+extern void* apc_erealloc(void* p, size_t n);
-+extern void apc_efree(void* p);
-+extern char* apc_estrdup(const char* s);
-+extern void* apc_xstrdup(const char* s, apc_malloc_t f);
-+extern void* apc_xmemcpy(const void* p, size_t n, apc_malloc_t f);
++extern void* apc_emalloc(size_t n TSRMLS_DC);
++extern void* apc_erealloc(void* p, size_t n TSRMLS_DC);
++extern void apc_efree(void* p TSRMLS_DC);
++extern char* apc_estrdup(const char* s TSRMLS_DC);
++extern void* apc_xstrdup(const char* s, apc_malloc_t f TSRMLS_DC);
++extern void* apc_xmemcpy(const void* p, size_t n, apc_malloc_t f TSRMLS_DC);
+
+/* console display functions */
-+extern void apc_eprint(const char* fmt, ...);
-+extern void apc_wprint(const char* fmt, ...);
-+extern void apc_dprint(const char* fmt, ...);
-+extern void apc_nprint(const char* fmt, ...);
++extern void apc_error(const char *format TSRMLS_DC, ...);
++extern void apc_warning(const char *format TSRMLS_DC, ...);
++extern void apc_notice(const char *format TSRMLS_DC, ...);
++extern void apc_debug(const char *format TSRMLS_DC, ...);
+
+/* string and text manipulation */
-+extern char* apc_append(const char* s, const char* t);
-+extern char* apc_substr(const char* s, int start, int length);
-+extern char** apc_tokenize(const char* s, char delim);
++extern char* apc_append(const char* s, const char* t TSRMLS_DC);
++extern char* apc_substr(const char* s, int start, int length TSRMLS_DC);
++extern char** apc_tokenize(const char* s, char delim TSRMLS_DC);
+
+/* filesystem functions */
+
+typedef struct apc_fileinfo_t
+{
-+ char fullpath[MAXPATHLEN+1];
++ char *fullpath;
++ char path_buf[MAXPATHLEN];
+ php_stream_statbuf st_buf;
+} apc_fileinfo_t;
+
-+extern int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo);
++extern int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo TSRMLS_DC);
+
+/* regular expression wrapper functions */
+extern void* apc_regex_compile_array(char* patterns[] TSRMLS_DC);
-+extern void apc_regex_destroy_array(void* p);
++extern void apc_regex_destroy_array(void* p TSRMLS_DC);
+extern int apc_regex_match_array(void* p, const char* input);
+
+/* apc_crc32: returns the CRC-32 checksum of the first len bytes in buf */
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_iterator.c php-5.3.1/ext/apc/apc_iterator.c
---- php-5.3.1.orig/ext/apc/apc_iterator.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_iterator.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,634 @@
+--- /dev/null
++++ b/ext/apc/apc_iterator.c
+@@ -0,0 +1,710 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2008 The PHP Group |
++ | Copyright (c) 2006-2010 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: Brian Shire <shire@.php.net> |
++ | Authors: Brian Shire <shire@php.net> |
+ +----------------------------------------------------------------------+
+
+ */
+
-+/* $Id: apc_iterator.c 284698 2009-07-24 11:35:52Z kalle $ */
++/* $Id: apc_iterator.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "php_apc.h"
+#include "apc_iterator.h"
+
+
+/* {{{ apc_iterator_item */
-+static apc_iterator_item_t* apc_iterator_item_ctor(apc_iterator_t *iterator, slot_t **slot_pp) {
++static apc_iterator_item_t* apc_iterator_item_ctor(apc_iterator_t *iterator, slot_t **slot_pp TSRMLS_DC) {
+ zval *zvalue;
+ char md5str[33];
+ slot_t *slot = *slot_pp;
+
+ if (slot->key.type == APC_CACHE_KEY_FILE) {
+ /* keys should be unique and with stat=1 we could have multiple files with the same name, so use '<device> <inode>' instead */
++#ifdef PHP_WIN32
++ item->key_len = spprintf(&item->key, 0, "%I64d %I64d", slot->key.data.file.device, slot->key.data.file.inode);
++#else
+ item->key_len = spprintf(&item->key, 0, "%ld %ld", (ulong)slot->key.data.file.device, (ulong)slot->key.data.file.inode);
++#endif
+ item->filename_key = estrdup(slot->value->data.file.filename);
+ } else if (slot->key.type == APC_CACHE_KEY_USER) {
+ item->key = estrndup((char*)slot->key.data.user.identifier, slot->key.data.user.identifier_len);
+ } else if (slot->key.type == APC_CACHE_KEY_FPFILE) {
+ item->key = estrndup((char*)slot->key.data.fpfile.fullpath, slot->key.data.fpfile.fullpath_len);
+ item->key_len = slot->key.data.fpfile.fullpath_len;
++ item->filename_key = item->key;
+ } else {
-+ apc_eprint("Internal error, invalid entry type.");
++ apc_error("Internal error, invalid entry type." TSRMLS_CC);
+ }
+
+ ALLOC_INIT_ZVAL(item->value);
+ }
+ if (APC_ITER_DEVICE & iterator->format) {
+ if(slot->key.type == APC_CACHE_KEY_FILE) {
++#ifdef PHP_WIN32
++ char buf[20];
++ sprintf(buf, "%I64d", slot->key.data.file.device);
++ add_assoc_string(item->value, "device", buf, 1);
++#else
+ add_assoc_long(item->value, "device", slot->key.data.file.device);
++#endif
+ }
+ }
+ if (APC_ITER_INODE & iterator->format) {
+ if(slot->key.type == APC_CACHE_KEY_FILE) {
++#ifdef PHP_WIN32
++ char buf[20];
++ sprintf(buf, "%I64d", slot->key.data.file.device);
++ add_assoc_string(item->value, "device", buf, 1);
++#else
+ add_assoc_long(item->value, "inode", slot->key.data.file.inode);
++#endif
+ }
+ }
+ if (APC_ITER_KEY & iterator->format) {
-+ add_assoc_stringl(item->value, "key", item->key, item->key_len, 1);
++ add_assoc_stringl(item->value, "key", item->key, (item->key_len - 1), 1);
+ }
+ if (APC_ITER_VALUE & iterator->format) {
+ if(slot->value->type == APC_CACHE_ENTRY_USER) {
+
-+ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, NULL, NULL);
++ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, NULL, NULL TSRMLS_CC);
+ ctxt.copy = APC_COPY_OUT_USER;
+
+ MAKE_STD_ZVAL(zvalue);
-+ apc_cache_fetch_zval(zvalue, slot->value->data.user.val, &ctxt);
-+ apc_pool_destroy(ctxt.pool);
++ apc_cache_fetch_zval(zvalue, slot->value->data.user.val, &ctxt TSRMLS_CC);
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
+ add_assoc_zval(item->value, "value", zvalue);
+ }
+ }
+/* {{{ apc_iterator_clone */
+static zend_object_value apc_iterator_clone(zval *zobject TSRMLS_DC) {
+ zend_object_value value = {0};
-+ apc_eprint("APCIterator object cannot be cloned.");
++ apc_error("APCIterator object cannot be cloned." TSRMLS_CC);
+ return value;
+}
+/* }}} */
+#endif
+
+ if (iterator->search_hash) {
-+ rval = zend_hash_exists(iterator->search_hash, key, key_len+1);
++ rval = zend_hash_exists(iterator->search_hash, key, key_len);
+ if (!rval && fname_key) {
+ rval = zend_hash_exists(iterator->search_hash, fname_key, fname_key_len+1);
+ }
+/* }}} */
+
+/* {{{ apc_iterator_fetch_active */
-+static int apc_iterator_fetch_active(apc_iterator_t *iterator) {
++static int apc_iterator_fetch_active(apc_iterator_t *iterator TSRMLS_DC) {
+ int count=0;
+ slot_t **slot;
+ apc_iterator_item_t *item;
+ while(*slot) {
+ if (apc_iterator_search_match(iterator, slot)) {
+ count++;
-+ item = apc_iterator_item_ctor(iterator, slot);
++ item = apc_iterator_item_ctor(iterator, slot TSRMLS_CC);
+ if (item) {
-+ apc_stack_push(iterator->stack, item);
++ apc_stack_push(iterator->stack, item TSRMLS_CC);
+ }
+ }
+ slot = &(*slot)->next;
+/* }}} */
+
+/* {{{ apc_iterator_fetch_deleted */
-+static int apc_iterator_fetch_deleted(apc_iterator_t *iterator) {
++static int apc_iterator_fetch_deleted(apc_iterator_t *iterator TSRMLS_DC) {
+ int count=0;
+ slot_t **slot;
+ apc_iterator_item_t *item;
+ while ((*slot) && count < iterator->chunk_size) {
+ if (apc_iterator_search_match(iterator, slot)) {
+ count++;
-+ item = apc_iterator_item_ctor(iterator, slot);
++ item = apc_iterator_item_ctor(iterator, slot TSRMLS_CC);
+ if (item) {
-+ apc_stack_push(iterator->stack, item);
++ apc_stack_push(iterator->stack, item TSRMLS_CC);
+ }
+ }
+ slot = &(*slot)->next;
+/* }}} */
+
+/* {{{ apc_iterator_totals */
-+static void apc_iterator_totals(apc_iterator_t *iterator) {
++static void apc_iterator_totals(apc_iterator_t *iterator TSRMLS_DC) {
+ slot_t **slot;
+ int i;
+
+ return;
+ }
+
++ if (!APCG(enabled)) {
++ apc_error("APC must be enabled to use APCIterator." TSRMLS_CC);
++ }
++
+ if (chunk_size < 0) {
-+ apc_eprint("APCIterator chunk size must be greater than 0.");
++ apc_error("APCIterator chunk size must be 0 or greater." TSRMLS_CC);
+ return;
+ }
+
+ if (format > APC_ITER_ALL) {
-+ apc_eprint("APCIterator format is invalid.");
++ apc_error("APCIterator format is invalid." TSRMLS_CC);
+ return;
+ }
+
+ } else if (list == APC_LIST_DELETED) {
+ iterator->fetch = apc_iterator_fetch_deleted;
+ } else {
-+ apc_wprint("APCIterator invalid list type.");
++ apc_warning("APCIterator invalid list type." TSRMLS_CC);
+ return;
+ }
+
+ iterator->stack_idx = 0;
+ iterator->key_idx = 0;
+ iterator->chunk_size = chunk_size == 0 ? APC_DEFAULT_CHUNK_SIZE : chunk_size;
-+ iterator->stack = apc_stack_create(chunk_size);
++ iterator->stack = apc_stack_create(chunk_size TSRMLS_CC);
+ iterator->format = format;
+ iterator->totals_flag = 0;
+ iterator->count = 0;
+ iterator->re = pcre_get_compiled_regex(Z_STRVAL_P(search), NULL, NULL TSRMLS_CC);
+
+ if(!iterator->re) {
-+ apc_eprint("Could not compile regular expression: %s", Z_STRVAL_P(search));
++ apc_error("Could not compile regular expression: %s" TSRMLS_CC, Z_STRVAL_P(search));
+ }
+#else
-+ apc_eprint("Regular expressions support is not enabled, please enable PCRE for APCIterator regex support");
++ apc_error("Regular expressions support is not enabled, please enable PCRE for APCIterator regex support" TSRMLS_CC);
+#endif
+ } else if (search && Z_TYPE_P(search) == IS_ARRAY) {
+ Z_ADDREF_P(search);
+
+/* {{{ proto APCIterator::rewind() */
+PHP_METHOD(apc_iterator, rewind) {
-+ zval *object = getThis();
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
+
+ if (iterator->initialized == 0) {
+ RETURN_FALSE;
+ iterator->slot_idx = 0;
+ iterator->stack_idx = 0;
+ iterator->key_idx = 0;
-+ iterator->fetch(iterator);
++ iterator->fetch(iterator TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ proto boolean APCIterator::valid() */
+PHP_METHOD(apc_iterator, valid) {
-+ zval *object = getThis();
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
+
+ if (iterator->initialized == 0) {
+ RETURN_FALSE;
+ }
+
+ if (apc_stack_size(iterator->stack) == iterator->stack_idx) {
-+ iterator->fetch(iterator);
++ iterator->fetch(iterator TSRMLS_CC);
+ }
+
+ RETURN_BOOL(apc_stack_size(iterator->stack) == 0 ? 0 : 1);
+
+/* {{{ proto mixed APCIterator::current() */
+PHP_METHOD(apc_iterator, current) {
-+ zval *object = getThis();
+ apc_iterator_item_t *item;
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
++
+ if (iterator->initialized == 0) {
+ RETURN_FALSE;
+ }
++
+ if (apc_stack_size(iterator->stack) == iterator->stack_idx) {
-+ if (iterator->fetch(iterator) == 0) {
++ if (iterator->fetch(iterator TSRMLS_CC) == 0) {
+ RETURN_FALSE;
+ }
+ }
++
+ item = apc_stack_get(iterator->stack, iterator->stack_idx);
+ RETURN_ZVAL(item->value, 1, 0);
+}
+
+/* {{{ proto string APCIterator::key() */
+PHP_METHOD(apc_iterator, key) {
-+ zval *object = getThis();
+ apc_iterator_item_t *item;
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
++
+ if (iterator->initialized == 0 || apc_stack_size(iterator->stack) == 0) {
+ RETURN_FALSE;
+ }
++
+ if (apc_stack_size(iterator->stack) == iterator->stack_idx) {
-+ if (iterator->fetch(iterator) == 0) {
++ if (iterator->fetch(iterator TSRMLS_CC) == 0) {
+ RETURN_FALSE;
+ }
+ }
++
+ item = apc_stack_get(iterator->stack, iterator->stack_idx);
++
+ if (item->key) {
-+ RETURN_STRINGL(item->key, item->key_len, 1);
++ RETURN_STRINGL(item->key, (item->key_len-1), 1);
+ } else {
+ RETURN_LONG(iterator->key_idx);
+ }
+
+/* {{{ proto APCIterator::next() */
+PHP_METHOD(apc_iterator, next) {
-+ zval *object = getThis();
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
++
+ if (iterator->initialized == 0 || apc_stack_size(iterator->stack) == 0) {
+ RETURN_FALSE;
+ }
++
+ iterator->stack_idx++;
+ iterator->key_idx++;
++
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto long APCIterator::getTotalHits() */
+PHP_METHOD(apc_iterator, getTotalHits) {
-+ zval *object = getThis();
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
+
+ if (iterator->initialized == 0) {
+ RETURN_FALSE;
+ }
+
+ if (iterator->totals_flag == 0) {
-+ apc_iterator_totals(iterator);
++ apc_iterator_totals(iterator TSRMLS_CC);
+ }
+
+ RETURN_LONG(iterator->hits);
+}
+/* }}} */
+
-+/* {{{ proto long APCIterator:;getTotalSize() */
++/* {{{ proto long APCIterator::getTotalSize() */
+PHP_METHOD(apc_iterator, getTotalSize) {
-+ zval *object = getThis();
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
+
+ if (iterator->initialized == 0) {
+ RETURN_FALSE;
+ }
+
+ if (iterator->totals_flag == 0) {
-+ apc_iterator_totals(iterator);
++ apc_iterator_totals(iterator TSRMLS_CC);
+ }
+
+ RETURN_LONG(iterator->size);
+
+/* {{{ proto long APCIterator::getTotalCount() */
+PHP_METHOD(apc_iterator, getTotalCount) {
-+ zval *object = getThis();
-+ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(object TSRMLS_CC);
++ apc_iterator_t *iterator = (apc_iterator_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
++
++ if (zend_parse_parameters_none() == FAILURE) {
++ return;
++ }
+
+ if (iterator->initialized == 0) {
+ RETURN_FALSE;
+ }
+
+ if (iterator->totals_flag == 0) {
-+ apc_iterator_totals(iterator);
++ apc_iterator_totals(iterator TSRMLS_CC);
+ }
+
+ RETURN_LONG(iterator->count);
+}
+/* }}} */
+
++/* {{{ arginfo */
++#if (PHP_MAJOR_VERSION >= 6 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3))
++# define PHP_APC_ARGINFO
++#else
++# define PHP_APC_ARGINFO static
++#endif
++
++PHP_APC_ARGINFO
++ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_iterator___construct, 0, 0, 1)
++ ZEND_ARG_INFO(0, cache)
++ ZEND_ARG_INFO(0, search)
++ ZEND_ARG_INFO(0, format)
++ ZEND_ARG_INFO(0, chunk_size)
++ ZEND_ARG_INFO(0, list)
++ZEND_END_ARG_INFO()
++
++PHP_APC_ARGINFO
++ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_iterator_void, 0, 0, 0)
++ZEND_END_ARG_INFO()
++/* }}} */
++
+/* {{{ apc_iterator_functions */
-+static function_entry apc_iterator_functions[] = {
-+ PHP_ME(apc_iterator, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
-+ PHP_ME(apc_iterator, rewind, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, current, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, key, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, next, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, valid, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, getTotalHits, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, getTotalSize, NULL, ZEND_ACC_PUBLIC)
-+ PHP_ME(apc_iterator, getTotalCount, NULL, ZEND_ACC_PUBLIC)
++static zend_function_entry apc_iterator_functions[] = {
++ PHP_ME(apc_iterator, __construct, arginfo_apc_iterator___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
++ PHP_ME(apc_iterator, rewind, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, current, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, key, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, next, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, valid, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, getTotalHits, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, getTotalSize, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
++ PHP_ME(apc_iterator, getTotalCount, arginfo_apc_iterator_void, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}
+};
+/* }}} */
+ apc_iterator_item_t *item;
+
+ if (!ce || !instanceof_function(ce, apc_iterator_ce TSRMLS_CC)) {
-+ apc_eprint("apc_delete object argument must be instance of APCIterator");
++ apc_error("apc_delete object argument must be instance of APCIterator" TSRMLS_CC);
+ return 0;
+ }
+ iterator = (apc_iterator_t*)zend_object_store_get_object(zobj TSRMLS_CC);
+ return 0;
+ }
+
-+ while (iterator->fetch(iterator)) {
++ while (iterator->fetch(iterator TSRMLS_CC)) {
+ while (iterator->stack_idx < apc_stack_size(iterator->stack)) {
+ item = apc_stack_get(iterator->stack, iterator->stack_idx++);
+ if (iterator->cache == apc_cache) {
-+ apc_cache_delete(apc_cache, item->filename_key, strlen(item->filename_key)+1);
++ apc_cache_delete(apc_cache, item->filename_key, strlen(item->filename_key) + 1 TSRMLS_CC);
+ } else {
-+ apc_cache_user_delete(apc_user_cache, item->key, item->key_len+1);
++ apc_cache_user_delete(apc_user_cache, item->key, item->key_len TSRMLS_CC);
+ }
+ }
+ }
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_iterator.h php-5.3.1/ext/apc/apc_iterator.h
---- php-5.3.1.orig/ext/apc/apc_iterator.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_iterator.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_iterator.h
@@ -0,0 +1,117 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 277132 2009-03-14 01:50:57Z shire $ */
++/* $Id: apc_iterator.h 300979 2010-07-04 10:15:05Z kalle $ */
+
+#ifndef APC_ITERATOR_H
+#define APC_ITERATOR_H
+ zend_object obj; /* must always be first */
+ short int initialized; /* sanity check in case __construct failed */
+ long format; /* format bitmask of the return values ie: key, value, info */
-+ int (*fetch)(struct _apc_iterator_t *iterator);
++ int (*fetch)(struct _apc_iterator_t *iterator TSRMLS_DC);
+ /* fetch callback to fetch items from cache slots or lists */
+ apc_cache_t *cache; /* cache which we are iterating on */
+ long slot_idx; /* index to the slot array or linked list */
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_lock.h php-5.3.1/ext/apc/apc_lock.h
---- php-5.3.1.orig/ext/apc/apc_lock.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_lock.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,100 @@
+--- /dev/null
++++ b/ext/apc/apc_lock.h
+@@ -0,0 +1,101 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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_lock.h 268620 2008-11-09 02:30:49Z shire $ */
++/* $Id: apc_lock.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_LOCK
+#define APC_LOCK
+
++#include "apc.h"
+#include "apc_sem.h"
+#include "apc_fcntl.h"
+#include "apc_pthreadmutex.h"
+#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(NULL,(b),(c))
++#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)
-+#define apc_lck_nb_lock(a) apc_sem_nonblocking_lock(a)
-+#define apc_lck_rdlock(a) apc_sem_lock(a)
-+#define apc_lck_unlock(a) apc_sem_unlock(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)
+#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)
++#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)
-+#define apc_lck_nb_lock(a) apc_pthreadmutex_nonblocking_lock(&a)
-+#define apc_lck_rdlock(a) apc_pthreadmutex_lock(&a)
-+#define apc_lck_unlock(a) apc_pthreadmutex_unlock(&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)
+#elif defined(APC_SPIN_LOCKS)
+#define APC_LOCK_TYPE "spin Locks"
+#define RDLOCK_AVAILABLE 0
+#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)
++#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)
++#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 NONBLOCKING_LOCK_AVAILABLE 1
+#endif
+#define apc_lck_t int
-+#define apc_lck_create(a,b,c,d) d=apc_fcntl_create((a))
++#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)
-+#define apc_lck_nb_lock(a) apc_fcntl_nonblocking_lock(a)
-+#define apc_lck_rdlock(a) apc_fcntl_rdlock(a)
-+#define apc_lck_unlock(a) apc_fcntl_unlock(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)
+#endif
+
+#endif
-diff -Naur php-5.3.1.orig/ext/apc/apc_main.c php-5.3.1/ext/apc/apc_main.c
---- php-5.3.1.orig/ext/apc/apc_main.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_main.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,957 @@
+--- /dev/null
++++ b/ext/apc/apc_main.c
+@@ -0,0 +1,969 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 284282 2009-07-17 21:50:33Z shire $ */
++/* $Id: apc_main.c 304994 2010-10-30 20:33:46Z gopalv $ */
+
+#include "apc_php.h"
+#include "apc_main.h"
+#include "apc_stack.h"
+#include "apc_zend.h"
+#include "apc_pool.h"
++#include "apc_string.h"
+#include "SAPI.h"
+#include "php_scandir.h"
+#include "ext/standard/php_var.h"
+{
+ int status;
+
-+
++#if APC_HAVE_LOOKUP_HOOKS
+ if(lazy && fn.name[0] != '\0' && strncmp(fn.name, "__autoload", fn.name_len) != 0) {
+ status = zend_hash_add(APCG(lazy_function_table),
+ fn.name,
+ &fn,
+ sizeof(apc_function_t),
+ NULL);
++#else
++ if(0) {
++#endif
+ } else {
-+ zend_function *func = apc_copy_function_for_execution(fn.function, ctxt);
++ zend_function *func = apc_copy_function_for_execution(fn.function, ctxt TSRMLS_CC);
+ status = zend_hash_add(EG(function_table),
+ fn.name,
+ fn.name_len+1,
+ }
+
+ if (status == FAILURE) {
-+ /* apc_eprint("Cannot redeclare %s()", fn.name); */
++ /* apc_error("Cannot redeclare %s()" TSRMLS_CC, fn.name); */
+ }
+
+ return status;
+ apc_context_t ctxt = {0,};
+ TSRMLS_FETCH();
+
-+ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, apc_sma_protect, apc_sma_unprotect);
++ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
+ ctxt.copy = APC_COPY_OUT_OPCODE;
+
+ if(zend_hash_quick_find(APCG(lazy_function_table), name, len, hash, (void**)&fn) == SUCCESS) {
-+ *fe = apc_copy_function_for_execution(fn->function, &ctxt);
++ *fe = apc_copy_function_for_execution(fn->function, &ctxt TSRMLS_CC);
+ status = zend_hash_add(EG(function_table),
+ fn->name,
+ fn->name_len+1,
+ /*
+ * XXX: We need to free this somewhere...
+ */
-+ allocated_ce = apc_php_malloc(sizeof(zend_class_entry*));
++ allocated_ce = apc_php_malloc(sizeof(zend_class_entry*) TSRMLS_CC);
+
+ if(!allocated_ce) {
+ return FAILURE;
+
+ *allocated_ce =
+ class_entry =
-+ apc_copy_class_entry_for_execution(cl.class_entry, ctxt);
++ apc_copy_class_entry_for_execution(cl.class_entry, ctxt TSRMLS_CC);
+
+
+ /* restore parent class pointer for compile-time inheritance */
+ */
+ status = zend_lookup_class_ex(cl.parent_name,
+ strlen(cl.parent_name),
++#ifdef ZEND_ENGINE_2_4
++ NULL,
++#endif
+ 0,
+ &parent_ptr TSRMLS_CC);
+ if (status == FAILURE) {
+ if(APCG(report_autofilter)) {
-+ apc_wprint("Dynamic inheritance detected for class %s", cl.name);
++ apc_warning("Dynamic inheritance detected for class %s" TSRMLS_CC, cl.name);
+ }
+ class_entry->parent = NULL;
+ return status;
+ NULL);
+
+ if (status == FAILURE) {
-+ apc_eprint("Cannot redeclare class %s", cl.name);
++ apc_error("Cannot redeclare class %s" TSRMLS_CC, cl.name);
+ }
+ return status;
+}
+ return FAILURE;
+ }
+
-+ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, apc_sma_protect, apc_sma_unprotect);
++ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
+ ctxt.copy = APC_COPY_OUT_OPCODE;
+
+ if(install_class(*cl, &ctxt, 0 TSRMLS_CC) == FAILURE) {
-+ apc_wprint("apc_lookup_class_hook: could not install %s", name);
++ apc_warning("apc_lookup_class_hook: could not install %s" TSRMLS_CC, name);
+ return FAILURE;
+ }
+
+ if(zend_hash_quick_find(EG(class_table), name, len, hash, (void**)ce) == FAILURE) {
-+ apc_wprint("apc_lookup_class_hook: known error trying to fetch class %s", name);
++ apc_warning("apc_lookup_class_hook: known error trying to fetch class %s" TSRMLS_CC, name);
+ return FAILURE;
+ }
+
+ cl.name,
+ cl.name_len+1);
+ if (status == FAILURE) {
-+ apc_eprint("Cannot delete class %s", cl.name);
++ apc_error("Cannot delete class %s" TSRMLS_CC, cl.name);
+ }
+ return status;
+}
+/* {{{ apc_defined_function_hook */
+int apc_defined_function_hook(zval *internal, zval *user) {
+ TSRMLS_FETCH();
-+ zend_hash_apply_with_arguments(APCG(lazy_function_table) TSRMLS_CC, (apply_func_args_t) copy_function_name, 2, internal, user);
++ zend_hash_apply_with_arguments(APCG(lazy_function_table)
++#ifdef ZEND_ENGINE_2_3
++ TSRMLS_CC
++#endif
++ ,(apply_func_args_t) copy_function_name, 2, internal, user);
+ return 1;
+}
+/* }}} */
+/* {{{ apc_declared_class_hook */
+int apc_declared_class_hook(zval *classes, zend_uint mask, zend_uint comply) {
+ TSRMLS_FETCH();
-+ zend_hash_apply_with_arguments(APCG(lazy_class_table) TSRMLS_CC, (apply_func_args_t) copy_class_or_interface_name, 3, classes, mask, comply);
++ zend_hash_apply_with_arguments(APCG(lazy_class_table)
++#ifdef ZEND_ENGINE_2_3
++ TSRMLS_CC
++#endif
++ , (apply_func_args_t) copy_class_or_interface_name, 3, classes, mask, comply);
+ return 1;
+}
+/* }}} */
+
-+/* {{{ compare_file_handles */
-+static int compare_file_handles(void* a, void* b)
-+{
-+ zend_file_handle* fh1 = (zend_file_handle*)a;
-+ zend_file_handle* fh2 = (zend_file_handle*)b;
-+ return (fh1->type == fh2->type &&
-+ fh1->filename == fh2->filename &&
-+ fh1->opened_path == fh2->opened_path);
-+}
-+/* }}} */
-+
+/* {{{ cached_compile */
+static zend_op_array* cached_compile(zend_file_handle* h,
+ int type,
+ assert(cache_entry != NULL);
+
+ if (cache_entry->data.file.classes) {
++ int lazy_classes = APCG(lazy_classes);
+ for (i = 0; cache_entry->data.file.classes[i].class_entry != NULL; i++) {
-+ if(install_class(cache_entry->data.file.classes[i], ctxt, APCG(lazy_classes) TSRMLS_CC) == FAILURE) {
++ if(install_class(cache_entry->data.file.classes[i], ctxt, lazy_classes TSRMLS_CC) == FAILURE) {
+ goto default_compile;
+ }
+ }
+ }
+
+ if (cache_entry->data.file.functions) {
++ int lazy_functions = APCG(lazy_functions);
+ for (i = 0; cache_entry->data.file.functions[i].function != NULL; i++) {
-+ install_function(cache_entry->data.file.functions[i], ctxt, APCG(lazy_functions) TSRMLS_CC);
++ install_function(cache_entry->data.file.functions[i], ctxt, lazy_functions TSRMLS_CC);
+ }
+ }
+
+
+default_compile:
+
-+ if(APCG(report_autofilter)) {
-+ apc_wprint("Autofiltering %s", h->opened_path);
-+ }
-+
+ if(cache_entry->data.file.classes) {
+ for(ii = 0; ii < i ; ii++) {
+ uninstall_class(cache_entry->data.file.classes[ii] TSRMLS_CC);
+
+ apc_stack_pop(APCG(cache_stack)); /* pop out cache_entry */
+
-+ apc_cache_release(apc_cache, cache_entry);
++ apc_cache_release(apc_cache, cache_entry TSRMLS_CC);
+
+ /* cannot free up cache data yet, it maybe in use */
+
-+ zend_llist_del_element(&CG(open_files), h, compare_file_handles); /* We leak fds without this hack */
-+
-+ /* WARNING: zend_llist shallow copies - so element delete via the
-+ * zend_file_handle_dtor leaves h->opened_path dangling onto bad memory.
-+ */
-+
-+ h->opened_path = NULL;
-+ h->type = ZEND_HANDLE_FILENAME;
-+ if(h->free_filename) h->filename = NULL;
-+
+ return NULL;
+}
+/* }}} */
+ }
+
+ ctxt.pool = apc_pool_create(APC_MEDIUM_POOL, apc_sma_malloc, apc_sma_free,
-+ apc_sma_protect, apc_sma_unprotect);
++ apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
+ if (!ctxt.pool) {
-+ apc_wprint("Unable to allocate memory for pool.");
++ apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+ return FAILURE;
+ }
+ ctxt.copy = APC_COPY_IN_OPCODE;
+ PHP_MD5Final(key.md5, &context);
+ php_stream_close(stream);
+ if(n<0) {
-+ apc_wprint("Error while reading '%s' for md5 generation.", filename);
++ apc_warning("Error while reading '%s' for md5 generation." TSRMLS_CC, filename);
+ }
+ } else {
-+ apc_wprint("Unable to open '%s' for md5 generation.", filename);
++ apc_warning("Unable to open '%s' for md5 generation." TSRMLS_CC, filename);
+ }
+ }
+
+ path = h->opened_path;
+ if(!path) path=h->filename;
+
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"2. h->opened_path=[%s] h->filename=[%s]\n", h->opened_path?h->opened_path:"null",h->filename);
-+#endif
++ apc_debug("2. h->opened_path=[%s] h->filename=[%s]\n" TSRMLS_CC, h->opened_path?h->opened_path:"null",h->filename);
+
-+ if(!(*cache_entry = apc_cache_make_file_entry(path, alloc_op_array, alloc_functions, alloc_classes, &ctxt))) {
++ if(!(*cache_entry = apc_cache_make_file_entry(path, alloc_op_array, alloc_functions, alloc_classes, &ctxt TSRMLS_CC))) {
+ goto freepool;
+ }
+
+ return SUCCESS;
+
+freepool:
-+ apc_pool_destroy(ctxt.pool);
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
+ ctxt.pool = NULL;
+
+ return FAILURE;
+ time_t t;
+ apc_context_t ctxt = {0,};
+ int bailout=0;
++ const char* filename = NULL;
+
+ if (!APCG(enabled) || apc_cache_busy(apc_cache)) {
+ return old_compile_file(h, type TSRMLS_CC);
+ }
+
++ if(h->opened_path) {
++ filename = h->opened_path;
++ } else {
++ filename = h->filename;
++ }
++
+ /* check our regular expression filters */
-+ if (APCG(filters) && APCG(compiled_filters) && h->opened_path) {
-+ int ret = apc_regex_match_array(APCG(compiled_filters), h->opened_path);
++ if (APCG(filters) && APCG(compiled_filters) && filename) {
++ int ret = apc_regex_match_array(APCG(compiled_filters), filename);
+
+ if(ret == APC_NEGATIVE_MATCH || (ret != APC_POSITIVE_MATCH && !APCG(cache_by_default))) {
+ return old_compile_file(h, type TSRMLS_CC);
+
+ t = apc_time();
+
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"1. h->opened_path=[%s] h->filename=[%s]\n", h->opened_path?h->opened_path:"null",h->filename);
-+#endif
++ apc_debug("1. h->opened_path=[%s] h->filename=[%s]\n" TSRMLS_CC, h->opened_path?h->opened_path:"null",h->filename);
+
+ /* try to create a cache key; if we fail, give up on caching */
+ if (!apc_cache_make_file_key(&key, h->filename, PG(include_path), t TSRMLS_CC)) {
+ return old_compile_file(h, type TSRMLS_CC);
+ }
+
-+
+ if(!APCG(force_file_update)) {
+ /* search for the file in the cache */
-+ cache_entry = apc_cache_find(apc_cache, key, t);
++ cache_entry = apc_cache_find(apc_cache, key, t TSRMLS_CC);
+ ctxt.force_update = 0;
+ } else {
+ cache_entry = NULL;
+
+ if (cache_entry != NULL) {
+ int dummy = 1;
-+
++
+ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free,
-+ apc_sma_protect, apc_sma_unprotect);
++ apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
+ if (!ctxt.pool) {
-+ apc_wprint("Unable to allocate memory for pool.");
++ apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+ return old_compile_file(h, type TSRMLS_CC);
+ }
+ ctxt.copy = APC_COPY_OUT_OPCODE;
++
++ zend_hash_add(&EG(included_files), cache_entry->data.file.filename,
++ strlen(cache_entry->data.file.filename)+1,
++ (void *)&dummy, sizeof(int), NULL);
+
-+ if (h->opened_path == NULL) {
-+ h->opened_path = estrdup(cache_entry->data.file.filename);
-+ }
-+ zend_hash_add(&EG(included_files), h->opened_path, strlen(h->opened_path)+1, (void *)&dummy, sizeof(int), NULL);
-+
-+ zend_llist_add_element(&CG(open_files), h); /* We leak fds without this hack */
-+
-+ apc_stack_push(APCG(cache_stack), cache_entry);
++ apc_stack_push(APCG(cache_stack), cache_entry TSRMLS_CC);
+ op_array = cached_compile(h, type, &ctxt TSRMLS_CC);
++
+ if(op_array) {
+#ifdef APC_FILEHITS
+ /* If the file comes from the cache, add it to the global request file list */
+ add_next_index_string(APCG(filehits), h->filename, 1);
+#endif
+ /* this is an unpool, which has no cleanup - this only free's the pool header */
-+ apc_pool_destroy(ctxt.pool);
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
++
++ /* We might leak fds without this hack */
++ if (h->type != ZEND_HANDLE_FILENAME) {
++ zend_llist_add_element(&CG(open_files), h);
++ }
+ return op_array;
+ }
+ if(APCG(report_autofilter)) {
-+ apc_wprint("Recompiling %s", cache_entry->data.file.filename);
++ apc_warning("Autofiltering %s" TSRMLS_CC,
++ (h->opened_path ? h->opened_path : h->filename));
++ apc_warning("Recompiling %s" TSRMLS_CC, cache_entry->data.file.filename);
+ }
+ /* TODO: check what happens with EG(included_files) */
+ }
+
-+ /* Make sure the mtime reflects the files last known mtime in the case of fpstat==0 */
++ /* Make sure the mtime reflects the files last known mtime, and we respect max_file_size in the case of fpstat==0 */
+ if(key.type == APC_CACHE_KEY_FPFILE) {
+ apc_fileinfo_t fileinfo;
+ struct stat *tmp_buf = NULL;
+ if(tmp_buf) {
+ fileinfo.st_buf.sb = *tmp_buf;
+ } else {
-+ if (apc_search_paths(h->filename, PG(include_path), &fileinfo) != 0) {
-+#ifdef __DEBUG_APC__
-+ fprintf(stderr,"Stat failed %s - bailing (%s) (%d)\n",h->filename,SG(request_info).path_translated);
-+#endif
-+ return op_array;
++ if (apc_search_paths(h->filename, PG(include_path), &fileinfo TSRMLS_CC) != 0) {
++ apc_debug("Stat failed %s - bailing (%s) (%d)\n" TSRMLS_CC,h->filename,SG(request_info).path_translated);
++ return old_compile_file(h, type TSRMLS_CC);
+ }
+ }
++ if (APCG(max_file_size) < fileinfo.st_buf.sb.st_size) {
++ apc_debug("File is too big %s (%ld) - bailing\n" TSRMLS_CC, h->filename, fileinfo.st_buf.sb.st_size);
++ return old_compile_file(h, type TSRMLS_CC);
++ }
+ key.mtime = fileinfo.st_buf.sb.st_mtime;
+ }
+
+
+#if NONBLOCKING_LOCK_AVAILABLE
+ if(APCG(write_lock)) {
-+ if(!apc_cache_write_lock(apc_cache)) {
++ if(!apc_cache_write_lock(apc_cache TSRMLS_CC)) {
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return old_compile_file(h, type TSRMLS_CC);
+ }
+ 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) != 1) {
-+ apc_pool_destroy(ctxt.pool);
++ if (apc_cache_insert(apc_cache, key, cache_entry, &ctxt, t TSRMLS_CC) != 1) {
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
+ ctxt.pool = NULL;
+ }
+ }
+
+#if NONBLOCKING_LOCK_AVAILABLE
+ if(APCG(write_lock)) {
-+ apc_cache_write_unlock(apc_cache);
++ apc_cache_write_unlock(apc_cache TSRMLS_CC);
+ }
+#endif
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+
+extern int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int ttl, const int exclusive TSRMLS_DC);
+
-+static zval* data_unserialize(const char *filename)
++static zval* data_unserialize(const char *filename TSRMLS_DC)
+{
+ zval* retval;
+ long len = 0;
+ char *contents, *tmp;
+ FILE *fp;
+ php_unserialize_data_t var_hash;
-+ TSRMLS_FETCH();
+
+ if(VCWD_STAT(filename, &sb) == -1) {
+ return NULL;
+ p[0] = '\0';
+ key_len = strlen(key);
+
-+ data = data_unserialize(data_file);
++ data = data_unserialize(data_file TSRMLS_CC);
+ if(data) {
+ _apc_store(key, key_len, data, 0, 1 TSRMLS_CC);
+ }
+{
+ /* apc initialization */
+#if APC_MMAP
-+ apc_sma_init(APCG(shm_segments), APCG(shm_size)*1024*1024, APCG(mmap_file_mask));
++ apc_sma_init(APCG(shm_segments), APCG(shm_size), APCG(mmap_file_mask) TSRMLS_CC);
+#else
-+ apc_sma_init(APCG(shm_segments), APCG(shm_size)*1024*1024, NULL);
++ apc_sma_init(APCG(shm_segments), APCG(shm_size), NULL TSRMLS_CC);
+#endif
-+ apc_cache = apc_cache_create(APCG(num_files_hint), APCG(gc_ttl), APCG(ttl));
-+ apc_user_cache = apc_cache_create(APCG(user_entries_hint), APCG(gc_ttl), APCG(user_ttl));
++ apc_cache = apc_cache_create(APCG(num_files_hint), APCG(gc_ttl), APCG(ttl) TSRMLS_CC);
++ apc_user_cache = apc_cache_create(APCG(user_entries_hint), APCG(gc_ttl), APCG(user_ttl) TSRMLS_CC);
+
+ /* override compilation */
+ old_compile_file = zend_compile_file;
+ }
+#else
+ if(APCG(lazy_functions) || APCG(lazy_classes)) {
-+ apc_wprint("Lazy function/class loading not available with this version of PHP, please disable APC lazy loading.");
++ apc_warning("Lazy function/class loading not available with this version of PHP, please disable APC lazy loading." TSRMLS_CC);
+ APCG(lazy_functions) = APCG(lazy_classes) = 0;
+ }
+#endif
+
++#ifdef ZEND_ENGINE_2_4
++ apc_interned_strings_init(TSRMLS_C);
++#endif
++
+ APCG(initialized) = 1;
+ return 0;
+}
+ cache_entry->data.file.classes[i].name_len+1);
+ }
+ }
-+ apc_cache_release(apc_cache, cache_entry);
++ apc_cache_release(apc_cache, cache_entry TSRMLS_CC);
+ }
+
-+ apc_cache_destroy(apc_cache);
-+ apc_cache_destroy(apc_user_cache);
-+ apc_sma_cleanup();
++ 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
++ apc_interned_strings_shutdown(TSRMLS_C);
++#endif
+
+ APCG(initialized) = 0;
+ return 0;
+ cache_entry->data.file.classes[i].name,
+ cache_entry->data.file.classes[i].name_len+1);
+
-+ apc_free_class_entry_after_execution(zce);
++ apc_free_class_entry_after_execution(zce TSRMLS_CC);
+ }
+ }
-+ apc_cache_release(apc_cache, cache_entry);
++ apc_cache_release(apc_cache, cache_entry TSRMLS_CC);
+ }
+}
+/* }}} */
+ APCG(compiled_filters) = apc_regex_compile_array(APCG(filters) TSRMLS_CC);
+ }
+
++#if APC_HAVE_LOOKUP_HOOKS
+ if(APCG(lazy_functions)) {
+ APCG(lazy_function_table) = emalloc(sizeof(HashTable));
+ zend_hash_init(APCG(lazy_function_table), 0, NULL, NULL, 0);
+ APCG(lazy_class_table) = emalloc(sizeof(HashTable));
+ zend_hash_init(APCG(lazy_class_table), 0, NULL, NULL, 0);
+ }
++#endif
+
+#ifdef APC_FILEHITS
+ ALLOC_INIT_ZVAL(APCG(filehits));
+int apc_request_shutdown(TSRMLS_D)
+{
+
++#if APC_HAVE_LOOKUP_HOOKS
+ if(APCG(lazy_class_table)) {
+ zend_hash_destroy(APCG(lazy_class_table));
+ efree(APCG(lazy_class_table));
+ zend_hash_destroy(APCG(lazy_function_table));
+ efree(APCG(lazy_function_table));
+ }
++#endif
+
+ apc_deactivate(TSRMLS_C);
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_main.h php-5.3.1/ext/apc/apc_main.h
---- php-5.3.1.orig/ext/apc/apc_main.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_main.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_main.h
@@ -0,0 +1,74 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_main.h 300979 2010-07-04 10:15:05Z kalle $ */
+
+#ifndef APC_MAIN_H
+#define APC_MAIN_H
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_mmap.c php-5.3.1/ext/apc/apc_mmap.c
---- php-5.3.1.orig/ext/apc/apc_mmap.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_mmap.c 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_mmap.c
@@ -0,0 +1,175 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 287248 2009-08-13 15:13:52Z gopalv $ */
++/* $Id: apc_mmap.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "apc.h"
+#include "apc_mmap.h"
+# define MAP_ANON MAP_ANONYMOUS
+#endif
+
-+apc_segment_t apc_mmap(char *file_mask, size_t size)
++apc_segment_t apc_mmap(char *file_mask, size_t size TSRMLS_DC)
+{
+ apc_segment_t segment;
+
+ /* If no filename was provided, do an anonymous mmap */
+ if(!file_mask || (file_mask && !strlen(file_mask))) {
+#if !defined(MAP_ANON)
-+ apc_eprint("Anonymous mmap does not apear to be available on this system (MAP_ANON/MAP_ANONYMOUS). Please see the apc.mmap_file_mask INI option.");
++ apc_error("Anonymous mmap does not apear to be available on this system (MAP_ANON/MAP_ANONYMOUS). Please see the apc.mmap_file_mask INI option." TSRMLS_CC);
+#else
+ fd = -1;
+ flags = MAP_SHARED | MAP_ANON;
+ } else if(!strcmp(file_mask,"/dev/zero")) {
+ fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR);
+ if(fd == -1) {
-+ apc_eprint("apc_mmap: open on /dev/zero failed:");
++ apc_error("apc_mmap: open on /dev/zero failed:" TSRMLS_CC);
+ goto error;
+ }
+ remap = 0; /* cannot remap */
+ * path you want here.
+ */
+ if(!mktemp(file_mask)) {
-+ apc_eprint("apc_mmap: mktemp on %s failed:", file_mask);
++ apc_error("apc_mmap: mktemp on %s failed:" TSRMLS_CC, file_mask);
+ goto error;
+ }
+ fd = shm_open(file_mask, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
+ if(fd == -1) {
-+ apc_eprint("apc_mmap: shm_open on %s failed:", file_mask);
++ apc_error("apc_mmap: shm_open on %s failed:" TSRMLS_CC, file_mask);
+ goto error;
+ }
+ if (ftruncate(fd, size) < 0) {
+ close(fd);
+ shm_unlink(file_mask);
-+ apc_eprint("apc_mmap: ftruncate failed:");
++ apc_error("apc_mmap: ftruncate failed:" TSRMLS_CC);
+ goto error;
+ }
+ shm_unlink(file_mask);
+ */
+ fd = mkstemp(file_mask);
+ if(fd == -1) {
-+ apc_eprint("apc_mmap: mkstemp on %s failed:", file_mask);
++ apc_error("apc_mmap: mkstemp on %s failed:" TSRMLS_CC, file_mask);
+ goto error;
+ }
+ if (ftruncate(fd, size) < 0) {
+ close(fd);
+ unlink(file_mask);
-+ apc_eprint("apc_mmap: ftruncate failed:");
++ apc_error("apc_mmap: ftruncate failed:" TSRMLS_CC);
+ goto error;
+ }
+ unlink(file_mask);
+#endif
+
+ if((long)segment.shmaddr == -1) {
-+ apc_eprint("apc_mmap: mmap failed:");
++ apc_error("apc_mmap: mmap failed:" TSRMLS_CC);
+ }
+
+ if(fd != -1) close(fd);
+ return segment;
+}
+
-+void apc_unmap(apc_segment_t *segment)
++void apc_unmap(apc_segment_t *segment TSRMLS_DC)
+{
+ if (munmap(segment->shmaddr, segment->size) < 0) {
-+ apc_wprint("apc_unmap: munmap failed:");
++ apc_warning("apc_unmap: munmap failed:" TSRMLS_CC);
+ }
+
+#ifdef APC_MEMPROTECT
+ if (segment->roaddr && munmap(segment->roaddr, segment->size) < 0) {
-+ apc_wprint("apc_unmap: munmap failed:");
++ apc_warning("apc_unmap: munmap failed:" TSRMLS_CC);
+ }
+#endif
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_mmap.h php-5.3.1/ext/apc/apc_mmap.h
---- php-5.3.1.orig/ext/apc/apc_mmap.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_mmap.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_mmap.h
@@ -0,0 +1,54 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2009 The PHP Group |
++ | Copyright (c) 2006-2010 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: Gopal V <gopalv@php.net>
++ | Authors: Gopal V <gopalv@php.net> |
+ +----------------------------------------------------------------------+
+
+ This software was contributed to PHP by Community Connect Inc. in 2002
+
+ */
+
-+/* $Id: apc_mmap.h 273456 2009-01-13 14:43:58Z gopalv $ */
++/* $Id: apc_mmap.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_MMAP_H
+#define APC_MMAP_H
+/* Wrapper functions for shared memory mapped files */
+
+#if APC_MMAP
-+apc_segment_t apc_mmap(char *file_mask, size_t size);
-+void apc_unmap(apc_segment_t* segment);
++apc_segment_t apc_mmap(char *file_mask, size_t size TSRMLS_DC);
++void apc_unmap(apc_segment_t* segment TSRMLS_DC);
+#endif
+
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc.php php-5.3.1/ext/apc/apc.php
---- php-5.3.1.orig/ext/apc/apc.php 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc.php 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc.php
@@ -0,0 +1,1362 @@
+<?php
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 271315 2008-12-16 07:15:07Z shire $';
++$VERSION='$Id: apc.php 304410 2010-10-15 11:21:07Z gopalv $';
+
+////////// READ OPTIONAL CONFIGURATION FILE ////////////
+if (file_exists("apc.conf.php")) include("apc.conf.php");
+$time = time();
+$host = php_uname('n');
+if($host) { $host = '('.$host.')'; }
-+if ($_SERVER['SERVER_ADDR']) {
++if (isset($_SERVER['SERVER_ADDR'])) {
+ $host .= ' ('.$_SERVER['SERVER_ADDR'].')';
+}
+
+
+if ($AUTHENTICATED) {
+ echo <<<EOB
-+ <li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascipt:return confirm('Are you sure?');">Clear $cache_mode Cache</a></li>
++ <li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascript:return confirm('Are you sure?');">Clear $cache_mode Cache</a></li>
+EOB;
+}
+echo <<<EOB
+ echo
+ "<tr class=tr-$m>",
+ "<td class=td-0>",ucwords(preg_replace("/_/"," ",$k)),"</td>",
-+ "<td class=td-last>",(preg_match("/time/",$k) && $value!='None') ? date(DATE_FORMAT,$value) : $value,"</td>",
++ "<td class=td-last>",(preg_match("/time/",$k) && $value!='None') ? date(DATE_FORMAT,$value) : htmlspecialchars($value, ENT_QUOTES, 'UTF-8'),"</td>",
+ "</tr>";
+ $m=1-$m;
+ }
+ if($fieldkey=='info') {
+ echo "<tr class=tr-$m><td class=td-0>Stored Value</td><td class=td-last><pre>";
+ $output = var_export(apc_fetch($entry[$fieldkey]),true);
-+ echo htmlspecialchars($output);
++ echo htmlspecialchars($output, ENT_QUOTES, 'UTF-8');
+ echo "</pre></td></tr>\n";
+ }
+ break;
+ } else if (!$i--) {
+ break;
+ }
-+ echo "<b><a href=\"http://pecl.php.net/package/APC/$ver\">".htmlspecialchars($v)."</a></b><br><blockquote>";
-+ echo nl2br(htmlspecialchars(current($match[2])))."</blockquote>";
++ echo "<b><a href=\"http://pecl.php.net/package/APC/$ver\">".htmlspecialchars($v, ENT_QUOTES, 'UTF-8')."</a></b><br><blockquote>";
++ echo nl2br(htmlspecialchars(current($match[2]), ENT_QUOTES, 'UTF-8'))."</blockquote>";
+ next($match[2]);
+ }
+ echo '</td></tr>';
+<!-- <?php echo "\nBased on APCGUI By R.Becker\n$VERSION\n"?> -->
+</body>
+</html>
-diff -Naur php-5.3.1.orig/ext/apc/apc_php.h php-5.3.1/ext/apc/apc_php.h
---- php-5.3.1.orig/ext/apc/apc_php.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_php.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,74 @@
+--- /dev/null
++++ b/ext/apc/apc_php.h
+@@ -0,0 +1,77 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_php.h 300979 2010-07-04 10:15:05Z kalle $ */
+
+#ifndef APC_PHP_H
+#define APC_PHP_H
+#include "zend_hash.h"
+#include "zend_extensions.h"
+
++#if ZEND_MODULE_API_NO >= 20100409
++#define ZEND_ENGINE_2_4
++#endif
+#if ZEND_MODULE_API_NO > 20060613
+#define ZEND_ENGINE_2_3
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_pool.c php-5.3.1/ext/apc/apc_pool.c
---- php-5.3.1.orig/ext/apc/apc_pool.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_pool.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,484 @@
+--- /dev/null
++++ b/ext/apc/apc_php_pcre.h
+@@ -0,0 +1,98 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC/PHP Version 5 |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 1997-2010 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. |
++ +----------------------------------------------------------------------+
++ | Author: Andrei Zmievski <andrei@php.net> |
++ +----------------------------------------------------------------------+
++ */
++
++/* $Id: apc_php_pcre.h 300979 2010-07-04 10:15:05Z kalle $ */
++
++#ifndef PHP_PCRE_H
++#define PHP_PCRE_H
++
++#if HAVE_PCRE || HAVE_BUNDLED_PCRE
++
++#if HAVE_BUNDLED_PCRE
++#include "ext/pcre/pcrelib/pcre.h"
++#else
++#include "pcre.h"
++#endif
++
++#if HAVE_LOCALE_H
++#include <locale.h>
++#endif
++
++PHP_FUNCTION(preg_match);
++PHP_FUNCTION(preg_match_all);
++PHP_FUNCTION(preg_replace);
++PHP_FUNCTION(preg_replace_callback);
++PHP_FUNCTION(preg_split);
++PHP_FUNCTION(preg_quote);
++PHP_FUNCTION(preg_grep);
++
++PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
++PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
++PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC);
++
++extern zend_module_entry pcre_module_entry;
++#define pcre_module_ptr &pcre_module_entry
++
++typedef struct {
++ pcre *re;
++ pcre_extra *extra;
++ int preg_options;
++#if HAVE_SETLOCALE
++ char *locale;
++ unsigned const char *tables;
++#endif
++ int compile_options;
++ int refcount;
++} pcre_cache_entry;
++
++PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC);
++
++PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
++ zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC);
++
++PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
++ int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
++
++PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
++ long limit_val, long flags TSRMLS_DC);
++
++PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value,
++ long flags TSRMLS_DC);
++
++ZEND_BEGIN_MODULE_GLOBALS(pcre)
++ HashTable pcre_cache;
++ long backtrack_limit;
++ long recursion_limit;
++ int error_code;
++ZEND_END_MODULE_GLOBALS(pcre)
++
++#ifdef ZTS
++# define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v)
++#else
++# define PCRE_G(v) (pcre_globals.v)
++#endif
++
++#else
++
++#define pcre_module_ptr NULL
++
++#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
++
++#define phpext_pcre_ptr pcre_module_ptr
++
++#endif /* PHP_PCRE_H */
+--- /dev/null
++++ b/ext/apc/apc_pool.c
+@@ -0,0 +1,488 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 281353 2009-05-28 23:45:08Z kalle $ */
++/* $Id: apc_pool.c 301964 2010-08-07 03:34:18Z rasmus $ */
+
+
+#include "apc_pool.h"
+
+
+/* {{{ forward references */
-+static apc_pool* apc_unpool_create(apc_pool_type type, apc_malloc_t, apc_free_t, apc_protect_t, apc_unprotect_t);
-+static apc_pool* apc_realpool_create(apc_pool_type type, apc_malloc_t, apc_free_t, apc_protect_t, apc_unprotect_t);
++static apc_pool* apc_unpool_create(apc_pool_type type, apc_malloc_t, apc_free_t, apc_protect_t, apc_unprotect_t TSRMLS_DC);
++static apc_pool* apc_realpool_create(apc_pool_type type, apc_malloc_t, apc_free_t, apc_protect_t, apc_unprotect_t TSRMLS_DC);
+/* }}} */
+
+/* {{{ apc_pool_create */
+ apc_malloc_t allocate,
+ apc_free_t deallocate,
+ apc_protect_t protect,
-+ apc_unprotect_t unprotect)
++ apc_unprotect_t unprotect
++ TSRMLS_DC)
+{
+ if(pool_type == APC_UNPOOL) {
+ return apc_unpool_create(pool_type, allocate, deallocate,
-+ protect, unprotect );
++ protect, unprotect TSRMLS_CC);
+ }
+
+ return apc_realpool_create(pool_type, allocate, deallocate,
-+ protect, unprotect );
++ protect, unprotect TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ apc_pool_destroy */
-+void apc_pool_destroy(apc_pool *pool)
++void apc_pool_destroy(apc_pool *pool TSRMLS_DC)
+{
+ apc_free_t deallocate = pool->deallocate;
+ apc_pcleanup_t cleanup = pool->cleanup;
+
-+ cleanup(pool);
-+ deallocate(pool);
++ cleanup(pool TSRMLS_CC);
++ deallocate(pool TSRMLS_CC);
+}
+/* }}} */
+
+ /* apc_unpool is a lie! */
+};
+
-+static void* apc_unpool_alloc(apc_pool* pool, size_t size)
++static void* apc_unpool_alloc(apc_pool* pool, size_t size TSRMLS_DC)
+{
+ apc_unpool *upool = (apc_unpool*)pool;
+
+ upool->parent.size += size;
+ upool->parent.used += size;
+
-+ return allocate(size);
++ return allocate(size TSRMLS_CC);
+}
+
-+static void apc_unpool_free(apc_pool* pool, void *ptr)
++static void apc_unpool_free(apc_pool* pool, void *ptr TSRMLS_DC)
+{
+ apc_unpool *upool = (apc_unpool*) pool;
+
+ apc_free_t deallocate = upool->parent.deallocate;
+
-+ deallocate(ptr);
++ deallocate(ptr TSRMLS_CC);
+}
+
-+static void apc_unpool_cleanup(apc_pool* pool)
++static void apc_unpool_cleanup(apc_pool* pool TSRMLS_DC)
+{
+}
+
+static apc_pool* apc_unpool_create(apc_pool_type type,
+ apc_malloc_t allocate, apc_free_t deallocate,
-+ apc_protect_t protect, apc_unprotect_t unprotect)
++ apc_protect_t protect, apc_unprotect_t unprotect
++ TSRMLS_DC)
+{
-+ apc_unpool* upool = allocate(sizeof(apc_unpool));
++ apc_unpool* upool = allocate(sizeof(apc_unpool) TSRMLS_CC);
+
+ if (!upool) {
+ return NULL;
+} while(0)
+
+/* {{{ create_pool_block */
-+static pool_block* create_pool_block(apc_realpool *rpool, size_t size)
++static pool_block* create_pool_block(apc_realpool *rpool, size_t size TSRMLS_DC)
+{
+ apc_malloc_t allocate = rpool->parent.allocate;
+
+ size_t realsize = sizeof(pool_block) + ALIGNWORD(size);
+
-+ pool_block* entry = allocate(realsize);
++ pool_block* entry = allocate(realsize TSRMLS_CC);
+
+ if (!entry) {
+ return NULL;
+/* }}} */
+
+/* {{{ apc_realpool_alloc */
-+static void* apc_realpool_alloc(apc_pool *pool, size_t size)
++static void* apc_realpool_alloc(apc_pool *pool, size_t size TSRMLS_DC)
+{
+ apc_realpool *rpool = (apc_realpool*)pool;
+ unsigned char *p = NULL;
+ unsigned char *redzone = NULL;
+ size_t redsize = 0;
+ size_t *sizeinfo= NULL;
-+
-+ pool_block *entry;
-+
++ pool_block *entry = NULL;
++
+ if(APC_POOL_HAS_REDZONES(pool)) {
+ redsize = REDZONE_SIZE(size); /* redsize might be re-using word size padding */
+ realsize = size + redsize; /* recalculating realsize */
+
+ poolsize = ALIGNSIZE(realsize, rpool->dsize);
+
-+ entry = create_pool_block(rpool, poolsize);
++ entry = create_pool_block(rpool, poolsize TSRMLS_CC);
+
+ if(!entry) {
+ return NULL;
+}
+/* }}} */
+
-+/* {{{ apc_pool_free */
++/* {{{ apc_realpool_free */
+/*
+ * free does not do anything other than
+ * check for redzone values when free'ing
+ * data areas.
+ */
-+static void apc_realpool_free(apc_pool *pool, void *p)
++static void apc_realpool_free(apc_pool *pool, void *p TSRMLS_DC)
+{
+}
+/* }}} */
+
-+static void apc_realpool_cleanup(apc_pool *pool)
++static void apc_realpool_cleanup(apc_pool *pool TSRMLS_DC)
+{
+ pool_block *entry;
+ pool_block *tmp;
+
+ while(entry->next != NULL) {
+ tmp = entry->next;
-+ deallocate(entry);
++ deallocate(entry TSRMLS_CC);
+ entry = tmp;
+ }
+}
+
+/* {{{ apc_realpool_create */
+static apc_pool* apc_realpool_create(apc_pool_type type, apc_malloc_t allocate, apc_free_t deallocate,
-+ apc_protect_t protect, apc_unprotect_t unprotect)
++ apc_protect_t protect, apc_unprotect_t unprotect
++ TSRMLS_DC)
+{
+
+ size_t dsize = 0;
+ return NULL;
+ }
+
-+ rpool = (apc_realpool*)allocate(sizeof(apc_realpool) + ALIGNWORD(dsize));
++ rpool = (apc_realpool*)allocate((sizeof(apc_realpool) + ALIGNWORD(dsize)) TSRMLS_CC);
+
+ if(!rpool) {
+ return NULL;
+ /* put all ye sanity checks here */
+ assert(sizeof(decaff) > REDZONE_SIZE(ALIGNWORD(sizeof(char))));
+ assert(sizeof(pool_block) == ALIGNWORD(sizeof(pool_block)));
++#if APC_POOL_DEBUG
+ assert((APC_POOL_SIZE_MASK & (APC_POOL_SIZEINFO | APC_POOL_REDZONES)) == 0);
++#endif
+}
+/* }}} */
+
+/* {{{ apc_pstrdup */
-+void* apc_pstrdup(const char* s, apc_pool* pool)
++void* apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC)
+{
-+ return s != NULL ? apc_pmemcpy(s, strlen(s)+1, pool) : NULL;
++ 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)
++void* 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
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_pool.h php-5.3.1/ext/apc/apc_pool.h
---- php-5.3.1.orig/ext/apc/apc_pool.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_pool.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,102 @@
+--- /dev/null
++++ b/ext/apc/apc_pool.h
+@@ -0,0 +1,114 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 275212 2009-02-05 08:36:26Z gopalv $ */
++/* $Id: apc_pool.h 301682 2010-07-29 11:09:00Z gopalv $ */
+
+#ifndef APC_POOL_H
+#define APC_POOL_H
+#include "apc.h"
+#include "apc_sma.h"
+
++/* #define APC_POOL_DEBUG 1 */
++
+typedef enum {
+ APC_UNPOOL = 0x0,
+ APC_SMALL_POOL = 0x1,
+ APC_MEDIUM_POOL = 0x2,
+ APC_LARGE_POOL = 0x3,
+ APC_POOL_SIZE_MASK = 0x7, /* waste a bit */
++#if APC_POOL_DEBUG
+ APC_POOL_REDZONES = 0x08,
+ APC_POOL_SIZEINFO = 0x10,
+ APC_POOL_OPT_MASK = 0x18
++#endif
+} apc_pool_type;
+
++#if APC_POOL_DEBUG
+#define APC_POOL_HAS_SIZEINFO(pool) ((pool->type & APC_POOL_SIZEINFO)!=0)
+#define APC_POOL_HAS_REDZONES(pool) ((pool->type & APC_POOL_REDZONES)!=0)
++#else
++/* let gcc optimize away the optional features */
++#define APC_POOL_HAS_SIZEINFO(pool) (0)
++#define APC_POOL_HAS_REDZONES(pool) (0)
++#endif
++
+
+typedef struct _apc_pool apc_pool;
+
-+typedef void (*apc_pcleanup_t)(apc_pool *pool);
++typedef void (*apc_pcleanup_t)(apc_pool *pool TSRMLS_DC);
+
-+typedef void* (*apc_palloc_t)(apc_pool *pool, size_t size);
-+typedef void (*apc_pfree_t) (apc_pool *pool, void* p);
++typedef void* (*apc_palloc_t)(apc_pool *pool, size_t size TSRMLS_DC);
++typedef void (*apc_pfree_t) (apc_pool *pool, void* p TSRMLS_DC);
+
+typedef void* (*apc_protect_t) (void *p);
+typedef void* (*apc_unprotect_t)(void *p);
+ /* apc_realpool and apc_unpool add more here */
+};
+
-+#define apc_pool_alloc(pool, size) ((pool)->palloc((pool), (size)))
-+#define apc_pool_free (pool, ptr) ((pool)->pfree((pool), (ptr)))
++#define apc_pool_alloc(pool, size) ((void *) pool->palloc(pool, size TSRMLS_CC))
++#define apc_pool_free(pool, ptr) ((void) pool->pfree (pool, ptr TSRMLS_CC))
+
-+#define apc_pool_protect (pool, ptr) (pool->protect ? \
++#define apc_pool_protect(pool, ptr) (pool->protect ? \
+ (pool)->protect((ptr)) : (ptr))
+
-+#define apc_pool_unprotect (pool, ptr) (pool->unprotect ? \
++#define apc_pool_unprotect(pool, ptr) (pool->unprotect ? \
+ (pool)->unprotect((ptr)) : (ptr))
+
+extern void apc_pool_init();
+ apc_malloc_t allocate,
+ apc_free_t deallocate,
+ apc_protect_t protect,
-+ apc_unprotect_t unprotect);
++ apc_unprotect_t unprotect
++ TSRMLS_DC);
+
-+extern void apc_pool_destroy(apc_pool* pool);
++extern void apc_pool_destroy(apc_pool* pool TSRMLS_DC);
+
-+extern void* apc_pmemcpy(const void* p, size_t n, apc_pool* pool);
-+extern void* apc_pstrdup(const char* s, apc_pool* pool);
++extern void* apc_pmemcpy(const void* p, size_t n, apc_pool* pool TSRMLS_DC);
++extern void* apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC);
+
+#endif
-diff -Naur php-5.3.1.orig/ext/apc/apc_pthreadmutex.c php-5.3.1/ext/apc/apc_pthreadmutex.c
---- php-5.3.1.orig/ext/apc/apc_pthreadmutex.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_pthreadmutex.c 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_pthreadmutex.c
@@ -0,0 +1,111 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_pthreadmutex.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "apc_pthreadmutex.h"
+
+#ifdef APC_PTHREADMUTEX_LOCKS
+
-+pthread_mutex_t *apc_pthreadmutex_create(pthread_mutex_t *lock)
++pthread_mutex_t *apc_pthreadmutex_create(pthread_mutex_t *lock TSRMLS_DC)
+{
+ int result;
+ pthread_mutexattr_t* attr;
+
+ result = pthread_mutexattr_init(attr);
+ if(result == ENOMEM) {
-+ apc_eprint("pthread mutex error: Insufficient memory exists to create the mutex attribute object.");
++ apc_error("pthread mutex error: Insufficient memory exists to create the mutex attribute object." TSRMLS_CC);
+ } else if(result == EINVAL) {
-+ apc_eprint("pthread mutex error: attr does not point to writeable memory.");
++ apc_error("pthread mutex error: attr does not point to writeable memory." TSRMLS_CC);
+ } else if(result == EFAULT) {
-+ apc_eprint("pthread mutex error: attr is an invalid pointer.");
++ apc_error("pthread mutex error: attr is an invalid pointer." TSRMLS_CC);
+ }
+
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ result = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+ if (result == EINVAL) {
-+ apc_eprint("pthread_mutexattr_settype: unable to set adaptive mutexes");
++ apc_error("pthread_mutexattr_settype: unable to set adaptive mutexes" TSRMLS_CC);
+ }
+#endif
+
+ /* pthread_mutexattr_settype(attr, PTHREAD_MUTEX_ERRORCHECK); */
+ result = pthread_mutexattr_setpshared(attr, PTHREAD_PROCESS_SHARED);
+ if(result == EINVAL) {
-+ apc_eprint("pthread mutex error: attr is not an initialized mutex attribute object, or pshared is not a valid process-shared state setting.");
++ apc_error("pthread mutex error: attr is not an initialized mutex attribute object, or pshared is not a valid process-shared state setting." TSRMLS_CC);
+ } else if(result == EFAULT) {
-+ apc_eprint("pthread mutex error: attr is an invalid pointer.");
++ apc_error("pthread mutex error: attr is an invalid pointer." TSRMLS_CC);
+ } else if(result == ENOTSUP) {
-+ apc_eprint("pthread mutex error: pshared was set to PTHREAD_PROCESS_SHARED.");
++ apc_error("pthread mutex error: pshared was set to PTHREAD_PROCESS_SHARED." TSRMLS_CC);
+ }
+
+ if(pthread_mutex_init(lock, attr)) {
-+ apc_eprint("unable to initialize pthread lock");
++ apc_error("unable to initialize pthread lock" TSRMLS_CC);
+ }
+ return lock;
+}
+ return; /* we don't actually destroy the mutex, as it would destroy it for all processes */
+}
+
-+void apc_pthreadmutex_lock(pthread_mutex_t *lock)
++void apc_pthreadmutex_lock(pthread_mutex_t *lock TSRMLS_DC)
+{
+ int result;
+ result = pthread_mutex_lock(lock);
+ if(result == EINVAL) {
-+ apc_eprint("unable to obtain pthread lock (EINVAL)");
++ apc_error("unable to obtain pthread lock (EINVAL)" TSRMLS_CC);
+ } else if(result == EDEADLK) {
-+ apc_eprint("unable to obtain pthread lock (EDEADLK)");
++ apc_error("unable to obtain pthread lock (EDEADLK)" TSRMLS_CC);
+ }
+}
+
-+void apc_pthreadmutex_unlock(pthread_mutex_t *lock)
++void apc_pthreadmutex_unlock(pthread_mutex_t *lock TSRMLS_DC)
+{
+ if(pthread_mutex_unlock(lock)) {
-+ apc_eprint("unable to unlock pthread lock");
++ apc_error("unable to unlock pthread lock" TSRMLS_CC);
+ }
+}
+
-+zend_bool apc_pthreadmutex_nonblocking_lock(pthread_mutex_t *lock)
++zend_bool apc_pthreadmutex_nonblocking_lock(pthread_mutex_t *lock TSRMLS_DC)
+{
+ int rval;
+ rval = pthread_mutex_trylock(lock);
+ } else if(rval == 0) { /* Obtained lock */
+ return 1;
+ } else { /* Other error */
-+ apc_eprint("unable to obtain pthread trylock");
++ apc_error("unable to obtain pthread trylock" TSRMLS_CC);
+ return 0;
+ }
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_pthreadmutex.h php-5.3.1/ext/apc/apc_pthreadmutex.h
---- php-5.3.1.orig/ext/apc/apc_pthreadmutex.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_pthreadmutex.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_pthreadmutex.h
@@ -0,0 +1,48 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_pthreadmutex.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_PTHREADMUTEX_H
+#define APC_PTHREADMUTEX_H
+
+#include <pthread.h>
+
-+pthread_mutex_t *apc_pthreadmutex_create();
++pthread_mutex_t *apc_pthreadmutex_create(pthread_mutex_t *lock TSRMLS_DC);
+void apc_pthreadmutex_destroy(pthread_mutex_t *lock);
-+void apc_pthreadmutex_lock(pthread_mutex_t *lock);
-+void apc_pthreadmutex_unlock(pthread_mutex_t *lock);
-+zend_bool apc_pthreadmutex_nonblocking_lock(pthread_mutex_t *lock);
++void apc_pthreadmutex_lock(pthread_mutex_t *lock TSRMLS_DC);
++void apc_pthreadmutex_unlock(pthread_mutex_t *lock TSRMLS_DC);
++zend_bool apc_pthreadmutex_nonblocking_lock(pthread_mutex_t *lock TSRMLS_DC);
+
+#endif
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_rfc1867.c php-5.3.1/ext/apc/apc_rfc1867.c
---- php-5.3.1.orig/ext/apc/apc_rfc1867.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_rfc1867.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,214 @@
+--- /dev/null
++++ b/ext/apc/apc_rfc1867.c
+@@ -0,0 +1,232 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 284580 2009-07-22 06:05:31Z kalle $*/
++/* $Id: apc_rfc1867.c 305798 2010-11-28 13:43:20Z gopalv $*/
+
+#include "apc.h"
+#include "apc_globals.h"
+ RFC1867_DATA(key_length) = 0;
+ RFC1867_DATA(start_time) = my_time();
+ RFC1867_DATA(bytes_processed) = 0;
++ RFC1867_DATA(prev_bytes_processed) = 0;
+ RFC1867_DATA(rate) = 0;
+ RFC1867_DATA(update_freq) = (int) APCG(rfc1867_freq);
++ RFC1867_DATA(started) = 0;
+
+ if(RFC1867_DATA(update_freq) < 0) { // frequency is a percentage, not bytes
+ RFC1867_DATA(update_freq) = (int) (RFC1867_DATA(content_length) * APCG(rfc1867_freq) / 100);
+ int prefix_len = strlen(APCG(rfc1867_prefix));
+ multipart_event_formdata *data = (multipart_event_formdata *) event_data;
+ if(data->name && !strncasecmp(data->name, APCG(rfc1867_name), strlen(APCG(rfc1867_name)))
-+ && data->value && data->length && data->length < sizeof(RFC1867_DATA(tracking_key)) - prefix_len) {
++ && data->value && data->length) {
++
++ if(data->length >= sizeof(RFC1867_DATA(tracking_key)) - prefix_len) {
++ apc_warning("Key too long for '%s'. Maximum size is '%d' characters." TSRMLS_CC,
++ APCG(rfc1867_name),
++ sizeof(RFC1867_DATA(tracking_key)) - prefix_len);
++ break;
++ }
++
++ if(RFC1867_DATA(started)) {
++ apc_warning("Upload progress key '%s' should be before the file upload entry in the form." TSRMLS_CC,
++ APCG(rfc1867_name));
++ break;
++ }
+
+ strlcat(RFC1867_DATA(tracking_key), APCG(rfc1867_prefix), 63);
+ strlcat(RFC1867_DATA(tracking_key), *data->value, 63);
+ break;
+
+ case MULTIPART_EVENT_FILE_START:
-+ if(*RFC1867_DATA(tracking_key)) {
-+ multipart_event_file_start *data = (multipart_event_file_start *) event_data;
++ {
++ RFC1867_DATA(started) = 1;
++ if(*RFC1867_DATA(tracking_key)) {
++ multipart_event_file_start *data = (multipart_event_file_start *) event_data;
+
-+ RFC1867_DATA(bytes_processed) = data->post_bytes_processed;
-+ strncpy(RFC1867_DATA(filename),*data->filename,127);
-+ RFC1867_DATA(temp_filename) = NULL;
-+ strncpy(RFC1867_DATA(name),data->name,63);
-+ ALLOC_INIT_ZVAL(track);
-+ array_init(track);
-+ add_assoc_long(track, "total", RFC1867_DATA(content_length));
-+ add_assoc_long(track, "current", RFC1867_DATA(bytes_processed));
-+ add_assoc_string(track, "filename", RFC1867_DATA(filename), 1);
-+ add_assoc_string(track, "name", RFC1867_DATA(name), 1);
-+ add_assoc_long(track, "done", 0);
-+ add_assoc_double(track, "start_time", RFC1867_DATA(start_time));
-+ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length), track, 3600, 0 TSRMLS_CC);
-+ zval_ptr_dtor(&track);
++ RFC1867_DATA(bytes_processed) = data->post_bytes_processed;
++ strlcpy(RFC1867_DATA(filename),*data->filename,128);
++ RFC1867_DATA(temp_filename) = NULL;
++ strlcpy(RFC1867_DATA(name),data->name,64);
++ ALLOC_INIT_ZVAL(track);
++ array_init(track);
++ add_assoc_long(track, "total", RFC1867_DATA(content_length));
++ add_assoc_long(track, "current", RFC1867_DATA(bytes_processed));
++ add_assoc_string(track, "filename", RFC1867_DATA(filename), 1);
++ add_assoc_string(track, "name", RFC1867_DATA(name), 1);
++ add_assoc_long(track, "done", 0);
++ add_assoc_double(track, "start_time", RFC1867_DATA(start_time));
++ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length)+1, track, APCG(rfc1867_ttl), 0 TSRMLS_CC);
++ zval_ptr_dtor(&track);
++ }
+ }
+ break;
+
+ add_assoc_string(track, "name", RFC1867_DATA(name), 1);
+ add_assoc_long(track, "done", 0);
+ add_assoc_double(track, "start_time", RFC1867_DATA(start_time));
-+ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length), track, 3600, 0 TSRMLS_CC);
++ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length)+1, track, APCG(rfc1867_ttl), 0 TSRMLS_CC);
+ zval_ptr_dtor(&track);
+ }
+ RFC1867_DATA(prev_bytes_processed) = RFC1867_DATA(bytes_processed);
+ add_assoc_long(track, "cancel_upload", RFC1867_DATA(cancel_upload));
+ add_assoc_long(track, "done", 0);
+ add_assoc_double(track, "start_time", RFC1867_DATA(start_time));
-+ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length), track, 3600, 0 TSRMLS_CC);
++ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length)+1, track, APCG(rfc1867_ttl), 0 TSRMLS_CC);
+ zval_ptr_dtor(&track);
+ }
+ break;
+ add_assoc_long(track, "cancel_upload", RFC1867_DATA(cancel_upload));
+ add_assoc_long(track, "done", 1);
+ add_assoc_double(track, "start_time", RFC1867_DATA(start_time));
-+ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length), track, APCG(rfc1867_ttl), 0 TSRMLS_CC);
++ _apc_store(RFC1867_DATA(tracking_key), RFC1867_DATA(key_length)+1, track, APCG(rfc1867_ttl), 0 TSRMLS_CC);
+ zval_ptr_dtor(&track);
+ }
+ break;
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_sem.c php-5.3.1/ext/apc/apc_sem.c
---- php-5.3.1.orig/ext/apc/apc_sem.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_sem.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,201 @@
+--- /dev/null
++++ b/ext/apc/apc_sem.c
+@@ -0,0 +1,192 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268620 2008-11-09 02:30:49Z shire $ */
++/* $Id: apc_sem.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "apc.h"
+
+# define UNDO 0
+#endif
+
-+int apc_sem_create(const char* pathname, int proj, int initval)
++int apc_sem_create(int proj, int initval TSRMLS_DC)
+{
+ int semid;
-+ int perms;
++ int perms = 0777;
+ union semun arg;
-+ key_t key;
-+
-+ perms = 0777;
-+
-+ key = IPC_PRIVATE;
-+ if (pathname != NULL) {
-+ if ((key = ftok(pathname, proj)) < 0) {
-+ apc_eprint("apc_sem_create: ftok(%s,%d) failed:", pathname, proj);
-+ }
-+ }
++ key_t key = IPC_PRIVATE;
+
+ if ((semid = semget(key, 1, IPC_CREAT | IPC_EXCL | perms)) >= 0) {
+ /* sempahore created for the first time, initialize now */
+ arg.val = initval;
+ if (semctl(semid, 0, SETVAL, arg) < 0) {
-+ apc_eprint("apc_sem_create: semctl(%d,...) failed:", semid);
++ apc_error("apc_sem_create: semctl(%d,...) failed:" TSRMLS_CC, semid);
+ }
+ }
+ else if (errno == EEXIST) {
+ /* sempahore already exists, don't initialize */
+ if ((semid = semget(key, 1, perms)) < 0) {
-+ apc_eprint("apc_sem_create: semget(%u,...) failed:", key);
++ apc_error("apc_sem_create: semget(%u,...) failed:" TSRMLS_CC, key);
+ }
+ /* insert <sleazy way to avoid race condition> here */
+ }
+ else {
-+ apc_eprint("apc_sem_create: semget(%u,...) failed:", key);
++ apc_error("apc_sem_create: semget(%u,...) failed:" TSRMLS_CC, key);
+ }
+
+ return semid;
+ semctl(semid, 0, IPC_RMID, arg);
+}
+
-+void apc_sem_lock(int semid)
++void apc_sem_lock(int semid TSRMLS_DC)
+{
+ struct sembuf op;
+
+
+ if (semop(semid, &op, 1) < 0) {
+ if (errno != EINTR) {
-+ apc_eprint("apc_sem_lock: semop(%d) failed:", semid);
++ apc_error("apc_sem_lock: semop(%d) failed:" TSRMLS_CC, semid);
+ }
+ }
+}
+
-+int apc_sem_nonblocking_lock(int semid)
++int apc_sem_nonblocking_lock(int semid TSRMLS_DC)
+{
+ struct sembuf op;
+
+ if (errno == EAGAIN) {
+ return 0; /* Lock is already held */
+ } else if (errno != EINTR) {
-+ apc_eprint("apc_sem_lock: semop(%d) failed:", semid);
++ apc_error("apc_sem_lock: semop(%d) failed:" TSRMLS_CC, semid);
+ }
+ }
+
+ return 1; /* Lock obtained */
+}
+
-+void apc_sem_unlock(int semid)
++void apc_sem_unlock(int semid TSRMLS_DC)
+{
+ struct sembuf op;
+
+
+ if (semop(semid, &op, 1) < 0) {
+ if (errno != EINTR) {
-+ apc_eprint("apc_sem_unlock: semop(%d) failed:", semid);
++ apc_error("apc_sem_unlock: semop(%d) failed:" TSRMLS_CC, semid);
+ }
+ }
+}
+
-+void apc_sem_wait_for_zero(int semid)
++void apc_sem_wait_for_zero(int semid TSRMLS_DC)
+{
+ struct sembuf op;
+
+
+ if (semop(semid, &op, 1) < 0) {
+ if (errno != EINTR) {
-+ apc_eprint("apc_sem_waitforzero: semop(%d) failed:", semid);
++ apc_error("apc_sem_waitforzero: semop(%d) failed:" TSRMLS_CC, semid);
+ }
+ }
+}
+
-+int apc_sem_get_value(int semid)
++int apc_sem_get_value(int semid TSRMLS_DC)
+{
+ union semun arg;
+ unsigned short val[1];
+
+ arg.array = val;
+ if (semctl(semid, 0, GETALL, arg) < 0) {
-+ apc_eprint("apc_sem_getvalue: semctl(%d,...) failed:", semid);
++ apc_error("apc_sem_getvalue: semctl(%d,...) failed:" TSRMLS_CC, semid);
+ }
+ return val[0];
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_sem.h php-5.3.1/ext/apc/apc_sem.h
---- php-5.3.1.orig/ext/apc/apc_sem.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_sem.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_sem.h
@@ -0,0 +1,52 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268620 2008-11-09 02:30:49Z shire $ */
++/* $Id: apc_sem.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_SEM_H
+#define APC_SEM_H
+
+/* Wrapper functions for SysV sempahores */
+
-+extern int apc_sem_create(const char* pathname, int proj, int initval);
++extern int apc_sem_create(int proj, int initval TSRMLS_DC);
+extern void apc_sem_destroy(int semid);
-+extern void apc_sem_lock(int semid);
-+extern int apc_sem_nonblocking_lock(int semid);
-+extern void apc_sem_unlock(int semid);
-+extern void apc_sem_wait_for_zero(int semid);
-+extern int apc_sem_get_value(int semid);
++extern void apc_sem_lock(int semid TSRMLS_DC);
++extern int apc_sem_nonblocking_lock(int semid TSRMLS_DC);
++extern void apc_sem_unlock(int semid TSRMLS_DC);
++extern void apc_sem_wait_for_zero(int semid TSRMLS_DC);
++extern int apc_sem_get_value(int semid TSRMLS_DC);
+
+#endif
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_shm.c php-5.3.1/ext/apc/apc_shm.c
---- php-5.3.1.orig/ext/apc/apc_shm.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_shm.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,124 @@
+--- /dev/null
++++ b/ext/apc/apc_shm.c
+@@ -0,0 +1,114 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 273457 2009-01-13 15:16:42Z gopalv $ */
++/* $Id: apc_shm.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "apc_shm.h"
+#include "apc.h"
+# define SHM_A 0222 /* write permission */
+#endif
+
-+int apc_shm_create(const char* pathname, int proj, size_t size)
++int apc_shm_create(int proj, size_t size TSRMLS_DC)
+{
-+ int shmid; /* shared memory id */
-+ int oflag; /* permissions on shm */
-+ key_t key; /* shm key returned by ftok */
-+
-+ key = IPC_PRIVATE;
-+#ifndef PHP_WIN32
-+ /* no ftok yet for win32 */
-+ if (pathname != NULL) {
-+ if ((key = ftok(pathname, proj)) < 0) {
-+ apc_eprint("apc_shm_create: ftok failed:");
-+ }
-+ }
-+#endif
++ int shmid; /* shared memory id */
++ int oflag; /* permissions on shm */
++ key_t key = IPC_PRIVATE; /* shm key */
+
+ oflag = IPC_CREAT | SHM_R | SHM_A;
+ if ((shmid = shmget(key, size, oflag)) < 0) {
-+ apc_eprint("apc_shm_create: shmget(%d, %d, %d) failed: %s. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment.", key, size, oflag, strerror(errno));
++ apc_error("apc_shm_create: shmget(%d, %d, %d) failed: %s. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment." TSRMLS_CC, key, size, oflag, strerror(errno));
+ }
+
+ return shmid;
+ shmctl(shmid, IPC_RMID, 0);
+}
+
-+apc_segment_t apc_shm_attach(int shmid)
++apc_segment_t apc_shm_attach(int shmid TSRMLS_DC)
+{
+ apc_segment_t segment; /* shm segment */
+
+ if ((long)(segment.shmaddr = shmat(shmid, 0, 0)) == -1) {
-+ apc_eprint("apc_shm_attach: shmat failed:");
++ apc_error("apc_shm_attach: shmat failed:" TSRMLS_CC);
+ }
+
+#ifdef APC_MEMPROTECT
+ return segment;
+}
+
-+void apc_shm_detach(apc_segment_t* segment)
++void apc_shm_detach(apc_segment_t* segment TSRMLS_DC)
+{
+ if (shmdt(segment->shmaddr) < 0) {
-+ apc_eprint("apc_shm_detach: shmdt failed:");
++ apc_error("apc_shm_detach: shmdt failed:" TSRMLS_CC);
+ }
+
+#ifdef APC_MEMPROTECT
+ if (segment->roaddr && shmdt(segment->roaddr) < 0) {
-+ apc_eprint("apc_shm_detach: shmdt failed:");
++ apc_error("apc_shm_detach: shmdt failed:" TSRMLS_CC);
+ }
+#endif
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_shm.h php-5.3.1/ext/apc/apc_shm.h
---- php-5.3.1.orig/ext/apc/apc_shm.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_shm.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_shm.h
@@ -0,0 +1,56 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 273456 2009-01-13 14:43:58Z gopalv $ */
++/* $Id: apc_shm.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_SHM_H
+#define APC_SHM_H
+
+/* Wrapper functions for unix shared memory */
+
-+extern int apc_shm_create(const char* name, int proj, size_t size);
++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);
-+extern void apc_shm_detach(apc_segment_t* segment);
++extern apc_segment_t apc_shm_attach(int shmid 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
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_signal.c php-5.3.1/ext/apc/apc_signal.c
---- php-5.3.1.orig/ext/apc/apc_signal.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_signal.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,195 @@
+--- /dev/null
++++ b/ext/apc/apc_signal.c
+@@ -0,0 +1,197 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++ /* $Id: apc_signal.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+ /* Allows apc to install signal handlers and maintain signalling
+ to already registered handlers. Registers all signals that
+
+static apc_signal_info_t apc_signal_info = {0};
+
-+static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*));
++static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*) TSRMLS_DC);
+static void apc_rehandle_signal(int signo, siginfo_t *siginfo, void *context);
+static void apc_core_unmap(int signo, siginfo_t *siginfo, void *context);
+
+ */
+static void apc_core_unmap(int signo, siginfo_t *siginfo, void *context)
+{
-+ apc_sma_cleanup();
++ TSRMLS_FETCH();
++
++ apc_sma_cleanup(TSRMLS_C);
+ apc_rehandle_signal(signo, siginfo, context);
+
+#if !defined(WIN32) && !defined(NETWARE)
+ * Set a handler for a previously installed signal and save so we can
+ * callback when handled
+ */
-+static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*))
++static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*) TSRMLS_DC)
+{
+ struct sigaction sa = {{0}};
+ apc_signal_entry_t p_sig = {0};
+ p_sig.siginfo = ((sa.sa_flags & SA_SIGINFO) == SA_SIGINFO);
+ p_sig.handler = (void *)sa.sa_handler;
+
-+ apc_signal_info.prev = (apc_signal_entry_t **)apc_erealloc(apc_signal_info.prev, (apc_signal_info.installed+1)*sizeof(apc_signal_entry_t *));
-+ apc_signal_info.prev[apc_signal_info.installed] = (apc_signal_entry_t *)apc_emalloc(sizeof(apc_signal_entry_t));
++ apc_signal_info.prev = (apc_signal_entry_t **)apc_erealloc(apc_signal_info.prev, (apc_signal_info.installed+1)*sizeof(apc_signal_entry_t *) TSRMLS_CC);
++ apc_signal_info.prev[apc_signal_info.installed] = (apc_signal_entry_t *)apc_emalloc(sizeof(apc_signal_entry_t) TSRMLS_CC);
+ *apc_signal_info.prev[apc_signal_info.installed++] = p_sig;
+ } else {
+ /* inherit flags and mask if already set */
+ sa.sa_handler = (void*)handler;
+
+ if (sigaction(signo, &sa, NULL) < 0) {
-+ apc_wprint("Error installing apc signal handler for %d", signo);
++ apc_warning("Error installing apc signal handler for %d" TSRMLS_CC, signo);
+ }
+
+ return SUCCESS;
+{
+ if (APCG(coredump_unmap) && apc_signal_info.installed == 0) {
+ /* ISO C standard signals that coredump */
-+ apc_register_signal(SIGSEGV, apc_core_unmap);
-+ apc_register_signal(SIGABRT, apc_core_unmap);
-+ apc_register_signal(SIGFPE, apc_core_unmap);
-+ apc_register_signal(SIGILL, apc_core_unmap);
++ apc_register_signal(SIGSEGV, apc_core_unmap TSRMLS_CC);
++ apc_register_signal(SIGABRT, apc_core_unmap TSRMLS_CC);
++ apc_register_signal(SIGFPE, apc_core_unmap TSRMLS_CC);
++ apc_register_signal(SIGILL, apc_core_unmap TSRMLS_CC);
+ /* extended signals that coredump */
+#ifdef SIGBUS
-+ apc_register_signal(SIGBUS, apc_core_unmap);
++ apc_register_signal(SIGBUS, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGABORT
-+ apc_register_signal(SIGABORT, apc_core_unmap);
++ apc_register_signal(SIGABORT, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGEMT
-+ apc_register_signal(SIGEMT, apc_core_unmap);
++ apc_register_signal(SIGEMT, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGIOT
-+ apc_register_signal(SIGIOT, apc_core_unmap);
++ apc_register_signal(SIGIOT, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGQUIT
-+ apc_register_signal(SIGQUIT, apc_core_unmap);
++ apc_register_signal(SIGQUIT, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGSYS
-+ apc_register_signal(SIGSYS, apc_core_unmap);
++ apc_register_signal(SIGSYS, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGTRAP
-+ apc_register_signal(SIGTRAP, apc_core_unmap);
++ apc_register_signal(SIGTRAP, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGXCPU
-+ apc_register_signal(SIGXCPU, apc_core_unmap);
++ apc_register_signal(SIGXCPU, apc_core_unmap TSRMLS_CC);
+#endif
+#ifdef SIGXFSZ
-+ apc_register_signal(SIGXFSZ, apc_core_unmap);
++ apc_register_signal(SIGXFSZ, apc_core_unmap TSRMLS_CC);
+#endif
+ }
+} /* }}} */
+
+/* {{{ apc_set_signals
+ * cleanup signals for shutdown */
-+void apc_shutdown_signals()
++void apc_shutdown_signals(TSRMLS_D)
+{
+ int i=0;
+ if (apc_signal_info.installed > 0) {
+ for (i=0; (i < apc_signal_info.installed); i++) {
-+ apc_efree(apc_signal_info.prev[i]);
++ apc_efree(apc_signal_info.prev[i] TSRMLS_CC);
+ }
-+ apc_efree(apc_signal_info.prev);
++ apc_efree(apc_signal_info.prev TSRMLS_CC);
+ apc_signal_info.installed = 0; /* just in case */
+ }
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_signal.h php-5.3.1/ext/apc/apc_signal.h
---- php-5.3.1.orig/ext/apc/apc_signal.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_signal.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_signal.h
@@ -0,0 +1,51 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_signal.h 300986 2010-07-04 14:41:33Z felipe $ */
+
+#ifndef APC_SIGNAL_H
+#define APC_SIGNAL_H
+} apc_signal_info_t;
+
+void apc_set_signals(TSRMLS_D);
-+void apc_shutdown_signals();
++void apc_shutdown_signals(TSRMLS_D);
+
+#endif
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_sma.c php-5.3.1/ext/apc/apc_sma.c
---- php-5.3.1.orig/ext/apc/apc_sma.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_sma.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,738 @@
+--- /dev/null
++++ b/ext/apc/apc_sma.c
+@@ -0,0 +1,765 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 284580 2009-07-22 06:05:31Z kalle $ */
++/* $Id: apc_sma.c 305260 2010-11-10 19:23:02Z gopalv $ */
+
+#include "apc_sma.h"
+#include "apc.h"
+/* {{{ sma_debug_state(apc_sma_segment_t *segment, int canary_check, int verbose)
+ * useful for debuging state of memory blocks and free list, and sanity checking
+ */
-+static void sma_debug_state(void* shmaddr, int canary_check, int verbose) {
++static void sma_debug_state(void* shmaddr, int canary_check, int verbose TSRMLS_DC) {
+ sma_header_t *header = (sma_header_t*)shmaddr;
+ block_t *cur = BLOCKAT(ALIGNWORD(sizeof(sma_header_t)));
+ block_t *prv = NULL;
+ size_t avail;
+
+ /* Verify free list */
-+ if (verbose) apc_wprint("Free List: ");
++ if (verbose) apc_warning("Free List: " TSRMLS_CC);
+ while(1) {
-+ if (verbose) apc_wprint(" 0x%x[%d] (s%d)", cur, OFFSET(cur), cur->size);
++ if (verbose) apc_warning(" 0x%x[%d] (s%d)" TSRMLS_CC, cur, OFFSET(cur), cur->size);
+ if (canary_check) CHECK_CANARY(cur);
+ if (!cur->fnext) break;
+ cur = BLOCKAT(cur->fnext);
+ avail += cur->size;
+ if (prv == cur) {
-+ apc_wprint("Circular list detected!");
++ apc_warning("Circular list detected!" TSRMLS_CC);
+ assert(0);
+ }
+ if (prv && cur->fprev != OFFSET(prv)) {
-+ apc_wprint("Previous pointer does not point to previous!");
++ apc_warning("Previous pointer does not point to previous!" TSRMLS_CC);
+ assert(0);
+ }
+ prv = cur;
+ assert(avail == header->avail);
+
+ /* Verify each block */
-+ if (verbose) apc_wprint("Block List: ");
++ if (verbose) apc_warning("Block List: " TSRMLS_CC);
+ cur = BLOCKAT(ALIGNWORD(sizeof(sma_header_t)));
+ while(1) {
+ if(!cur->fnext) {
-+ if (verbose) apc_wprint(" 0x%x[%d] (s%d) (u)", cur, OFFSET(cur), cur->size);
++ if (verbose) apc_warning(" 0x%x[%d] (s%d) (u)" TSRMLS_CC, cur, OFFSET(cur), cur->size);
+ } else {
-+ if (verbose) apc_wprint(" 0x%x[%d] (s%d) (f)", cur, OFFSET(cur), cur->size);
++ if (verbose) apc_warning(" 0x%x[%d] (s%d) (f)" TSRMLS_CC, cur, OFFSET(cur), cur->size);
+ }
+ if (canary_check) CHECK_CANARY(cur);
+ if (!cur->size && !cur->fnext) break;
+ cur = NEXT_SBLOCK(cur);
+ }
+ if (prv == cur) {
-+ apc_wprint("Circular list detected!");
++ apc_warning("Circular list detected!" TSRMLS_CC);
+ assert(0);
+ }
+ prv = cur;
+
+/* {{{ apc_sma_init */
+
-+void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask)
++void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask TSRMLS_DC)
+{
+ uint i;
+
+
+ sma_segsize = segsize > 0 ? segsize : DEFAULT_SEGSIZE;
+
-+ sma_segments = (apc_segment_t*) apc_emalloc(sma_numseg*sizeof(apc_segment_t));
++ sma_segments = (apc_segment_t*) apc_emalloc((sma_numseg * sizeof(apc_segment_t)) TSRMLS_CC);
+
+ for (i = 0; i < sma_numseg; i++) {
+ sma_header_t* header;
-+ block_t* block;
++ block_t *first, *empty, *last;
+ void* shmaddr;
+
+#if APC_MMAP
-+ sma_segments[i] = apc_mmap(mmap_file_mask, sma_segsize);
++ 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(NULL, i, sma_segsize));
++ sma_segments[i] = apc_shm_attach(apc_shm_create(i, sma_segsize TSRMLS_CC) TSRMLS_CC);
+#endif
+
+ sma_segments[i].size = sma_segsize;
+ for(j=0; j<30; j++) header->adist[j] = 0;
+ }
+#endif
-+ block = BLOCKAT(ALIGNWORD(sizeof(sma_header_t)));
-+ block->size = 0;
-+ block->fnext = ALIGNWORD(sizeof(sma_header_t)) + ALIGNWORD(sizeof(block_t));
-+ block->fprev = 0;
-+ block->prev_size = 0;
-+ SET_CANARY(block);
++ first = BLOCKAT(ALIGNWORD(sizeof(sma_header_t)));
++ first->size = 0;
++ first->fnext = ALIGNWORD(sizeof(sma_header_t)) + ALIGNWORD(sizeof(block_t));
++ first->fprev = 0;
++ first->prev_size = 0;
++ SET_CANARY(first);
+#ifdef __APC_SMA_DEBUG__
+ block->id = -1;
+#endif
-+ block = BLOCKAT(block->fnext);
-+ block->size = header->avail - ALIGNWORD(sizeof(block_t));
-+ block->fnext = OFFSET(block) + block->size;
-+ block->fprev = ALIGNWORD(sizeof(sma_header_t));
-+ block->prev_size = 0;
-+ SET_CANARY(block);
++ empty = BLOCKAT(first->fnext);
++ empty->size = header->avail - ALIGNWORD(sizeof(block_t));
++ empty->fnext = OFFSET(empty) + empty->size;
++ empty->fprev = ALIGNWORD(sizeof(sma_header_t));
++ empty->prev_size = 0;
++ SET_CANARY(empty);
+#ifdef __APC_SMA_DEBUG__
-+ block->id = -1;
++ empty->id = -1;
+#endif
-+ block = BLOCKAT(block->fnext);
-+ block->size = 0;
-+ block->fnext = 0;
-+ block->fprev = ALIGNWORD(sizeof(sma_header_t)) + ALIGNWORD(sizeof(block_t));
-+ block->prev_size = header->avail - ALIGNWORD(sizeof(block_t));
-+ SET_CANARY(block);
++ last = BLOCKAT(empty->fnext);
++ last->size = 0;
++ last->fnext = 0;
++ last->fprev = OFFSET(empty);
++ last->prev_size = empty->size;
++ SET_CANARY(last);
+#ifdef __APC_SMA_DEBUG__
-+ block->id = -1;
++ last->id = -1;
+#endif
+ }
+}
+/* }}} */
+
+/* {{{ apc_sma_cleanup */
-+void apc_sma_cleanup()
++void apc_sma_cleanup(TSRMLS_D)
+{
+ uint i;
+
+ for (i = 0; i < sma_numseg; i++) {
+ apc_lck_destroy(SMA_LCK(i));
+#if APC_MMAP
-+ apc_unmap(&sma_segments[i]);
++ apc_unmap(&sma_segments[i] TSRMLS_CC);
+#else
-+ apc_shm_detach(&sma_segments[i]);
++ apc_shm_detach(&sma_segments[i] TSRMLS_CC);
+#endif
+ }
+ sma_initialized = 0;
-+ apc_efree(sma_segments);
++ apc_efree(sma_segments TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ apc_sma_malloc_ex */
-+void* apc_sma_malloc_ex(size_t n, size_t fragment, size_t* allocated)
++void* apc_sma_malloc_ex(size_t n, size_t fragment, size_t* allocated TSRMLS_DC)
+{
+ size_t off;
+ uint i;
++ int nuked = 0;
+
-+ TSRMLS_FETCH();
++restart:
+ assert(sma_initialized);
+ LOCK(SMA_LCK(sma_lastseg));
+
+ if(off == -1 && APCG(current_cache)) {
+ /* retry failed allocation after we expunge */
+ UNLOCK(SMA_LCK(sma_lastseg));
-+ APCG(current_cache)->expunge_cb(APCG(current_cache), n);
++ APCG(current_cache)->expunge_cb(APCG(current_cache), (n+fragment) TSRMLS_CC);
+ LOCK(SMA_LCK(sma_lastseg));
+ off = sma_allocate(SMA_HDR(sma_lastseg), n, fragment, allocated);
+ }
+ if(off == -1 && APCG(current_cache)) {
+ /* retry failed allocation after we expunge */
+ UNLOCK(SMA_LCK(i));
-+ APCG(current_cache)->expunge_cb(APCG(current_cache), n);
++ APCG(current_cache)->expunge_cb(APCG(current_cache), (n+fragment) TSRMLS_CC);
+ LOCK(SMA_LCK(i));
+ off = sma_allocate(SMA_HDR(i), n, fragment, allocated);
+ }
+ UNLOCK(SMA_LCK(i));
+ }
+
++ /* 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);
++ nuked = 1;
++ goto restart;
++ }
++
++ /* now, I've truly and well given up */
++
+ return NULL;
+}
+/* }}} */
+
+/* {{{ apc_sma_malloc */
-+void* apc_sma_malloc(size_t n)
++void* apc_sma_malloc(size_t n TSRMLS_DC)
+{
+ size_t allocated;
-+ void *p = apc_sma_malloc_ex(n, MINBLOCKSIZE, &allocated);
++ void *p = apc_sma_malloc_ex(n, MINBLOCKSIZE, &allocated TSRMLS_CC);
+
+ return p;
+}
+/* }}} */
+
+/* {{{ apc_sma_realloc */
-+void* apc_sma_realloc(void *p, size_t n)
++void* apc_sma_realloc(void *p, size_t n TSRMLS_DC)
+{
-+ apc_sma_free(p);
-+ return apc_sma_malloc(n);
++ apc_sma_free(p TSRMLS_CC);
++ return apc_sma_malloc(n TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ apc_sma_strdup */
-+char* apc_sma_strdup(const char* s)
++char* apc_sma_strdup(const char* s TSRMLS_DC)
+{
+ void* q;
+ int len;
+ if(!s) return NULL;
+
+ len = strlen(s)+1;
-+ q = apc_sma_malloc(len);
++ q = apc_sma_malloc(len TSRMLS_CC);
+ if(!q) return NULL;
+ memcpy(q, s, len);
+ return q;
+/* }}} */
+
+/* {{{ apc_sma_free */
-+void apc_sma_free(void* p)
++void apc_sma_free(void* p TSRMLS_DC)
+{
+ uint i;
+ size_t offset;
+ }
+ }
+
-+ apc_eprint("apc_sma_free: could not locate address %p", p);
++ apc_error("apc_sma_free: could not locate address %p" TSRMLS_CC, p);
+}
+/* }}} */
+
+/* {{{ */
+void* apc_sma_protect(void *p)
+{
-+ int i;
++ unsigned int i = 0;
+ size_t offset;
+
+ if (p == NULL) {
+/* {{{ */
+void* apc_sma_unprotect(void *p)
+{
-+ int i;
++ unsigned int i = 0;
+ size_t offset;
+
+ if (p == NULL) {
+#endif
+
+/* {{{ apc_sma_info */
-+apc_sma_info_t* apc_sma_info(zend_bool limited)
++apc_sma_info_t* apc_sma_info(zend_bool limited TSRMLS_DC)
+{
+ apc_sma_info_t* info;
+ apc_sma_link_t** link;
+ return NULL;
+ }
+
-+ info = (apc_sma_info_t*) apc_emalloc(sizeof(apc_sma_info_t));
++ info = (apc_sma_info_t*) apc_emalloc(sizeof(apc_sma_info_t) TSRMLS_CC);
+ info->num_seg = sma_numseg;
+ info->seg_size = sma_segsize - (ALIGNWORD(sizeof(sma_header_t)) + ALIGNWORD(sizeof(block_t)) + ALIGNWORD(sizeof(block_t)));
+
-+ info->list = apc_emalloc(info->num_seg * sizeof(apc_sma_link_t*));
++ info->list = apc_emalloc(info->num_seg * sizeof(apc_sma_link_t*) TSRMLS_CC);
+ for (i = 0; i < sma_numseg; i++) {
+ info->list[i] = NULL;
+ }
+ CHECK_CANARY(cur);
+#endif
+
-+ *link = apc_emalloc(sizeof(apc_sma_link_t));
++ *link = apc_emalloc(sizeof(apc_sma_link_t) TSRMLS_CC);
+ (*link)->size = cur->size;
+ (*link)->offset = prv->fnext;
+ (*link)->next = NULL;
+/* }}} */
+
+/* {{{ apc_sma_free_info */
-+void apc_sma_free_info(apc_sma_info_t* info)
++void apc_sma_free_info(apc_sma_info_t* info TSRMLS_DC)
+{
+ int i;
+
+ while (p) {
+ apc_sma_link_t* q = p;
+ p = p->next;
-+ apc_efree(q);
++ apc_efree(q TSRMLS_CC);
+ }
+ }
-+ apc_efree(info->list);
-+ apc_efree(info);
++ apc_efree(info->list TSRMLS_CC);
++ apc_efree(info TSRMLS_CC);
+}
+/* }}} */
+
+}
+/* }}} */
+
++/* {{{ apc_sma_get_avail_size */
++zend_bool apc_sma_get_avail_size(size_t size)
++{
++ uint i;
++
++ for (i = 0; i < sma_numseg; i++) {
++ sma_header_t* header = SMA_HDR(i);
++ if (header->avail > size) {
++ return 1;
++ }
++ }
++ return 0;
++}
++/* }}} */
++
++
+#if ALLOC_DISTRIBUTION
+size_t *apc_sma_get_alloc_distribution(void) {
+ sma_header_t* header = (sma_header_t*) segment->sma_shmaddr;
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_sma.h php-5.3.1/ext/apc/apc_sma.h
---- php-5.3.1.orig/ext/apc/apc_sma.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_sma.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,102 @@
+--- /dev/null
++++ b/ext/apc/apc_sma.h
+@@ -0,0 +1,103 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 277617 2009-03-23 02:16:24Z shire $ */
++/* $Id: apc_sma.h 303274 2010-09-11 14:31:32Z iliaa $ */
+
+#ifndef APC_SMA_H
+#define APC_SMA_H
+#endif
+};
+
-+extern void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask);
-+extern void apc_sma_cleanup();
-+extern void* apc_sma_malloc(size_t size);
-+extern void* apc_sma_malloc_ex(size_t size, size_t fragment, size_t* allocated);
-+extern void* apc_sma_realloc(void* p, size_t size);
-+extern char* apc_sma_strdup(const char *s);
-+extern void apc_sma_free(void* p);
++extern void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask TSRMLS_DC);
++extern void apc_sma_cleanup(TSRMLS_D);
++extern void* apc_sma_malloc(size_t size TSRMLS_DC);
++extern void* apc_sma_malloc_ex(size_t size, size_t fragment, size_t* allocated TSRMLS_DC);
++extern void* apc_sma_realloc(void* p, size_t size TSRMLS_DC);
++extern char* apc_sma_strdup(const char *s TSRMLS_DC);
++extern void apc_sma_free(void* p TSRMLS_DC);
+#if ALLOC_DISTRIBUTION
+extern size_t *apc_sma_get_alloc_distribution();
+#endif
+};
+/* }}} */
+
-+extern apc_sma_info_t* apc_sma_info(zend_bool limited);
-+extern void apc_sma_free_info(apc_sma_info_t* info);
++extern apc_sma_info_t* apc_sma_info(zend_bool limited TSRMLS_DC);
++extern void apc_sma_free_info(apc_sma_info_t* info TSRMLS_DC);
+
+extern size_t apc_sma_get_avail_mem();
++extern zend_bool apc_sma_get_avail_size(size_t size);
+extern void apc_sma_check_integrity();
+
+/* {{{ ALIGNWORD: pad up x, aligned to the system's word boundary */
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_spin.c php-5.3.1/ext/apc/apc_spin.c
---- php-5.3.1.orig/ext/apc/apc_spin.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_spin.c 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_spin.c
@@ -0,0 +1,66 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2007-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_spin.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+#include "apc_spin.h"
+
+ return;
+}
+
-+void apc_slock_lock(slock_t *lock)
++void apc_slock_lock(slock_t *lock TSRMLS_DC)
+{
+ S_LOCK(lock);
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_spin.h php-5.3.1/ext/apc/apc_spin.h
---- php-5.3.1.orig/ext/apc/apc_spin.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_spin.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,49 @@
+--- /dev/null
++++ b/ext/apc/apc_spin.h
+@@ -0,0 +1,48 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2007-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_spin.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_SPIN_H
+#define APC_SPIN_H
+
+slock_t *apc_slock_create(slock_t *lock);
+void apc_slock_destroy(slock_t *lock);
-+void apc_slock_lock(slock_t *lock);
++void apc_slock_lock(slock_t *lock TSRMLS_DC);
+zend_bool apc_slock_nonblocking_lock(slock_t *lock);
-+void apc_slock_lock(slock_t *lock);
+void apc_slock_unlock(slock_t *lock);
+
+#endif
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_stack.c php-5.3.1/ext/apc/apc_stack.c
---- php-5.3.1.orig/ext/apc/apc_stack.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_stack.c 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_stack.c
@@ -0,0 +1,106 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_stack.c 302175 2010-08-13 06:20:28Z kalle $ */
+
-+#include "apc_stack.h"
+#include "apc.h"
++#include "apc_stack.h"
+
+struct apc_stack_t {
+ void** data;
+ int size;
+};
+
-+apc_stack_t* apc_stack_create(int size_hint)
++apc_stack_t* apc_stack_create(int size_hint TSRMLS_DC)
+{
-+ apc_stack_t* stack = (apc_stack_t*) apc_emalloc(sizeof(apc_stack_t));
++ apc_stack_t* stack = (apc_stack_t*) apc_emalloc(sizeof(apc_stack_t) TSRMLS_CC);
+
+ stack->capacity = (size_hint > 0) ? size_hint : 10;
+ stack->size = 0;
-+ stack->data = (void**) apc_emalloc(sizeof(void*) * stack->capacity);
++ stack->data = (void**) apc_emalloc(sizeof(void*) * stack->capacity TSRMLS_CC);
+
+ return stack;
+}
+
-+void apc_stack_destroy(apc_stack_t* stack)
++void apc_stack_destroy(apc_stack_t* stack TSRMLS_DC)
+{
+ if (stack != NULL) {
-+ apc_efree(stack->data);
-+ apc_efree(stack);
++ apc_efree(stack->data TSRMLS_CC);
++ apc_efree(stack TSRMLS_CC);
+ }
+}
+
+ stack->size = 0;
+}
+
-+void apc_stack_push(apc_stack_t* stack, void* item)
++void apc_stack_push(apc_stack_t* stack, void* item TSRMLS_DC)
+{
+ assert(stack != NULL);
+ if (stack->size == stack->capacity) {
+ stack->capacity *= 2;
-+ stack->data = apc_erealloc(stack->data, sizeof(void*)*stack->capacity);
++ stack->data = apc_erealloc(stack->data, sizeof(void*)*stack->capacity TSRMLS_CC);
+ }
+ stack->data[stack->size++] = item;
+}
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_stack.h php-5.3.1/ext/apc/apc_stack.h
---- php-5.3.1.orig/ext/apc/apc_stack.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_stack.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/apc_stack.h
@@ -0,0 +1,58 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: apc_stack.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+#ifndef APC_STACK_H
+#define APC_STACK_H
+#define T apc_stack_t*
+typedef struct apc_stack_t apc_stack_t; /* opaque stack type */
+
-+extern T apc_stack_create(int size_hint);
-+extern void apc_stack_destroy(T stack);
++extern T apc_stack_create(int size_hint TSRMLS_DC);
++extern void apc_stack_destroy(T stack TSRMLS_DC);
+extern void apc_stack_clear(T stack);
-+extern void apc_stack_push(T stack, void* item);
++extern void apc_stack_push(T stack, void* item TSRMLS_DC);
+extern void* apc_stack_pop(T stack);
+extern void* apc_stack_top(T stack);
+extern void* apc_stack_get(T stack, int n);
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_zend.c php-5.3.1/ext/apc/apc_zend.c
---- php-5.3.1.orig/ext/apc/apc_zend.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_zend.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,213 @@
+--- /dev/null
++++ b/ext/apc/apc_string.c
+@@ -0,0 +1,247 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2010 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: $ */
++
++#include "apc.h"
++#include "apc_globals.h"
++#include "apc_php.h"
++#include "apc_lock.h"
++
++#ifdef ZEND_ENGINE_2_4
++
++typedef struct _apc_interned_strings_data_t {
++ char *interned_strings_start;
++ char *interned_strings_end;
++ char *interned_strings_top;
++ apc_lck_t lock;
++ HashTable interned_strings;
++} apc_interned_strings_data_t;
++
++apc_interned_strings_data_t *apc_interned_strings_data = NULL;
++
++#define APCSG(v) (apc_interned_strings_data->v)
++
++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 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)
++{
++ return str;
++}
++
++static void apc_dummy_interned_strings_snapshot_for_php(TSRMLS_D)
++{
++}
++
++static void apc_dummy_interned_strings_restore_for_php(TSRMLS_D)
++{
++}
++
++char *apc_new_interned_string(char *arKey, int nKeyLength TSRMLS_DC)
++{
++ ulong h;
++ uint nIndex;
++ Bucket *p;
++
++ if (arKey >= APCSG(interned_strings_start) && arKey < APCSG(interned_strings_end)) {
++ return arKey;
++ }
++
++ h = zend_inline_hash_func(arKey, nKeyLength);
++ nIndex = h & APCSG(interned_strings).nTableMask;
++
++ p = APCSG(interned_strings).arBuckets[nIndex];
++ while (p != NULL) {
++ if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
++ if (!memcmp(p->arKey, arKey, nKeyLength)) {
++ return p->arKey;
++ }
++ }
++ p = p->pNext;
++ }
++
++ if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
++ 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);
++
++ p->arKey = (char*)(p+1);
++ memcpy(p->arKey, arKey, nKeyLength);
++ p->nKeyLength = nKeyLength;
++ p->h = h;
++ p->pData = &p->pDataPtr;
++ p->pDataPtr = p;
++
++ p->pNext = APCSG(interned_strings).arBuckets[nIndex];
++ p->pLast = NULL;
++ if (p->pNext) {
++ p->pNext->pLast = p;
++ }
++ APCSG(interned_strings).arBuckets[nIndex] = p;
++
++ p->pListLast = APCSG(interned_strings).pListTail;
++ APCSG(interned_strings).pListTail = p;
++ p->pListNext = NULL;
++ if (p->pListLast != NULL) {
++ p->pListLast->pListNext = p;
++ }
++ if (!APCSG(interned_strings).pListHead) {
++ APCSG(interned_strings).pListHead = p;
++ }
++
++ APCSG(interned_strings).nNumOfElements++;
++
++ return p->arKey;
++}
++
++static void apc_copy_internal_strings(TSRMLS_D)
++{
++ Bucket *p, *q;
++
++ p = CG(function_table)->pListHead;
++ while (p) {
++ if (p->nKeyLength) {
++ p->arKey = apc_new_interned_string(p->arKey, p->nKeyLength TSRMLS_CC);
++ }
++ p = p->pListNext;
++ }
++
++ p = CG(class_table)->pListHead;
++ while (p) {
++ zend_class_entry *ce = (zend_class_entry*)(p->pDataPtr);
++
++ if (p->nKeyLength) {
++ p->arKey = apc_new_interned_string(p->arKey, p->nKeyLength TSRMLS_CC);
++ }
++
++ q = ce->properties_info.pListHead;
++ while (q) {
++ zend_property_info *info = (zend_property_info*)(q->pData);
++
++ if (q->nKeyLength) {
++ q->arKey = apc_new_interned_string(q->arKey, q->nKeyLength TSRMLS_CC);
++ }
++
++ if (info->name) {
++ info->name = apc_new_interned_string(info->name, info->name_length+1 TSRMLS_CC);
++ }
++
++ q = q->pListNext;
++ }
++
++ q = ce->function_table.pListHead;
++ while (q) {
++ if (q->nKeyLength) {
++ q->arKey = apc_new_interned_string(q->arKey, q->nKeyLength TSRMLS_CC);
++ }
++ q = q->pListNext;
++ }
++
++ q = ce->constants_table.pListHead;
++ while (q) {
++ if (q->nKeyLength) {
++ q->arKey = apc_new_interned_string(q->arKey, q->nKeyLength TSRMLS_CC);
++ }
++ q = q->pListNext;
++ }
++
++ p = p->pListNext;
++ }
++
++ p = EG(zend_constants)->pListHead;
++ while (p) {
++ if (p->nKeyLength) {
++ p->arKey = apc_new_interned_string(p->arKey, p->nKeyLength TSRMLS_CC);
++ }
++ p = p->pListNext;
++ }
++}
++
++void apc_interned_strings_init(TSRMLS_D)
++{
++ 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);
++
++ CREATE_LOCK(APCSG(lock));
++
++ zend_hash_init(&APCSG(interned_strings), count, NULL, NULL, 1);
++ APCSG(interned_strings).nTableMask = APCSG(interned_strings).nTableSize - 1;
++ APCSG(interned_strings).arBuckets = (Bucket**)((char*)apc_interned_strings_data + sizeof(apc_interned_strings_data_t));
++
++ APCSG(interned_strings_start) = (char*)APCSG(interned_strings).arBuckets + APCSG(interned_strings).nTableSize * sizeof(Bucket *);
++ APCSG(interned_strings_end) = (char*)apc_interned_strings_data + APCG(shm_strings_buffer);
++ APCSG(interned_strings_top) = APCSG(interned_strings_start);
++
++ old_interned_strings_start = CG(interned_strings_start);
++ old_interned_strings_end = CG(interned_strings_end);
++ old_new_interned_string = zend_new_interned_string;
++ 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;
++
++ 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
++
++/*
++ * 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
++ */
+--- /dev/null
++++ b/ext/apc/apc_string.h
+@@ -0,0 +1,49 @@
++/*
++ +----------------------------------------------------------------------+
++ | APC |
++ +----------------------------------------------------------------------+
++ | Copyright (c) 2006-2010 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: $ */
++
++#ifndef APC_STRING
++#define APC_STRING
++
++#include "apc.h"
++
++void apc_interned_strings_init(TSRMLS_D);
++void apc_interned_strings_shutdown(TSRMLS_D);
++
++char *apc_new_interned_string(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
++ */
+--- /dev/null
++++ b/ext/apc/apc_zend.c
+@@ -0,0 +1,271 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 276053 2009-02-18 08:59:00Z gopalv $ */
++/* $Id: apc_zend.c 303426 2010-09-16 16:39:08Z iliaa $ */
+
+#include "apc_zend.h"
+#include "apc_globals.h"
+/* true global */
+int apc_reserved_offset;
+
-+void* apc_php_malloc(size_t n)
++void* apc_php_malloc(size_t n TSRMLS_DC)
+{
+ return emalloc(n);
+}
+
-+void apc_php_free(void* p)
++void apc_php_free(void* p TSRMLS_DC)
+{
+ efree(p);
+}
+
+#define APC_EX_T(offset) (*(temp_variable *)((char*)execute_data->Ts + offset))
+
++#ifdef ZEND_ENGINE_2_4
++static zval *apc_get_zval_ptr(zend_uchar op_type, znode_op *node, zval **freeval, zend_execute_data *execute_data TSRMLS_DC)
++{
++ *freeval = NULL;
++
++ switch (op_type) {
++ case IS_CONST:
++ return node->zv;
++ case IS_VAR:
++ return APC_EX_T(node->var).var.ptr;
++ case IS_TMP_VAR:
++ return (*freeval = &APC_EX_T(node->var).tmp_var);
++ case IS_CV:
++ {
++ zval ***ret = &execute_data->CVs[node->var];
++
++ if (!*ret) {
++ zend_compiled_variable *cv = &EG(active_op_array)->vars[node->var];
++
++ if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void**)ret)==FAILURE) {
++ apc_notice("Undefined variable: %s" TSRMLS_CC, cv->name);
++ return &EG(uninitialized_zval);
++ }
++ }
++ return **ret;
++ }
++ case IS_UNUSED:
++ default:
++ return NULL;
++ }
++}
++#else
+static zval *apc_get_zval_ptr(znode *node, zval **freeval, zend_execute_data *execute_data TSRMLS_DC)
+{
+ *freeval = NULL;
+ zend_compiled_variable *cv = &EG(active_op_array)->vars[node->u.var];
+
+ if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void**)ret)==FAILURE) {
-+ apc_nprint("Undefined variable: %s", cv->name);
++ apc_notice("Undefined variable: %s" TSRMLS_CC, cv->name);
+ return &EG(uninitialized_zval);
+ }
+ }
+ return NULL;
+ }
+}
++#endif
+
+static int ZEND_FASTCALL apc_op_ZEND_INCLUDE_OR_EVAL(ZEND_OPCODE_HANDLER_ARGS)
+{
+ char realpath[MAXPATHLEN];
+ php_stream_wrapper *wrapper;
+ char *path_for_open;
++ char *full_path = NULL;
+ int ret = 0;
+ apc_opflags_t* flags = NULL;
+
++#ifdef ZEND_ENGINE_2_4
++ if (opline->extended_value != ZEND_INCLUDE_ONCE &&
++ opline->extended_value != ZEND_REQUIRE_ONCE) {
++ return apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
++ }
++
++ inc_filename = apc_get_zval_ptr(opline->op1_type, &opline->op1, &freeop1, execute_data TSRMLS_CC);
++#else
+ if (Z_LVAL(opline->op2.u.constant) != ZEND_INCLUDE_ONCE &&
+ Z_LVAL(opline->op2.u.constant) != ZEND_REQUIRE_ONCE) {
+ return apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+
+ inc_filename = apc_get_zval_ptr(&opline->op1, &freeop1, execute_data TSRMLS_CC);
++#endif
++
+ if (Z_TYPE_P(inc_filename) != IS_STRING) {
+ tmp_inc_filename = *inc_filename;
+ zval_copy_ctor(&tmp_inc_filename);
+
+ wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(inc_filename), &path_for_open, 0 TSRMLS_CC);
+
-+ if (wrapper != &php_plain_files_wrapper ||
-+ !(IS_ABSOLUTE_PATH(path_for_open, strlen(path_for_open)) ||
-+ expand_filepath(path_for_open, realpath TSRMLS_CC))) {
++ if (wrapper != &php_plain_files_wrapper || !(IS_ABSOLUTE_PATH(path_for_open, strlen(path_for_open)) || (full_path = expand_filepath(path_for_open, realpath TSRMLS_CC)))) {
+ /* Fallback to original handler */
+ if (inc_filename == &tmp_inc_filename) {
+ zval_dtor(&tmp_inc_filename);
+ return apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+
++ if (!full_path) {
++ full_path = path_for_open;
++ }
+ if (zend_hash_exists(&EG(included_files), realpath, strlen(realpath) + 1)) {
++#ifdef ZEND_ENGINE_2_4
++ if (!(opline->result_type & EXT_TYPE_UNUSED)) {
++ ALLOC_INIT_ZVAL(APC_EX_T(opline->result.var).var.ptr);
++ ZVAL_TRUE(APC_EX_T(opline->result.var).var.ptr);
++ }
++#else
+ if (!(opline->result.u.EA.type & EXT_TYPE_UNUSED)) {
+ ALLOC_INIT_ZVAL(APC_EX_T(opline->result.u.var).var.ptr);
+ ZVAL_TRUE(APC_EX_T(opline->result.u.var).var.ptr);
+ }
++#endif
+ if (inc_filename == &tmp_inc_filename) {
+ zval_dtor(&tmp_inc_filename);
+ }
+ /* Since the op array is a local copy, we can cheat our way through the file inclusion by temporarily
+ * changing the op to a plain require/include, calling its handler and finally restoring the opcode.
+ */
++#ifdef ZEND_ENGINE_2_4
++ opline->extended_value = (opline->extended_value == ZEND_INCLUDE_ONCE) ? ZEND_INCLUDE : ZEND_REQUIRE;
++ ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
++ opline->extended_value = (opline->extended_value == ZEND_INCLUDE) ? ZEND_INCLUDE_ONCE : ZEND_REQUIRE_ONCE;
++#else
+ Z_LVAL(opline->op2.u.constant) = (Z_LVAL(opline->op2.u.constant) == ZEND_INCLUDE_ONCE) ? ZEND_INCLUDE : ZEND_REQUIRE;
+ ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ Z_LVAL(opline->op2.u.constant) = (Z_LVAL(opline->op2.u.constant) == ZEND_INCLUDE) ? ZEND_INCLUDE_ONCE : ZEND_REQUIRE_ONCE;
++#endif
+ } else {
+ ret = apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/apc_zend.h php-5.3.1/ext/apc/apc_zend.h
---- php-5.3.1.orig/ext/apc/apc_zend.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/apc_zend.h 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,169 @@
+--- /dev/null
++++ b/ext/apc/apc_zend.h
+@@ -0,0 +1,191 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 286799 2009-08-04 11:27:29Z gopalv $ */
++/* $Id: apc_zend.h 303464 2010-09-17 12:19:29Z gopalv $ */
+
+#ifndef APC_ZEND_H
+#define APC_ZEND_H
+#endif
+
+
-+extern void* apc_php_malloc(size_t n);
-+extern void apc_php_free(void* p);
++extern void* apc_php_malloc(size_t n TSRMLS_DC);
++extern void apc_php_free(void* p TSRMLS_DC);
+
+extern void apc_zend_init(TSRMLS_D);
+extern void apc_zend_shutdown(TSRMLS_D);
+ _UNUSED_CODE, /* 15 */
+ _CV_CODE /* 16 = IS_CV */
+ };
++#ifdef ZEND_ENGINE_2_4
++ return (opline->opcode * 25) + (apc_vm_decode[opline->op1_type] * 5) + apc_vm_decode[opline->op2_type];
++#else
+ return (opline->opcode * 25) + (apc_vm_decode[opline->op1.op_type] * 5) + apc_vm_decode[opline->op2.op_type];
++#endif
+}
+
+# define APC_ZEND_OPLINE zend_op *opline = execute_data->opline;
+# define APC_OPCODE_HANDLER_DECODE(opline) _apc_opcode_handler_decode(opline)
+# 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 */
+# 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
+#define ZEND_FASTCALL
+#endif
+
++/* Added in ZE2.3.0 */
++#ifndef zend_parse_parameters_none
++# define zend_parse_parameters_none() zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
++#endif
++
+
+#endif /* APC_OPCODE_OVERRIDE */
+
++#ifdef ZEND_ENGINE_2_4
++# define ZEND_CE_FILENAME(ce) (ce)->info.user.filename
++# define ZEND_CE_DOC_COMMENT(ce) (ce)->info.user.doc_comment
++# define ZEND_CE_DOC_COMMENT_LEN(ce) (ce)->info.user.doc_comment_len
++# define ZEND_CE_BUILTIN_FUNCTIONS(ce) (ce)->info.internal.builtin_functions
++#else
++# define ZEND_CE_FILENAME(ce) (ce)->filename
++# define ZEND_CE_DOC_COMMENT(ce) (ce)->doc_comment
++# define ZEND_CE_DOC_COMMENT_LEN(ce) (ce)->doc_comment_len
++# define ZEND_CE_BUILTIN_FUNCTIONS(ce) (ce)->builtin_functions
++#endif
+
+#endif /* APC_ZEND_H */
+
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/CHANGELOG php-5.3.1/ext/apc/CHANGELOG
---- php-5.3.1.orig/ext/apc/CHANGELOG 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/CHANGELOG 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/CHANGELOG
@@ -0,0 +1,249 @@
+
+3.1.2 : 2008-12-12
+
+1.0.1:
+- added optional file modification time check [djc 2001-01-12]
-diff -Naur php-5.3.1.orig/ext/apc/config.m4 php-5.3.1/ext/apc/config.m4
---- php-5.3.1.orig/ext/apc/config.m4 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/config.m4 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,232 @@
+--- /dev/null
++++ b/ext/apc/config.m4
+@@ -0,0 +1,246 @@
+dnl
-+dnl $Id: config.m4 286829 2009-08-05 10:31:28Z gopalv $
++dnl $Id: config.m4 304101 2010-10-05 14:37:36Z kalle $
+dnl
+
+PHP_ARG_ENABLE(apc, whether to enable APC support,
+[ --enable-apc Enable APC support])
+
++AC_ARG_ENABLE(apc-debug,
++[ --enable-apc-debug Enable APC debugging],
++[
++ PHP_APC_DEBUG=yes
++],
++[
++ PHP_APC_DEBUG=no
++])
++
+AC_MSG_CHECKING(whether we should enable cache request file info)
+AC_ARG_ENABLE(apc-filehits,
+[ --enable-apc-filehits Enable per request file info about files used from the APC cache (ie: apc_cache_info('filehits')) ],
+])
+
+AC_MSG_CHECKING(whether we should enable memory protection)
-+AC_ARG_ENABLE(memory-protection,
-+[ --enable-memory-protection
++AC_ARG_ENABLE(apc-memprotect,
++[ --enable-apc-memprotect
+ Enable mmap/shm memory protection],
+[
+ PHP_APC_MEMPROTECT=$enableval
+ test "$PHP_APC_MMAP" != "no" && AC_DEFINE(APC_MMAP, 1, [ ])
+ test "$PHP_APC_FILEHITS" != "no" && AC_DEFINE(APC_FILEHITS, 1, [ ])
+
++ if test "$PHP_APC_DEBUG" != "no"; then
++ AC_DEFINE(__DEBUG_APC__, 1, [ ])
++ fi
++
+ if test "$PHP_APC_SEM" != "no"; then
+ AC_DEFINE(APC_SEM_LOCKS, 1, [ ])
+ elif test "$PHP_APC_SPINLOCKS" != "no"; then
+ apc_signal.c \
+ apc_pool.c \
+ apc_iterator.c \
-+ apc_bin.c "
++ apc_bin.c \
++ apc_string.c "
+
+ PHP_CHECK_LIBRARY(rt, shm_open, [PHP_ADD_LIBRARY(rt,,APC_SHARED_LIBADD)])
+ PHP_NEW_EXTENSION(apc, $apc_sources, $ext_shared,, \\$(APC_CFLAGS))
+ AC_DEFINE(HAVE_APC, 1, [ ])
+fi
+
-diff -Naur php-5.3.1.orig/ext/apc/config.w32 php-5.3.1/ext/apc/config.w32
---- php-5.3.1.orig/ext/apc/config.w32 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/config.w32 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,27 @@
-+// $Id: config.w32 284592 2009-07-22 10:53:50Z kalle $
+--- /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
+
-+ARG_ENABLE("apc", "Alternative PHP Cache", "no");
-+
-+if (PHP_APC != "no") {
-+ apc_sources="apc.c php_apc.c \
-+ apc_cache.c \
-+ apc_compile.c \
-+ apc_debug.c \
-+ apc_fcntl_win32.c \
-+ apc_iterator.c \
-+ apc_main.c \
-+ apc_shm.c \
-+ apc_sma.c \
-+ apc_stack.c \
-+ apc_rfc1867.c \
-+ apc_zend.c \
-+ apc_pool.c \
-+ apc_bin.c \
-+ apc_spin.c \
-+ pgsql_s_lock.c";
-+
-+ EXTENSION('apc', apc_sources);
++
++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');
++
++if(PHP_APC != 'no')
++{
++ var apc_sources = 'apc.c php_apc.c apc_cache.c apc_compile.c apc_debug.c ' +
++ 'apc_fcntl_win32.c apc_iterator.c apc_main.c apc_shm.c ' +
++ 'apc_sma.c apc_stack.c apc_rfc1867.c apc_zend.c apc_pool.c ' +
++ 'apc_bin.c apc_string.c';
++
++ if(PHP_APC_DEBUG != 'no')
++ {
++ ADD_FLAG('CFLAGS_APC', '/D __DEBUG_APC__=1');
++ }
++
++ if(PHP_APC_FILEHITS != 'no')
++ {
++ AC_DEFINE('APC_FILEHITS', 1);
++ }
++
++ if(PHP_APC_MEMPROTECT != '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');
++
++ apc_sources += ' apc_spin.c pgsql_s_lock.c';
++ }
++ else
++ {
++ AC_DEFINE('APC_FCNTL_LOCKS', 1);
++ }
++
+ AC_DEFINE('HAVE_APC', 1);
-+ ADD_FLAG('CFLAGS_APC', "/DAPC_SPIN_LOCKS=1 /DWIN32_ONLY_COMPILER=1");
++
++ EXTENSION('apc', apc_sources);
+}
-diff -Naur php-5.3.1.orig/ext/apc/INSTALL php-5.3.1/ext/apc/INSTALL
---- php-5.3.1.orig/ext/apc/INSTALL 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/INSTALL 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,421 @@
+\ No newline at end of file
+--- /dev/null
++++ b/ext/apc/INSTALL
+@@ -0,0 +1,400 @@
+Installation Instructions for APC
+---------------------------------
+
+----------------
+Building from CVS can be done like this:
+
-+ cvs -d :pserver:cvsread@cvs.php.net:/repository login
-+ Password: phpfi
-+ cvs -d :pserver:cvsread@cvs.php.net:/repository co pecl/apc
-+ cd pecl/apc
++ svn co http://svn.php.net/repository/pecl/apc/trunk apc
++ cd apc
+ phpize
-+ ./configure --enable-apc-mmap --with-apxs --with-php-config=/usr/local/php/bin/php-config
++ ./configure --with-php-config=/usr/local/php/bin/php-config
+ make
++ export TEST_PHP_ARGS='-n'
++ make test
+ make install
+
+Suggested Configuration (in your php.ini file)
+----------------------------------------------
+ extension=apc.so
+ apc.enabled=1
-+ apc.shm_segments=1
+ apc.shm_size=128
+ apc.ttl=7200
+ apc.user_ttl=7200
-+ apc.num_files_hint=1024
-+ apc.mmap_file_mask=/tmp/apc.XXXXXX
+ apc.enable_cli=1
+
+These are fully described at the bottom of this file.
+
-+PHP 4 Optimization
-+------------------
-+If you are trying to get every little bit of speed out of PHP4+APC, you need
-+to tell APC where to find your httpd.h file and also add -DAPC_PHP4_STAT to
-+your CPPFLAGS. (if you don't have httpd.h, install the apache_dev package
-+for your OS) and do:
-+ export CPPFLAGS="-I/usr/include/apache-1.3 -DAPC_PHP4_STAT" (for bash on Debian)
-+ setenv CPPFLAGS "-I/usr/include/apache-1.3 -DAPC_PHP4_STAT" (for tsch on Debian)
-+and then re-run your configure script.
-+
-+This optimization saves a stat syscall on the main script file. In PHP5 this
-+optimization is automatic and doesn't need any special build flags.
-+
-+The second thing you are going to want to do to save another syscall is to
-+compile using the --with-apxs configure switch. This should work for both
-+Apache1 and Apache2. Point it directly at your apxs2 script for Apache2.
-+eg. --with-apxs=/usr/local/bin/apxs2
-+
++---------------------+
+| QUICK INSTALL (DSO) |
++---------------------+
+$ gunzip -c apc_x.y.tar.gz | tar xf -
+$ cd apc_x.y
+$ /usr/local/php/bin/phpize
-+$ ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/php/bin/php-config
++$ ./configure --with-php-config=/usr/local/php/bin/php-config
+$ make
+$ make install
+
+ Optimize include_once and require_once calls and avoid the
+ expensive system calls used.
+ (Default: 0)
-diff -Naur php-5.3.1.orig/ext/apc/LICENSE php-5.3.1/ext/apc/LICENSE
---- php-5.3.1.orig/ext/apc/LICENSE 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/LICENSE 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/LICENSE
@@ -0,0 +1,68 @@
+--------------------------------------------------------------------
+ The PHP License, version 3.01
-+Copyright (c) 1999 - 2006 The PHP Group. All rights reserved.
++Copyright (c) 1999 - 2010 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>.
-diff -Naur php-5.3.1.orig/ext/apc/NOTICE php-5.3.1/ext/apc/NOTICE
---- php-5.3.1.orig/ext/apc/NOTICE 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/NOTICE 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/NOTICE
@@ -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
-diff -Naur php-5.3.1.orig/ext/apc/package.xml php-5.3.1/ext/apc/package.xml
---- php-5.3.1.orig/ext/apc/package.xml 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/package.xml 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,736 @@
+--- /dev/null
++++ b/ext/apc/package.xml
+@@ -0,0 +1,827 @@
+<?xml version="1.0" encoding="UTF-8"?>
-+<package packagerversion="1.8.0" 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">
++<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>
+ <name>Edin Kadribasic</name>
+ <user>edink</user>
+ <email>edink@emini.dk</email>
-+ <active>yes</active>
++ <active>no</active>
+ </developer>
+ <developer>
+ <name>Ilia Alshanetsky</name>
+ <name>Marcus Börger</name>
+ <user>helly</user>
+ <email>helly@php.net</email>
-+ <active>yes</active>
++ <active>no</active>
+ </developer>
+ <developer>
+ <name>Sara Golemon</name>
+ <user>pollita</user>
+ <email>pollita@php.net</email>
-+ <active>yes</active>
++ <active>no</active>
+ </developer>
+ <developer>
+ <name>Brian Shire</name>
+ <email>shire@php.net</email>
+ <active>yes</active>
+ </developer>
-+ <date>2009-08-14</date>
-+ <time>16:30:36</time>
++ <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.3p1</release>
++ <release>3.1.6</release>
+ <api>3.1.0</api>
+ </version>
+ <stability>
-+ <release>beta</release>
-+ <api>beta</api>
++ <release>stable</release>
++ <api>stable</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>
-+- fix pecl build / package.xml (Gopal)
++- 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="841596cff3b9bd83e79d01ccb591ff55" name="tests/apc_001.phpt" role="test" />
++ <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="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="4092ea60d4ff7bfdcbcc5795c06e60e7" name="tests/apc_009.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="4b7dc1553dadcb3378d33e069387e35c" name="tests/apc_bin_001.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="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="3206db85017077ed498fd9d5ac7585e7" name="tests/iterator_006.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="f5ca8db7fde5fb83ab79b509279b9856" name="INSTALL" role="doc" />
-+ <file md5sum="694f49a7e1f276ba75a3dd2c5acd580d" name="LICENSE" 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="efa40416571fc54aa59912203c0391e6" name="TODO" role="doc" />
-+ <file md5sum="b7dd14328e218d3ecc97d85fb83d7ba7" name="TECHNOTES.txt" role="doc" />
-+ <file md5sum="e7fdf1aa7be78296ac3baf23654b2792" name="apc.c" role="src" />
-+ <file md5sum="09a525ff9a3850e6de42eee2adf07463" name="apc.dsp" role="src" />
-+ <file md5sum="b82f7ac9d62387e674ce33a67afc7a3b" name="apc.h" role="src" />
-+ <file md5sum="849d4591945e68babb4efb03e3d424ae" name="apc_bin.c" role="src" />
-+ <file md5sum="dcaf89f1b2266c5c41a0ab19785bee7d" name="apc_bin.h" role="src" />
-+ <file md5sum="8121a318b3008f743d8bed06dec9f729" name="apc_cache.c" role="src" />
-+ <file md5sum="9b419e40230069357142c22eab50bc0a" name="apc_cache.h" role="src" />
-+ <file md5sum="29385884afc3dbd6b3c85fe224e2a365" name="apc_compile.c" role="src" />
-+ <file md5sum="12cb41077d90d258aa7eb59b834ef261" name="apc_compile.h" role="src" />
-+ <file md5sum="c2f45f382269e062291f4a1972891a95" name="apc_debug.c" role="src" />
-+ <file md5sum="46d182a6122f3c29a1904f62af7cfb51" name="apc_debug.h" role="src" />
-+ <file md5sum="3bd799be126de9a5b701de001c9fdc8d" name="apc_fcntl.c" role="src" />
-+ <file md5sum="396db63ae5ac6622826cdd6ea0a0f4e5" name="apc_fcntl.h" role="src" />
-+ <file md5sum="d474fc330719125798f1cc8893418fea" name="apc_globals.h" role="src" />
-+ <file md5sum="681d7c13200e8c63e06a72c29d0d83f5" name="apc_lock.h" role="src" />
-+ <file md5sum="4c36bea0b58da92e574d3788a091cdcd" name="apc_main.c" role="src" />
-+ <file md5sum="4ff2542ab8b12f8bce6d0c71f2a4ffb7" name="apc_main.h" role="src" />
-+ <file md5sum="a1128f11e4db3dae87640595180c7e76" name="apc_mmap.c" role="src" />
-+ <file md5sum="8a27408dbf63cf115d2845d73c1100c3" name="apc_mmap.h" role="src" />
-+ <file md5sum="0226513b1cd48f3004f01ad2a24c7a90" name="apc_php.h" role="src" />
-+ <file md5sum="247b2ed6b2c9f5064a9352a84a675034" name="apc_pthreadmutex.c" role="src" />
-+ <file md5sum="ce3c8071287af9608a70a201bc149e42" name="apc_pthreadmutex.h" role="src" />
-+ <file md5sum="8364571d83c9304ddd63bab54ef59f0e" name="apc_sem.c" role="src" />
-+ <file md5sum="85d68fac7619e136c5dd2dba7498cebe" name="apc_sem.h" role="src" />
-+ <file md5sum="874b69fe7572b47ca0c427213a24a004" name="apc_shm.c" role="src" />
-+ <file md5sum="adcbe11cf10939218758cea6155571b5" name="apc_shm.h" role="src" />
-+ <file md5sum="55788ceff1d153856173e9cb1be30af5" name="apc_sma.c" role="src" />
-+ <file md5sum="7b915d4e05f034544794c0a22aca28df" name="apc_sma.h" role="src" />
-+ <file md5sum="3651ead82ae249829bdfbd247845023a" name="apc_spin.c" role="src" />
-+ <file md5sum="39b7125d52a30ad45f467f897a4f49fd" name="apc_spin.h" role="src" />
-+ <file md5sum="bac2bf4975f8d178509c35687aacf264" name="apc_stack.c" role="src" />
-+ <file md5sum="769e2610340545503843be5d27338bc0" name="apc_stack.h" role="src" />
-+ <file md5sum="e06026d546096ccfd153f7ce282ec3d3" name="apc_zend.c" role="src" />
-+ <file md5sum="d23c3716dc2be32d93583bdf2ee67fc5" name="apc_zend.h" role="src" />
-+ <file md5sum="43c72ad19c9b3c2b7107ac38ac890b9c" name="apc_signal.c" role="src" />
-+ <file md5sum="a93d49b7187c228033a0e6c906c660a9" name="apc_signal.h" role="src" />
-+ <file md5sum="10bc3c48bf67d1f19d590d8aef62096f" name="apc_iterator.c" role="src" />
-+ <file md5sum="fa2801d6755aca597222263a5c327c17" name="apc_iterator.h" role="src" />
-+ <file md5sum="2985b114a6c62d4c645da54e15362133" name="apc_pool.c" role="src" />
-+ <file md5sum="d33cf9a06d75796db5d2d6d05ce69cb2" name="apc_pool.h" role="src" />
-+ <file md5sum="4825b1162664c350544045d54dc88e26" name="config.m4" role="src" />
-+ <file md5sum="f8892e31c76167187d69df7870ad4510" name="config.w32" role="src" />
-+ <file md5sum="36e70be4ad90d876f34743323da54a94" name="php_apc.c" role="src" />
-+ <file md5sum="b6fdcec040076e3895b885a87ca6315c" name="php_apc.h" role="src" />
-+ <file md5sum="5f6b362f9d82a1c71f19ad1516935b03" name="pgsql_s_lock.c" role="src" />
-+ <file md5sum="a8fb99edbfe1118664ffceb868fc4756" name="pgsql_s_lock.h" role="src" />
-+ <file md5sum="56e973e39dd83277cd2dc091115dd06d" name="apc_fcntl_win32.c" role="src" />
-+ <file md5sum="71dc597b764f4e6ea12253d50e2167d5" name="apc_rfc1867.c" role="src" />
-+ <file md5sum="6022f9c20f05b1ce3524c1bd5b87f8db" name="apc.php" role="php" />
++ <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>
+- 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>
-diff -Naur php-5.3.1.orig/ext/apc/pgsql_s_lock.c php-5.3.1/ext/apc/pgsql_s_lock.c
---- php-5.3.1.orig/ext/apc/pgsql_s_lock.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/pgsql_s_lock.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,485 @@
+--- /dev/null
++++ b/ext/apc/pgsql_s_lock.c
+@@ -0,0 +1,391 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2007-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 284592 2009-07-22 10:53:50Z kalle $ */
++/* $Id: pgsql_s_lock.c 302175 2010-08-13 06:20:28Z kalle $ */
+
+/*-------------------------------------------------------------------------
+ *
+ * s_lock_stuck() - complain about a stuck spinlock
+ */
+static void
-+s_lock_stuck(volatile slock_t *lock, const char *file, int line)
++s_lock_stuck(volatile slock_t *lock, const char *file, int line TSRMLS_DC)
+{
+#if defined(S_LOCK_TEST)
+ fprintf(stderr,
+ elog(PANIC, "stuck spinlock (%p) detected at %s:%d",
+ lock, file, line);
+ */
-+ apc_eprint("Stuck spinlock (%p) detected", lock);
++ apc_error("Stuck spinlock (%p) detected" TSRMLS_CC, lock);
+#endif
+}
+
+ * s_lock(lock) - platform-independent portion of waiting for a spinlock.
+ */
+void
-+s_lock(volatile slock_t *lock, const char *file, int line)
++s_lock(volatile slock_t *lock, const char *file, int line TSRMLS_DC)
+{
+ /*
+ * We loop tightly for awhile, then delay using pg_usleep() and try again.
+ if (++spins >= spins_per_delay)
+ {
+ if (++delays > NUM_DELAYS)
-+ s_lock_stuck(lock, file, line);
++ s_lock_stuck(lock, file, line TSRMLS_CC);
+
+ if (cur_delay == 0) /* first time to delay? */
+ cur_delay = MIN_DELAY_MSEC;
+#endif /* not __GNUC__ */
+#endif /* HAVE_SPINLOCKS */
+
-+
-+
-+/*****************************************************************************/
-+#if defined(S_LOCK_TEST)
-+
-+/*
-+ * test program for verifying a port's spinlock support.
-+ */
-+
-+struct test_lock_struct
-+{
-+ char pad1;
-+ slock_t lock;
-+ char pad2;
-+};
-+
-+volatile struct test_lock_struct test_lock;
-+
-+int
-+main()
-+{
-+ srandom((unsigned int) time(NULL));
-+
-+ test_lock.pad1 = test_lock.pad2 = 0x44;
-+
-+ S_INIT_LOCK(&test_lock.lock);
-+
-+ if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
-+ {
-+ printf("S_LOCK_TEST: failed, declared datatype is wrong size\n");
-+ return 1;
-+ }
-+
-+ if (!S_LOCK_FREE(&test_lock.lock))
-+ {
-+ printf("S_LOCK_TEST: failed, lock not initialized\n");
-+ return 1;
-+ }
-+
-+ S_LOCK(&test_lock.lock);
-+
-+ if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
-+ {
-+ printf("S_LOCK_TEST: failed, declared datatype is wrong size\n");
-+ return 1;
-+ }
-+
-+ if (S_LOCK_FREE(&test_lock.lock))
-+ {
-+ printf("S_LOCK_TEST: failed, lock not locked\n");
-+ return 1;
-+ }
-+
-+ S_UNLOCK(&test_lock.lock);
-+
-+ if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
-+ {
-+ printf("S_LOCK_TEST: failed, declared datatype is wrong size\n");
-+ return 1;
-+ }
-+
-+ if (!S_LOCK_FREE(&test_lock.lock))
-+ {
-+ printf("S_LOCK_TEST: failed, lock not unlocked\n");
-+ return 1;
-+ }
-+
-+ S_LOCK(&test_lock.lock);
-+
-+ if (test_lock.pad1 != 0x44 || test_lock.pad2 != 0x44)
-+ {
-+ printf("S_LOCK_TEST: failed, declared datatype is wrong size\n");
-+ return 1;
-+ }
-+
-+ if (S_LOCK_FREE(&test_lock.lock))
-+ {
-+ printf("S_LOCK_TEST: failed, lock not re-locked\n");
-+ return 1;
-+ }
-+
-+ printf("S_LOCK_TEST: this will print %d stars and then\n", NUM_DELAYS);
-+ printf(" exit with a 'stuck spinlock' message\n");
-+ printf(" if S_LOCK() and TAS() are working.\n");
-+ fflush(stdout);
-+
-+ s_lock(&test_lock.lock, __FILE__, __LINE__);
-+
-+ printf("S_LOCK_TEST: failed, lock not locked\n");
-+ return 1;
-+}
-+
-+#endif /* S_LOCK_TEST */
-+
+#endif /* APC_SPIN_LOCKS */
-diff -Naur php-5.3.1.orig/ext/apc/pgsql_s_lock.h php-5.3.1/ext/apc/pgsql_s_lock.h
---- php-5.3.1.orig/ext/apc/pgsql_s_lock.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/pgsql_s_lock.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/pgsql_s_lock.h
@@ -0,0 +1,928 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2007-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 268255 2008-11-04 05:42:11Z rasmus $ */
++/* $Id: pgsql_s_lock.h 302175 2010-08-13 06:20:28Z kalle $ */
+
+/*-------------------------------------------------------------------------
+ *
+#define S_LOCK(lock) \
+ do { \
+ if (TAS(lock)) \
-+ s_lock((lock), __FILE__, __LINE__); \
++ s_lock((lock), __FILE__, __LINE__ TSRMLS_CC); \
+ } while (0)
+#endif /* S_LOCK */
+
+/*
+ * Platform-independent out-of-line support routines
+ */
-+extern void s_lock(volatile slock_t *lock, const char *file, int line);
++extern void s_lock(volatile slock_t *lock, const char *file, int line TSRMLS_DC);
+
+/* Support for dynamic adjustment of spins_per_delay */
+#define DEFAULT_SPINS_PER_DELAY 100
+#endif
+
+#endif /* S_LOCK_H */
-diff -Naur php-5.3.1.orig/ext/apc/php_apc.c php-5.3.1/ext/apc/php_apc.c
---- php-5.3.1.orig/ext/apc/php_apc.c 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/php_apc.c 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,1649 @@
+--- /dev/null
++++ b/ext/apc/php_apc.c
+@@ -0,0 +1,1812 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 286798 2009-08-04 11:27:12Z gopalv $ */
++/* $Id: php_apc.c 303642 2010-09-21 15:42:01Z kalle $ */
+
+#include "apc_zend.h"
+#include "apc_cache.h"
+PHP_FUNCTION(apc_bin_load);
+PHP_FUNCTION(apc_bin_dumpfile);
+PHP_FUNCTION(apc_bin_loadfile);
++PHP_FUNCTION(apc_exists);
+/* }}} */
+
+/* {{{ ZEND_DECLARE_MODULE_GLOBALS(apc) */
+ apc_globals->filters = NULL;
+ apc_globals->compiled_filters = NULL;
+ apc_globals->initialized = 0;
-+ apc_globals->cache_stack = apc_stack_create(0);
++ apc_globals->cache_stack = apc_stack_create(0 TSRMLS_CC);
+ apc_globals->cache_by_default = 1;
+ apc_globals->fpstat = 1;
+ apc_globals->canonicalize = 1;
+ apc_globals->stat_ctime = 0;
+ apc_globals->write_lock = 1;
++ apc_globals->slam_defense = 1;
+ apc_globals->report_autofilter = 0;
+ apc_globals->include_once = 0;
+ apc_globals->apc_optimize_function = NULL;
+ if (apc_globals->filters != NULL) {
+ int i;
+ for (i=0; apc_globals->filters[i] != NULL; i++) {
-+ apc_efree(apc_globals->filters[i]);
++ apc_efree(apc_globals->filters[i] TSRMLS_CC);
+ }
-+ apc_efree(apc_globals->filters);
++ apc_efree(apc_globals->filters TSRMLS_CC);
+ }
+
+ /* the stack should be empty */
+ assert(apc_stack_size(apc_globals->cache_stack) == 0);
+
+ /* apc cleanup */
-+ apc_stack_destroy(apc_globals->cache_stack);
++ apc_stack_destroy(apc_globals->cache_stack TSRMLS_CC);
+
+ /* the rest of the globals are cleaned up in apc_module_shutdown() */
+}
+
++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);
++#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;
++ }
++ }
++
++ return retval;
++#endif
++}
++
+/* }}} */
+
+/* {{{ PHP_INI */
+
+static PHP_INI_MH(OnUpdate_filters) /* {{{ */
+{
-+ APCG(filters) = apc_tokenize(new_value, ',');
++ APCG(filters) = apc_tokenize(new_value, ',' TSRMLS_CC);
+ return SUCCESS;
+}
+/* }}} */
+static PHP_INI_MH(OnUpdateShmSegments) /* {{{ */
+{
+#if APC_MMAP
-+ if(atoi(new_value)!=1) {
++ if(zend_atoi(new_value, new_value_length)!=1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "apc.shm_segments setting ignored in MMAP mode");
+ }
+ APCG(shm_segments) = 1;
+#else
-+ APCG(shm_segments) = atoi(new_value);
++ APCG(shm_segments) = zend_atoi(new_value, new_value_length);
+#endif
+ return SUCCESS;
+}
+/* }}} */
+
++static PHP_INI_MH(OnUpdateShmSize) /* {{{ */
++{
++ long s = apc_atol(new_value, new_value_length);
++
++ 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;
++ }
++
++ APCG(shm_size) = s;
++
++ return SUCCESS;
++}
++/* }}} */
++
+#ifdef MULTIPART_EVENT_FORMDATA
+static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
+{
+ int tmp;
+ tmp = zend_atoi(new_value, new_value_length);
+ if(tmp < 0) {
-+ apc_eprint("rfc1867_freq must be greater than or equal to zero.");
++ apc_error("rfc1867_freq must be greater than or equal to zero." TSRMLS_CC);
+ return FAILURE;
+ }
+ if(new_value[new_value_length-1] == '%') {
+ if(tmp > 100) {
-+ apc_eprint("rfc1867_freq cannot be over 100%%");
++ apc_error("rfc1867_freq cannot be over 100%%" TSRMLS_CC);
+ return FAILURE;
+ }
+ APCG(rfc1867_freq) = tmp / 100.0;
+/* }}} */
+#endif
+
-+#define OnUpdateInt OnUpdateLong
-+
+PHP_INI_BEGIN()
+STD_PHP_INI_BOOLEAN("apc.enabled", "1", PHP_INI_SYSTEM, OnUpdateBool, enabled, zend_apc_globals, apc_globals)
+STD_PHP_INI_ENTRY("apc.shm_segments", "1", PHP_INI_SYSTEM, OnUpdateShmSegments, shm_segments, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.shm_size", "30", PHP_INI_SYSTEM, OnUpdateInt, shm_size, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.shm_size", "32M", PHP_INI_SYSTEM, OnUpdateShmSize, shm_size, zend_apc_globals, apc_globals)
++#ifdef ZEND_ENGINE_2_4
++STD_PHP_INI_ENTRY("apc.shm_strings_buffer", "4M", PHP_INI_SYSTEM, OnUpdateLong, shm_strings_buffer, zend_apc_globals, apc_globals)
++#endif
+STD_PHP_INI_BOOLEAN("apc.include_once_override", "0", PHP_INI_SYSTEM, OnUpdateBool, include_once, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateInt, num_files_hint, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.user_entries_hint", "4096", PHP_INI_SYSTEM, OnUpdateInt, user_entries_hint, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateInt, gc_ttl, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.ttl", "0", PHP_INI_SYSTEM, OnUpdateInt, ttl, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.user_ttl", "0", PHP_INI_SYSTEM, OnUpdateInt, user_ttl, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.num_files_hint", "1000", PHP_INI_SYSTEM, OnUpdateLong, num_files_hint, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.user_entries_hint", "4096", PHP_INI_SYSTEM, OnUpdateLong, user_entries_hint, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.gc_ttl", "3600", PHP_INI_SYSTEM, OnUpdateLong, gc_ttl, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.ttl", "0", PHP_INI_SYSTEM, OnUpdateLong, ttl, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.user_ttl", "0", PHP_INI_SYSTEM, OnUpdateLong, user_ttl, zend_apc_globals, apc_globals)
+#if APC_MMAP
+STD_PHP_INI_ENTRY("apc.mmap_file_mask", NULL, PHP_INI_SYSTEM, OnUpdateString, mmap_file_mask, zend_apc_globals, apc_globals)
+#endif
+PHP_INI_ENTRY("apc.filters", NULL, PHP_INI_SYSTEM, OnUpdate_filters)
+STD_PHP_INI_BOOLEAN("apc.cache_by_default", "1", PHP_INI_ALL, OnUpdateBool, cache_by_default, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.file_update_protection", "2", PHP_INI_SYSTEM, OnUpdateInt,file_update_protection, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.file_update_protection", "2", PHP_INI_SYSTEM, OnUpdateLong,file_update_protection, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.enable_cli", "0", PHP_INI_SYSTEM, OnUpdateBool, enable_cli, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.max_file_size", "1M", PHP_INI_SYSTEM, OnUpdateInt, max_file_size, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.max_file_size", "1M", PHP_INI_SYSTEM, OnUpdateLong, max_file_size, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.stat", "1", PHP_INI_SYSTEM, OnUpdateBool, fpstat, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.canonicalize", "1", PHP_INI_SYSTEM, OnUpdateBool, canonicalize, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.stat_ctime", "0", PHP_INI_SYSTEM, OnUpdateBool, stat_ctime, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.write_lock", "1", PHP_INI_SYSTEM, OnUpdateBool, write_lock, zend_apc_globals, apc_globals)
++STD_PHP_INI_BOOLEAN("apc.slam_defense", "1", PHP_INI_SYSTEM, OnUpdateBool, slam_defense, zend_apc_globals, apc_globals)
+STD_PHP_INI_BOOLEAN("apc.report_autofilter", "0", PHP_INI_SYSTEM, OnUpdateBool, report_autofilter,zend_apc_globals, apc_globals)
+#ifdef MULTIPART_EVENT_FORMDATA
+STD_PHP_INI_BOOLEAN("apc.rfc1867", "0", PHP_INI_SYSTEM, OnUpdateBool, rfc1867, zend_apc_globals, apc_globals)
+STD_PHP_INI_ENTRY("apc.rfc1867_prefix", "upload_", PHP_INI_SYSTEM, OnUpdateStringUnempty, rfc1867_prefix, zend_apc_globals, apc_globals)
+STD_PHP_INI_ENTRY("apc.rfc1867_name", "APC_UPLOAD_PROGRESS", PHP_INI_SYSTEM, OnUpdateStringUnempty, rfc1867_name, zend_apc_globals, apc_globals)
+STD_PHP_INI_ENTRY("apc.rfc1867_freq", "0", PHP_INI_SYSTEM, OnUpdateRfc1867Freq, rfc1867_freq, zend_apc_globals, apc_globals)
-+STD_PHP_INI_ENTRY("apc.rfc1867_ttl", "3600", PHP_INI_SYSTEM, OnUpdateInt, rfc1867_ttl, zend_apc_globals, apc_globals)
++STD_PHP_INI_ENTRY("apc.rfc1867_ttl", "3600", PHP_INI_SYSTEM, OnUpdateLong, rfc1867_ttl, zend_apc_globals, apc_globals)
+#endif
+STD_PHP_INI_BOOLEAN("apc.coredump_unmap", "0", PHP_INI_SYSTEM, OnUpdateBool, coredump_unmap, zend_apc_globals, apc_globals)
+STD_PHP_INI_ENTRY("apc.preload_path", (char*)NULL, PHP_INI_SYSTEM, OnUpdateString, preload_path, zend_apc_globals, apc_globals)
+ 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);
++#ifdef __DEBUG_APC__
++ php_info_print_table_row(2, "APC Debugging", "Enabled");
++#else
++ php_info_print_table_row(2, "APC Debugging", "Disabled");
++#endif
+#if APC_MMAP
+ php_info_print_table_row(2, "MMAP Support", "Enabled");
+ php_info_print_table_row(2, "MMAP File Mask", APCG(mmap_file_mask));
+ 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: 286798 $");
++ php_info_print_table_row(2, "Revision", "$Revision: 303642 $");
+ php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
+ php_info_print_table_end();
+ DISPLAY_INI_ENTRIES();
+ php_apc_shutdown_globals(&apc_globals);
+#endif
+#if HAVE_SIGACTION
-+ apc_shutdown_signals();
++ apc_shutdown_signals(TSRMLS_C);
+#endif
+ }
+#ifdef ZTS
+
+ if(ZEND_NUM_ARGS()) {
+ if(!strcasecmp(cache_type,"user")) {
-+ info = apc_cache_info(apc_user_cache, limited);
++ info = apc_cache_info(apc_user_cache, limited TSRMLS_CC);
+ } else if(!strcasecmp(cache_type,"filehits")) {
+#ifdef APC_FILEHITS
+ RETVAL_ZVAL(APCG(filehits), 1, 0);
+ RETURN_FALSE;
+#endif
+ } else {
-+ info = apc_cache_info(apc_cache, limited);
++ info = apc_cache_info(apc_cache, limited TSRMLS_CC);
+ }
-+ } else info = apc_cache_info(apc_cache, limited);
++ } else {
++ info = apc_cache_info(apc_cache, limited TSRMLS_CC);
++ }
+
+ if(!info) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No APC info available. Perhaps APC is not enabled? Check apc.enabled in your ini file");
+ add_assoc_stringl(return_value, "locking_type", "file", sizeof("file")-1, 1);
+#endif
+ if(limited) {
-+ apc_cache_free_info(info);
++ apc_cache_free_info(info TSRMLS_CC);
+ return;
+ }
+
+
+ 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);
+
+ 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_zval(return_value, "deleted_list", list);
+
-+ apc_cache_free_info(info);
++ apc_cache_free_info(info TSRMLS_CC);
+}
+/* }}} */
+
+
+ if(ct_len) {
+ if(!strcasecmp(cache_type, "user")) {
-+ apc_cache_clear(apc_user_cache);
++ apc_cache_clear(apc_user_cache TSRMLS_CC);
+ RETURN_TRUE;
+ }
+ }
-+ apc_cache_clear(apc_cache);
++ apc_cache_clear(apc_cache TSRMLS_CC);
+ RETURN_TRUE;
+}
+/* }}} */
+ return;
+ }
+
-+ info = apc_sma_info(limited);
++ info = apc_sma_info(limited TSRMLS_CC);
+
+ if(!info) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No APC SMA info available. Perhaps APC is disabled via apc.enabled?");
+ add_assoc_double(return_value, "avail_mem", (double)apc_sma_get_avail_mem());
+
+ if(limited) {
-+ apc_sma_free_info(info);
++ apc_sma_free_info(info TSRMLS_CC);
+ return;
+ }
+
+ add_next_index_zval(block_lists, list);
+ }
+ add_assoc_zval(return_value, "block_lists", block_lists);
-+ apc_sma_free_info(info);
++ apc_sma_free_info(info TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ */
+int _apc_update(char *strkey, int strkey_len, apc_cache_updater_t updater, void* data TSRMLS_DC)
+{
-+ if(!APCG(enabled)) {
-+ return 0;
-+ }
++ if(!APCG(enabled)) {
++ return 0;
++ }
+
+ HANDLE_BLOCK_INTERRUPTIONS();
+ APCG(current_cache) = apc_user_cache;
+
+ APCG(current_cache) = apc_user_cache;
+
-+ ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect);
++ ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
+ if (!ctxt.pool) {
-+ apc_wprint("Unable to allocate memory for pool.");
++ apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+ return 0;
+ }
+ ctxt.copy = APC_COPY_IN_USER;
+ goto freepool;
+ }
+
-+ if (apc_cache_is_last_key(apc_user_cache, &key, t)) {
++ if (apc_cache_is_last_key(apc_user_cache, &key, 0, t TSRMLS_CC)) {
+ goto freepool;
+ }
+
-+ if (!(entry = apc_cache_make_user_entry(strkey, strkey_len, val, &ctxt, ttl))) {
++ if (!(entry = apc_cache_make_user_entry(strkey, strkey_len, val, &ctxt, ttl TSRMLS_CC))) {
+ goto freepool;
+ }
+
+ if (!apc_cache_user_insert(apc_user_cache, key, entry, &ctxt, t, exclusive TSRMLS_CC)) {
+freepool:
-+ apc_pool_destroy(ctxt.pool);
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
+ ret = 0;
+ }
+
+ while(zend_hash_get_current_data_ex(hash, (void**)&hentry, &hpos) == SUCCESS) {
+ zend_hash_get_current_key_ex(hash, &hkey, &hkey_len, &hkey_idx, 0, &hpos);
+ if (hkey) {
-+ /* hkey_len - 1 for consistency, because it includes '\0', while Z_STRLEN_P() doesn't */
-+ if(!_apc_store(hkey, hkey_len - 1, *hentry, (unsigned int)ttl, exclusive TSRMLS_CC)) {
++ if(!_apc_store(hkey, hkey_len, *hentry, (unsigned int)ttl, exclusive TSRMLS_CC)) {
+ add_assoc_long_ex(return_value, hkey, hkey_len, -1); /* -1: insertion error */
+ }
+ hkey = NULL;
+ return;
+ } else if (Z_TYPE_P(key) == IS_STRING) {
+ if (!val) RETURN_FALSE;
-+ if(_apc_store(Z_STRVAL_P(key), Z_STRLEN_P(key), val, (unsigned int)ttl, exclusive TSRMLS_CC))
++ if(_apc_store(Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, val, (unsigned int)ttl, exclusive TSRMLS_CC))
+ RETURN_TRUE;
+ } else {
-+ apc_wprint("apc_store expects key parameter to be a string or an array of key/value pairs.");
++ apc_warning("apc_store expects key parameter to be a string or an array of key/value pairs." TSRMLS_CC);
+ }
+
+ RETURN_FALSE;
+ int strkey_len;
+ apc_cache_entry_t* entry;
+ time_t t;
-+ apc_context_t ctxt = {0,};
++ apc_context_t ctxt = {0,};
++
++ if(!APCG(enabled)) RETURN_FALSE;
++
++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &key, &success) == FAILURE) {
++ return;
++ }
++
++ t = apc_time();
++
++ if (success) {
++ ZVAL_BOOL(success, 0);
++ }
++
++ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, NULL, NULL TSRMLS_CC);
++ if (!ctxt.pool) {
++ apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
++ RETURN_FALSE;
++ }
++ ctxt.copy = APC_COPY_OUT_USER;
++ ctxt.force_update = 0;
++
++ if(Z_TYPE_P(key) != IS_STRING && Z_TYPE_P(key) != IS_ARRAY) {
++ convert_to_string(key);
++ }
++
++ if(Z_TYPE_P(key) == IS_STRING) {
++ strkey = Z_STRVAL_P(key);
++ strkey_len = Z_STRLEN_P(key);
++ if(!strkey_len) RETURN_FALSE;
++ entry = apc_cache_user_find(apc_user_cache, strkey, (strkey_len + 1), t TSRMLS_CC);
++ if(entry) {
++ /* deep-copy returned shm zval to emalloc'ed return_value */
++ apc_cache_fetch_zval(return_value, entry->data.user.val, &ctxt TSRMLS_CC);
++ apc_cache_release(apc_user_cache, entry TSRMLS_CC);
++ } else {
++ goto freepool;
++ }
++ } else if(Z_TYPE_P(key) == IS_ARRAY) {
++ hash = Z_ARRVAL_P(key);
++ MAKE_STD_ZVAL(result);
++ array_init(result);
++ zend_hash_internal_pointer_reset_ex(hash, &hpos);
++ while(zend_hash_get_current_data_ex(hash, (void**)&hentry, &hpos) == SUCCESS) {
++ if(Z_TYPE_PP(hentry) != IS_STRING) {
++ apc_warning("apc_fetch() expects a string or array of strings." TSRMLS_CC);
++ goto freepool;
++ }
++ entry = apc_cache_user_find(apc_user_cache, Z_STRVAL_PP(hentry), (Z_STRLEN_PP(hentry) + 1), t TSRMLS_CC);
++ if(entry) {
++ /* deep-copy returned shm zval to emalloc'ed return_value */
++ MAKE_STD_ZVAL(result_entry);
++ apc_cache_fetch_zval(result_entry, entry->data.user.val, &ctxt TSRMLS_CC);
++ apc_cache_release(apc_user_cache, entry TSRMLS_CC);
++ zend_hash_add(Z_ARRVAL_P(result), Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) +1, &result_entry, sizeof(zval*), NULL);
++ } /* don't set values we didn't find */
++ zend_hash_move_forward_ex(hash, &hpos);
++ }
++ RETVAL_ZVAL(result, 0, 1);
++ } else {
++ apc_warning("apc_fetch() expects a string or array of strings." TSRMLS_CC);
++freepool:
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
++ RETURN_FALSE;
++ }
++
++ if (success) {
++ ZVAL_BOOL(success, 1);
++ }
++
++ apc_pool_destroy(ctxt.pool TSRMLS_CC);
++ return;
++}
++/* }}} */
++
++/* {{{ proto mixed apc_exists(mixed key)
++ */
++PHP_FUNCTION(apc_exists) {
++ zval *key;
++ HashTable *hash;
++ HashPosition hpos;
++ zval **hentry;
++ char *strkey;
++ int strkey_len;
++ apc_cache_entry_t* entry;
++ zval *result;
++ zval *result_entry;
++ time_t t;
+
+ if(!APCG(enabled)) RETURN_FALSE;
+
-+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &key, &success) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &key) == FAILURE) {
+ return;
+ }
+
+ t = apc_time();
+
-+ if (success) {
-+ ZVAL_BOOL(success, 0);
-+ }
-+
-+ ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, NULL, NULL);
-+ if (!ctxt.pool) {
-+ apc_wprint("Unable to allocate memory for pool.");
-+ RETURN_FALSE;
-+ }
-+ ctxt.copy = APC_COPY_OUT_USER;
-+ ctxt.force_update = 0;
-+
+ if(Z_TYPE_P(key) != IS_STRING && Z_TYPE_P(key) != IS_ARRAY) {
+ convert_to_string(key);
+ }
+ strkey = Z_STRVAL_P(key);
+ strkey_len = Z_STRLEN_P(key);
+ if(!strkey_len) RETURN_FALSE;
-+ entry = apc_cache_user_find(apc_user_cache, strkey, strkey_len + 1, t);
++ entry = apc_cache_user_exists(apc_user_cache, strkey, strkey_len + 1, t TSRMLS_CC);
+ if(entry) {
-+ /* deep-copy returned shm zval to emalloc'ed return_value */
-+ apc_cache_fetch_zval(return_value, entry->data.user.val, &ctxt);
-+ apc_cache_release(apc_user_cache, entry);
-+ } else {
-+ goto freepool;
++ RETURN_TRUE;
+ }
+ } else if(Z_TYPE_P(key) == IS_ARRAY) {
+ hash = Z_ARRVAL_P(key);
+ zend_hash_internal_pointer_reset_ex(hash, &hpos);
+ while(zend_hash_get_current_data_ex(hash, (void**)&hentry, &hpos) == SUCCESS) {
+ if(Z_TYPE_PP(hentry) != IS_STRING) {
-+ apc_wprint("apc_fetch() expects a string or array of strings.");
-+ goto freepool;
++ apc_warning("apc_exists() expects a string or array of strings." TSRMLS_CC);
++ RETURN_FALSE;
+ }
-+ entry = apc_cache_user_find(apc_user_cache, Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) + 1, t);
++
++ entry = apc_cache_user_exists(apc_user_cache, Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) + 1, t TSRMLS_CC);
+ if(entry) {
-+ /* deep-copy returned shm zval to emalloc'ed return_value */
+ MAKE_STD_ZVAL(result_entry);
-+ apc_cache_fetch_zval(result_entry, entry->data.user.val, &ctxt);
-+ apc_cache_release(apc_user_cache, entry);
++ ZVAL_BOOL(result_entry, 1);
+ zend_hash_add(Z_ARRVAL_P(result), Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) +1, &result_entry, sizeof(zval*), NULL);
+ } /* don't set values we didn't find */
+ zend_hash_move_forward_ex(hash, &hpos);
+ }
-+ RETVAL_ZVAL(result, 0, 1);
++ RETURN_ZVAL(result, 0, 1);
+ } else {
-+ apc_wprint("apc_fetch() expects a string or array of strings.");
-+freepool:
-+ apc_pool_destroy(ctxt.pool);
-+ RETURN_FALSE;
-+ }
-+
-+ if (success) {
-+ ZVAL_BOOL(success, 1);
++ apc_warning("apc_exists() expects a string or array of strings." TSRMLS_CC);
+ }
+
-+ apc_pool_destroy(ctxt.pool);
-+ return;
++ RETURN_FALSE;
+}
+/* }}} */
+
+
+ if (Z_TYPE_P(keys) == IS_STRING) {
+ if (!Z_STRLEN_P(keys)) RETURN_FALSE;
-+ if(apc_cache_user_delete(apc_user_cache, Z_STRVAL_P(keys), Z_STRLEN_P(keys) + 1)) {
++ if(apc_cache_user_delete(apc_user_cache, Z_STRVAL_P(keys), (Z_STRLEN_P(keys) + 1) TSRMLS_CC)) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ zend_hash_internal_pointer_reset_ex(hash, &hpos);
+ while(zend_hash_get_current_data_ex(hash, (void**)&hentry, &hpos) == SUCCESS) {
+ if(Z_TYPE_PP(hentry) != IS_STRING) {
-+ apc_wprint("apc_delete() expects a string, array of strings, or APCIterator instance.");
++ apc_warning("apc_delete() expects a string, array of strings, or APCIterator instance." TSRMLS_CC);
+ add_next_index_zval(return_value, *hentry);
+ Z_ADDREF_PP(hentry);
-+ } else if(apc_cache_user_delete(apc_user_cache, Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) + 1) != 1) {
++ } else if(apc_cache_user_delete(apc_user_cache, Z_STRVAL_PP(hentry), (Z_STRLEN_PP(hentry) + 1) TSRMLS_CC) != 1) {
+ add_next_index_zval(return_value, *hentry);
+ Z_ADDREF_PP(hentry);
+ }
+ RETURN_FALSE;
+ }
+ } else {
-+ apc_wprint("apc_delete() expects a string, array of strings, or APCIterator instance.");
++ apc_warning("apc_delete() expects a string, array of strings, or APCIterator instance." TSRMLS_CC);
+ }
+}
+/* }}} */
+
+ if (Z_TYPE_P(keys) == IS_STRING) {
+ if (!Z_STRLEN_P(keys)) RETURN_FALSE;
-+ if(apc_cache_delete(apc_cache, Z_STRVAL_P(keys), Z_STRLEN_P(keys) + 1) != 1) {
++ if(apc_cache_delete(apc_cache, Z_STRVAL_P(keys), Z_STRLEN_P(keys) + 1 TSRMLS_CC) != 1) {
+ RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
+ zend_hash_internal_pointer_reset_ex(hash, &hpos);
+ while(zend_hash_get_current_data_ex(hash, (void**)&hentry, &hpos) == SUCCESS) {
+ if(Z_TYPE_PP(hentry) != IS_STRING) {
-+ apc_wprint("apc_delete_file() expects a string, array of strings, or APCIterator instance.");
++ apc_warning("apc_delete_file() expects a string, array of strings, or APCIterator instance." TSRMLS_CC);
+ add_next_index_zval(return_value, *hentry);
+ Z_ADDREF_PP(hentry);
-+ } else if(apc_cache_delete(apc_cache, Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) + 1) != 1) {
++ } else if(apc_cache_delete(apc_cache, Z_STRVAL_PP(hentry), Z_STRLEN_PP(hentry) + 1 TSRMLS_CC) != 1) {
+ add_next_index_zval(return_value, *hentry);
+ Z_ADDREF_PP(hentry);
+ }
+ RETURN_FALSE;
+ }
+ } else {
-+ apc_wprint("apc_delete_file() expects a string, array of strings, or APCIterator instance.");
++ apc_warning("apc_delete_file() expects a string, array of strings, or APCIterator instance." TSRMLS_CC);
+ }
+}
+/* }}} */
+ if(!strkey_len) RETURN_FALSE;
+
+ _apc_define_constants(constants, case_sensitive TSRMLS_CC);
-+ if(_apc_store(strkey, strkey_len, constants, 0, 0 TSRMLS_CC)) RETURN_TRUE;
++ if(_apc_store(strkey, strkey_len + 1, constants, 0, 0 TSRMLS_CC)) RETURN_TRUE;
+ RETURN_FALSE;
+} /* }}} */
+
+
+ t = apc_time();
+
-+ entry = apc_cache_user_find(apc_user_cache, strkey, strkey_len + 1, t);
++ entry = apc_cache_user_find(apc_user_cache, strkey, (strkey_len + 1), t TSRMLS_CC);
+
+ if(entry) {
+ _apc_define_constants(entry->data.user.val, case_sensitive TSRMLS_CC);
-+ apc_cache_release(apc_user_cache, entry);
++ apc_cache_release(apc_user_cache, entry TSRMLS_CC);
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+
+ if (Z_TYPE_P(file) != IS_ARRAY && Z_TYPE_P(file) != IS_STRING) {
-+ apc_wprint("apc_compile_file argument must be a string or an array of strings");
++ apc_warning("apc_compile_file argument must be a string or an array of strings" TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ EG(current_execute_data) = orig_current_execute_data;
+ EG(in_execution) = 1;
+ CG(unclean_shutdown) = 0;
-+ apc_wprint("Error compiling %s in apc_compile_file.", file_handle.filename);
++ apc_warning("Error compiling %s in apc_compile_file." TSRMLS_CC, file_handle.filename);
+ op_array = NULL;
+ } zend_end_try();
+ if(op_array != NULL) {
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(file), &hpos);
+ while(zend_hash_get_current_data_ex(Z_ARRVAL_P(file), (void**)&hentry, &hpos) == SUCCESS) {
+ if (Z_TYPE_PP(hentry) != IS_STRING) {
-+ apc_wprint("apc_compile_file array values must be strings, aborting.");
++ apc_warning("apc_compile_file array values must be strings, aborting." TSRMLS_CC);
+ break;
+ }
+ file_handle.type = ZEND_HANDLE_FILENAME;
+
+ if (!apc_cache_make_file_key(&(keys[i]), file_handle.filename, PG(include_path), t TSRMLS_CC)) {
+ add_assoc_long(return_value, Z_STRVAL_PP(hentry), -1); /* -1: compilation error */
-+ apc_wprint("Error compiling %s in apc_compile_file.", file_handle.filename);
++ apc_warning("Error compiling %s in apc_compile_file." TSRMLS_CC, file_handle.filename);
+ break;
+ }
+
+ op_arrays[i] = NULL;
+ cache_entries[i] = NULL;
+ add_assoc_long(return_value, Z_STRVAL_PP(hentry), -2); /* -2: input or cache insertion error */
-+ apc_wprint("Error compiling %s in apc_compile_file.", file_handle.filename);
++ apc_warning("Error compiling %s in apc_compile_file." TSRMLS_CC, file_handle.filename);
+ }
+ } zend_catch {
+ EG(current_execute_data) = orig_current_execute_data;
+ op_arrays[i] = NULL;
+ cache_entries[i] = NULL;
+ add_assoc_long(return_value, Z_STRVAL_PP(hentry), -1); /* -1: compilation error */
-+ apc_wprint("Error compiling %s in apc_compile_file.", file_handle.filename);
++ apc_warning("Error compiling %s in apc_compile_file." TSRMLS_CC, file_handle.filename);
+ } zend_end_try();
+
+ zend_destroy_file_handle(&file_handle TSRMLS_CC);
+ ctxt.copy = APC_COPY_IN_OPCODE;
+ ctxt.force_update = 1;
+ if (count == i || !atomic) {
-+ rval = apc_cache_insert_mult(apc_cache, keys, cache_entries, &ctxt, t, i);
++ rval = apc_cache_insert_mult(apc_cache, keys, cache_entries, &ctxt, t, i TSRMLS_CC);
+ atomic_fail = 0;
+ } else {
+ atomic_fail = 1;
+ if (rval && rval[c] != 1) {
+ add_assoc_long(return_value, Z_STRVAL_PP(hentry), -2); /* -2: input or cache insertion error */
+ if (cache_entries[c]) {
-+ apc_pool_destroy(cache_entries[c]->pool);
++ apc_pool_destroy(cache_entries[c]->pool TSRMLS_CC);
+ }
+ }
+ if (op_arrays[c]) {
+ efree(op_arrays[c]);
+ }
+ if (atomic_fail && cache_entries[c]) {
-+ apc_pool_destroy(cache_entries[c]->pool);
++ apc_pool_destroy(cache_entries[c]->pool TSRMLS_CC);
+ }
+ if (keys[c].type == APC_CACHE_KEY_FPFILE) {
+ efree((void*)keys[c].data.fpfile.fullpath);
+ */
+PHP_FUNCTION(apc_bin_dump) {
+
-+ zval *z_files, *z_user_vars;
++ zval *z_files = NULL, *z_user_vars = NULL;
+ HashTable *h_files, *h_user_vars;
+ apc_bd_t *bd;
+
+ if(!APCG(enabled)) {
-+ apc_wprint("APC is not enabled, apc_bin_dump not available.");
++ apc_warning("APC is not enabled, apc_bin_dump not available." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ if(bd) {
+ RETVAL_STRINGL((char*)bd, bd->size-1, 0);
+ } else {
-+ apc_eprint("Unkown error encounterd during apc_bin_dump.");
++ apc_error("Unknown error encountered during apc_bin_dump." TSRMLS_CC);
+ RETVAL_NULL();
+ }
+
+ */
+PHP_FUNCTION(apc_bin_dumpfile) {
+
-+ zval *z_files, *z_user_vars;
++ zval *z_files = NULL, *z_user_vars = NULL;
+ HashTable *h_files, *h_user_vars;
-+ char *filename;
++ char *filename = NULL;
+ int filename_len;
+ long flags=0;
+ zval *zcontext = NULL;
+ apc_bd_t *bd;
+
+ if(!APCG(enabled)) {
-+ apc_wprint("APC is not enabled, apc_bin_dumpfile not available.");
++ apc_warning("APC is not enabled, apc_bin_dumpfile not available." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ }
+
+ if(!filename_len) {
-+ apc_eprint("apc_bin_dumpfile filename argument must be a valid filename.");
++ apc_error("apc_bin_dumpfile filename argument must be a valid filename." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ h_user_vars = z_user_vars ? Z_ARRVAL_P(z_user_vars) : NULL;
+ bd = apc_bin_dump(h_files, h_user_vars TSRMLS_CC);
+ if(!bd) {
-+ apc_eprint("Unkown error uncountered during apc binary dump.");
++ apc_error("Unknown error encountered during apc_bin_dumpfile." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
+ if (stream == NULL) {
+ efree(bd);
-+ apc_eprint("Unable to write to file in apc_bin_dumpfile.");
++ apc_error("Unable to write to file in apc_bin_dumpfile." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ if (flags & LOCK_EX && php_stream_lock(stream, LOCK_EX)) {
+ php_stream_close(stream);
+ efree(bd);
-+ apc_eprint("Unable to get a lock on file in apc_bin_dumpfile.");
++ apc_error("Unable to get a lock on file in apc_bin_dumpfile." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ efree(bd);
+
+ if(numbytes < 0) {
-+ apc_wprint("Only %d of %d bytes written, possibly out of free disk space", numbytes, bd->size);
++ apc_error("Only %d of %d bytes written, possibly out of free disk space" TSRMLS_CC, numbytes, bd->size);
+ RETURN_FALSE;
+ }
+
+ long flags = 0;
+
+ if(!APCG(enabled)) {
-+ apc_wprint("APC is not enabled, apc_bin_load not available.");
++ apc_warning("APC is not enabled, apc_bin_load not available." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ }
+
+ if(!data_len || data_len != ((apc_bd_t*)data)->size -1) {
-+ apc_eprint("apc_bin_load string argument does not appear to be a valid APC binary dump due to size (%d vs expected %d).", data_len, ((apc_bd_t*)data)->size -1);
++ apc_error("apc_bin_load string argument does not appear to be a valid APC binary dump due to size (%d vs expected %d)." TSRMLS_CC, data_len, ((apc_bd_t*)data)->size -1);
+ RETURN_FALSE;
+ }
+
+ int len;
+
+ if(!APCG(enabled)) {
-+ apc_wprint("APC is not enabled, apc_bin_loadfile not available.");
++ apc_warning("APC is not enabled, apc_bin_loadfile not available." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ }
+
+ if(!filename_len) {
-+ apc_eprint("apc_bin_loadfile filename argument must be a valid filename.");
++ apc_error("apc_bin_loadfile filename argument must be a valid filename." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ stream = php_stream_open_wrapper_ex(filename, "rb",
+ ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
+ if (!stream) {
-+ apc_eprint("Unable to read from file in apc_bin_loadfile.");
++ apc_error("Unable to read from file in apc_bin_loadfile." TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
+ len = php_stream_copy_to_mem(stream, &data, PHP_STREAM_COPY_ALL, 0);
+ if(len == 0) {
-+ apc_wprint("File passed to apc_bin_loadfile was empty: %s.", filename);
++ apc_warning("File passed to apc_bin_loadfile was empty: %s." TSRMLS_CC, filename);
+ RETURN_FALSE;
+ } else if(len < 0) {
-+ apc_wprint("Error reading file passed to apc_bin_loadfile: %s.", filename);
++ apc_warning("Error reading file passed to apc_bin_loadfile: %s." TSRMLS_CC, filename);
+ RETURN_FALSE;
+ } else if(len != ((apc_bd_t*)data)->size) {
-+ apc_wprint("file passed to apc_bin_loadfile does not appear to be valid due to size (%d vs expected %d).", len, ((apc_bd_t*)data)->size -1);
++ apc_warning("file passed to apc_bin_loadfile does not appear to be valid due to size (%d vs expected %d)." TSRMLS_CC, len, ((apc_bd_t*)data)->size -1);
+ RETURN_FALSE;
+ }
+ php_stream_close(stream);
+ZEND_END_ARG_INFO()
+
+PHP_APC_ARGINFO
++ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_sma_info, 0, 0, 0)
++ ZEND_ARG_INFO(0, limited)
++ZEND_END_ARG_INFO()
++
++PHP_APC_ARGINFO
+ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_cache_info, 0, 0, 0)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, limited)
+ ZEND_ARG_INFO(0, context)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO()
++
++PHP_APC_ARGINFO
++ZEND_BEGIN_ARG_INFO(arginfo_apc_exists, 0)
++ ZEND_ARG_INFO(0, keys)
++ZEND_END_ARG_INFO()
+/* }}} */
+
+/* {{{ apc_functions[] */
-+function_entry apc_functions[] = {
++zend_function_entry apc_functions[] = {
+ PHP_FE(apc_cache_info, arginfo_apc_cache_info)
+ PHP_FE(apc_clear_cache, arginfo_apc_clear_cache)
-+ PHP_FE(apc_sma_info, arginfo_apc_clear_cache)
++ PHP_FE(apc_sma_info, arginfo_apc_sma_info)
+ PHP_FE(apc_store, arginfo_apc_store)
+ PHP_FE(apc_fetch, arginfo_apc_fetch)
+ PHP_FE(apc_delete, arginfo_apc_delete)
+ PHP_FE(apc_bin_load, arginfo_apc_bin_load)
+ PHP_FE(apc_bin_dumpfile, arginfo_apc_bin_dumpfile)
+ PHP_FE(apc_bin_loadfile, arginfo_apc_bin_loadfile)
++ PHP_FE(apc_exists, arginfo_apc_exists)
+ {NULL, NULL, NULL}
+};
+/* }}} */
+ * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: expandtab sw=4 ts=4 sts=4
+ */
-diff -Naur php-5.3.1.orig/ext/apc/php_apc.h php-5.3.1/ext/apc/php_apc.h
---- php-5.3.1.orig/ext/apc/php_apc.h 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/php_apc.h 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/php_apc.h
@@ -0,0 +1,54 @@
+/*
+ +----------------------------------------------------------------------+
+ | APC |
+ +----------------------------------------------------------------------+
-+ | Copyright (c) 2006-2008 The PHP Group |
++ | Copyright (c) 2006-2010 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 287286 2009-08-14 10:50:22Z gopalv $ */
++/* $Id: php_apc.h 305846 2010-11-30 09:36:57Z gopalv $ */
+
+#ifndef PHP_APC_H
+#define PHP_APC_H
+#include "apc_php.h"
+#include "apc_globals.h"
+
-+#define PHP_APC_VERSION "3.1.3p1"
++#define PHP_APC_VERSION "3.1.6"
+
+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
+ */
-diff -Naur php-5.3.1.orig/ext/apc/TECHNOTES.txt php-5.3.1/ext/apc/TECHNOTES.txt
---- php-5.3.1.orig/ext/apc/TECHNOTES.txt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/TECHNOTES.txt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/TECHNOTES.txt
@@ -0,0 +1,361 @@
+APC Quick-Start Braindump
+
+ symlinks and get rid of relative path components. By using the device+inode we
+ can uniquely identify a file with a single stat.
+
-+ So, on an insert we find the array position in the slots array by hasing the device+inode.
++ So, on an insert we find the array position in the slots array by hashing the device+inode.
+ If there are currently no other slots there, we just create the slot and stick it into
+ the array:
+
+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.
+
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_001.phpt php-5.3.1/ext/apc/tests/apc_001.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_001.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_001.phpt 1970-01-01 10:14:21.000000000 +0100
-@@ -0,0 +1,27 @@
+--- /dev/null
++++ b/ext/apc/tests/apc_001.phpt
+@@ -0,0 +1,32 @@
+--TEST--
+APC: apc_store/fetch with strings
+--SKIPIF--
+$bar = 'nice';
+var_dump($bar);
+
++apc_store('foo\x00bar', $foo);
++$bar = apc_fetch('foo\x00bar');
++var_dump($bar);
++
+?>
+===DONE===
+<?php exit(0); ?>
+string(11) "hello world"
+string(11) "hello world"
+string(4) "nice"
++string(11) "hello world"
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_002.phpt php-5.3.1/ext/apc/tests/apc_002.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_002.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_002.phpt 1970-01-01 10:14:21.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_002.phpt
@@ -0,0 +1,34 @@
+--TEST--
+APC: apc_store/fetch with objects
+ bool(true)
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_003b.phpt php-5.3.1/ext/apc/tests/apc_003b.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_003b.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_003b.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_003b.phpt
@@ -0,0 +1,117 @@
+--TEST--
+APC: apc_store/fetch with objects (php 5.3)
+ bool(true)
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_003.phpt php-5.3.1/ext/apc/tests/apc_003.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_003.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_003.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_003.phpt
@@ -0,0 +1,117 @@
+--TEST--
+APC: apc_store/fetch with objects (php pre-5.3)
+ bool(true)
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_004.phpt php-5.3.1/ext/apc/tests/apc_004.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_004.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_004.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_004.phpt
@@ -0,0 +1,38 @@
+--TEST--
+APC: apc_store/fetch with bools
+bool(false)
+bool(false)
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_005.phpt php-5.3.1/ext/apc/tests/apc_005.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_005.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_005.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_005.phpt
@@ -0,0 +1,50 @@
+--TEST--
+APC: apc_store/fetch with arrays of objects
+ }
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_006.phpt php-5.3.1/ext/apc/tests/apc_006.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_006.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_006.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_006.phpt
@@ -0,0 +1,72 @@
+--TEST--
+APC: apc_store/fetch reference test
+ }
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_007.phpt php-5.3.1/ext/apc/tests/apc_007.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_007.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_007.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_007.phpt
@@ -0,0 +1,46 @@
+--TEST--
+APC: apc_inc/apc_dec test
+$foobar -= 1 = 2
+pass by ref success 1
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_008.phpt php-5.3.1/ext/apc/tests/apc_008.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_008.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_008.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_008.phpt
@@ -0,0 +1,34 @@
+--TEST--
+APC: apc_cas test
+$perfection == 2 ? 1 : 2 = epic fail
+$foobar = 1
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_009.phpt php-5.3.1/ext/apc/tests/apc_009.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_009.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_009.phpt 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,94 @@
+--- /dev/null
++++ b/ext/apc/tests/apc_009.phpt
+@@ -0,0 +1,97 @@
+--TEST--
+APC: apc_delete_file test
+--SKIPIF--
+apc.enabled=1
+apc.enable_cli=1
+apc.file_update_protection=0
++apc.stat=On
+report_memleaks=0
+--FILE--
+<?php
+apc_009-1.php Found File
+
+Parse error: syntax error, unexpected '!' in %s/apc_009-2.php on line 1
-+[%s] [apc-warning] Error compiling apc_009-2.php in apc_compile_file. %s
-+[%s] [apc-warning] Error compiling nofile.php in apc_compile_file. %s
++
++Warning: apc_compile_file(): Error compiling apc_009-2.php in apc_compile_file. in %s/apc_009.php on line 29
++
++Warning: apc_compile_file(): Error compiling nofile.php in apc_compile_file. in %s/apc_009.php on line 29
+array(2) {
+ ["apc_009-2.php"]=>
+ int(-1)
+apc_009-2.php Not Found
+nofile.php Not Found
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_010.phpt php-5.3.1/ext/apc/tests/apc_010.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_010.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_010.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_010.phpt
@@ -0,0 +1,83 @@
+--TEST--
+APC: apc_store/fetch/add with array of key/value pairs.
+ int(4)
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc53_001.phpt php-5.3.1/ext/apc/tests/apc53_001.phpt
---- php-5.3.1.orig/ext/apc/tests/apc53_001.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc53_001.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc53_001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+APC: classes with namespaces (php 5.3)
+ string(11) "hello world"
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc53_002.phpt php-5.3.1/ext/apc/tests/apc53_002.phpt
---- php-5.3.1.orig/ext/apc/tests/apc53_002.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc53_002.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc53_002.phpt
@@ -0,0 +1,47 @@
+--TEST--
+APC: global spaces (php 5.3)
+}
+string(8) "IT WORKS"
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc53_003.phpt php-5.3.1/ext/apc/tests/apc53_003.phpt
---- php-5.3.1.orig/ext/apc/tests/apc53_003.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc53_003.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc53_003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+APC: anonymous functions (php 5.3)
+Hello World
+Hello PHP
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc53_004.phpt php-5.3.1/ext/apc/tests/apc53_004.phpt
---- php-5.3.1.orig/ext/apc/tests/apc53_004.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc53_004.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc53_004.phpt
@@ -0,0 +1,33 @@
+--TEST--
+APC: closures (php 5.3)
+double of 9 is 18
+triple of 4 is 12
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc53_005.phpt php-5.3.1/ext/apc/tests/apc53_005.phpt
---- php-5.3.1.orig/ext/apc/tests/apc53_005.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc53_005.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc53_005.phpt
@@ -0,0 +1,35 @@
+--TEST--
+APC: goto (php 5.3)
+8
+10
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_bin_001.phpt php-5.3.1/ext/apc/tests/apc_bin_001.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_bin_001.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_bin_001.phpt 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,23 @@
+--- /dev/null
++++ b/ext/apc/tests/apc_bin_001.phpt
+@@ -0,0 +1,24 @@
+--TEST--
+APC: bindump user cache
+--SKIPIF--
+<?php
+apc_clear_cache('file');
+apc_store('testkey','testvalue');
++apc_bin_dump();
+$dump = apc_bin_dump(array(), NULL);
+apc_clear_cache('user');
+var_dump(apc_fetch('testkey'));
+bool(false)
+string(9) "testvalue"
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_bin_002-1.inc php-5.3.1/ext/apc/tests/apc_bin_002-1.inc
---- php-5.3.1.orig/ext/apc/tests/apc_bin_002-1.inc 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_bin_002-1.inc 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_bin_002-1.inc
@@ -0,0 +1,42 @@
+<?php
+
+ function dummy() { return 1; }
+}
+
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_bin_002-2.inc php-5.3.1/ext/apc/tests/apc_bin_002-2.inc
---- php-5.3.1.orig/ext/apc/tests/apc_bin_002-2.inc 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_bin_002-2.inc 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_bin_002-2.inc
@@ -0,0 +1,5 @@
+<?php
+
+echo "Failed to use cached version!\n";
+
+?>
-diff -Naur php-5.3.1.orig/ext/apc/tests/apc_bin_002.phpt php-5.3.1/ext/apc/tests/apc_bin_002.phpt
---- php-5.3.1.orig/ext/apc/tests/apc_bin_002.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/apc_bin_002.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/apc_bin_002.phpt
@@ -0,0 +1,53 @@
+--TEST--
+APC: bindump file cache part 1
+inherited class constant: Success
+
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_001.phpt php-5.3.1/ext/apc/tests/iterator_001.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_001.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_001.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_001.phpt
@@ -0,0 +1,110 @@
+--TEST--
+APC: APCIterator general
+ string(4) "key9"
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_002.phpt php-5.3.1/ext/apc/tests/iterator_002.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_002.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_002.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+APC: APCIterator regex
+ string(5) "key40"
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_003.phpt php-5.3.1/ext/apc/tests/iterator_003.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_003.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_003.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_003.phpt
@@ -0,0 +1,110 @@
+--TEST--
+APC: APCIterator chunk size
+ string(4) "key9"
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_004.phpt php-5.3.1/ext/apc/tests/iterator_004.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_004.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_004.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_004.phpt
@@ -0,0 +1,36 @@
+--TEST--
+APC: APCIterator regex & chunk size & list
+ string(5) "key40"
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_005.phpt php-5.3.1/ext/apc/tests/iterator_005.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_005.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_005.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_005.phpt
@@ -0,0 +1,112 @@
+--TEST--
+APC: APCIterator delete
+ string(4) "key9"
+}
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_006.phpt php-5.3.1/ext/apc/tests/iterator_006.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_006.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_006.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_006.phpt
@@ -0,0 +1,1535 @@
+--TEST--
+APC: APCIterator formats
+--EXPECTF--
+IT #0
+============================
++string(5) "key10"
++array(1) {
++ ["type"]=>
++ string(4) "user"
++}
+string(4) "key0"
+array(1) {
+ ["type"]=>
+ ["type"]=>
+ string(4) "user"
+}
-+string(5) "key10"
-+array(1) {
-+ ["type"]=>
-+ string(4) "user"
-+}
+============================
+
+IT #1
+============================
++string(5) "key10"
++array(1) {
++ ["key"]=>
++ string(5) "key10"
++}
+string(4) "key0"
+array(1) {
+ ["key"]=>
+ ["key"]=>
+ string(4) "key9"
+}
-+string(5) "key10"
-+array(1) {
-+ ["key"]=>
-+ string(5) "key10"
-+}
+============================
+
+IT #2
+============================
++string(5) "key10"
++array(0) {
++}
+string(4) "key0"
+array(0) {
+}
+string(4) "key9"
+array(0) {
+}
-+string(5) "key10"
-+array(0) {
-+}
+============================
+
+IT #3
+============================
++string(5) "key10"
++array(0) {
++}
+string(4) "key0"
+array(0) {
+}
+string(4) "key9"
+array(0) {
+}
-+string(5) "key10"
-+array(0) {
-+}
+============================
+
+IT #4
+============================
++string(5) "key10"
++array(0) {
++}
+string(4) "key0"
+array(0) {
+}
+string(4) "key9"
+array(0) {
+}
-+string(5) "key10"
-+array(0) {
-+}
+============================
+
+IT #5
+============================
++string(5) "key10"
++array(1) {
++ ["value"]=>
++ string(7) "value10"
++}
+string(4) "key0"
+array(1) {
+ ["value"]=>
+ ["value"]=>
+ string(6) "value9"
+}
-+string(5) "key10"
-+array(1) {
-+ ["value"]=>
-+ string(7) "value10"
-+}
+============================
+
+IT #6
+============================
++string(5) "key10"
++array(0) {
++}
+string(4) "key0"
+array(0) {
+}
+string(4) "key9"
+array(0) {
+}
-+string(5) "key10"
-+array(0) {
-+}
+============================
+
+IT #7
+============================
++string(5) "key10"
++array(1) {
++ ["num_hits"]=>
++ int(0)
++}
+string(4) "key0"
+array(1) {
+ ["num_hits"]=>
+ ["num_hits"]=>
+ int(0)
+}
-+string(5) "key10"
-+array(1) {
-+ ["num_hits"]=>
-+ int(0)
-+}
+============================
+
+IT #8
+============================
++string(5) "key10"
++array(1) {
++ ["mtime"]=>
++ int(%d)
++}
+string(4) "key0"
+array(1) {
+ ["mtime"]=>
+ ["mtime"]=>
+ int(%d)
+}
-+string(5) "key10"
-+array(1) {
-+ ["mtime"]=>
-+ int(%d)
-+}
+============================
+
+IT #9
+============================
++string(5) "key10"
++array(1) {
++ ["creation_time"]=>
++ int(%d)
++}
+string(4) "key0"
+array(1) {
+ ["creation_time"]=>
+ ["creation_time"]=>
+ int(%d)
+}
-+string(5) "key10"
-+array(1) {
-+ ["creation_time"]=>
-+ int(%d)
-+}
+============================
+
+IT #10
+============================
++string(5) "key10"
++array(1) {
++ ["deletion_time"]=>
++ int(0)
++}
+string(4) "key0"
+array(1) {
+ ["deletion_time"]=>
+ ["deletion_time"]=>
+ int(0)
+}
-+string(5) "key10"
-+array(1) {
-+ ["deletion_time"]=>
-+ int(0)
-+}
+============================
+
+IT #11
+============================
++string(5) "key10"
++array(1) {
++ ["access_time"]=>
++ int(%d)
++}
+string(4) "key0"
+array(1) {
+ ["access_time"]=>
+ ["access_time"]=>
+ int(%d)
+}
-+string(5) "key10"
-+array(1) {
-+ ["access_time"]=>
-+ int(%d)
-+}
+============================
+
+IT #12
+============================
++string(5) "key10"
++array(1) {
++ ["ref_count"]=>
++ int(0)
++}
+string(4) "key0"
+array(1) {
+ ["ref_count"]=>
+ ["ref_count"]=>
+ int(0)
+}
-+string(5) "key10"
-+array(1) {
-+ ["ref_count"]=>
-+ int(0)
-+}
+============================
+
+IT #13
+============================
++string(5) "key10"
++array(1) {
++ ["mem_size"]=>
++ int(%d)
++}
+string(4) "key0"
+array(1) {
+ ["mem_size"]=>
+string(4) "key4"
+array(1) {
+ ["mem_size"]=>
-+ int(580)
++ int(%d)
+}
+string(4) "key5"
+array(1) {
+ ["mem_size"]=>
+ int(%d)
+}
-+string(5) "key10"
-+array(1) {
-+ ["mem_size"]=>
-+ int(%d)
-+}
+============================
+
+IT #14
+============================
++string(5) "key10"
++array(1) {
++ ["ttl"]=>
++ int(0)
++}
+string(4) "key0"
+array(1) {
+ ["ttl"]=>
+ ["ttl"]=>
+ int(0)
+}
-+string(5) "key10"
-+array(1) {
-+ ["ttl"]=>
-+ int(0)
-+}
+============================
+
+IT #15
+============================
++string(5) "key10"
++array(0) {
++}
+string(4) "key0"
+array(0) {
+}
+string(4) "key9"
+array(0) {
+}
-+string(5) "key10"
-+array(0) {
-+}
+============================
+
+IT #16
+============================
++string(5) "key10"
++array(11) {
++ ["type"]=>
++ string(4) "user"
++ ["key"]=>
++ string(5) "key10"
++ ["value"]=>
++ string(7) "value10"
++ ["num_hits"]=>
++ int(0)
++ ["mtime"]=>
++ int(%d)
++ ["creation_time"]=>
++ int(%d)
++ ["deletion_time"]=>
++ int(0)
++ ["access_time"]=>
++ int(%d)
++ ["ref_count"]=>
++ int(0)
++ ["mem_size"]=>
++ int(%d)
++ ["ttl"]=>
++ int(0)
++}
+string(4) "key0"
+array(11) {
+ ["type"]=>
+ ["ttl"]=>
+ int(0)
+}
++============================
++
++IT #17
++============================
+string(5) "key10"
-+array(11) {
++array(10) {
+ ["type"]=>
+ string(4) "user"
+ ["key"]=>
+ int(0)
+ ["mem_size"]=>
+ int(%d)
-+ ["ttl"]=>
-+ int(0)
+}
-+============================
-+
-+IT #17
-+============================
+string(4) "key0"
+array(10) {
+ ["type"]=>
+ ["mem_size"]=>
+ int(%d)
+}
++============================
++
++IT #18
++============================
+string(5) "key10"
-+array(10) {
-+ ["type"]=>
-+ string(4) "user"
++array(3) {
+ ["key"]=>
+ string(5) "key10"
-+ ["value"]=>
-+ string(7) "value10"
+ ["num_hits"]=>
+ int(0)
-+ ["mtime"]=>
-+ int(%d)
-+ ["creation_time"]=>
-+ int(%d)
-+ ["deletion_time"]=>
-+ int(0)
-+ ["access_time"]=>
-+ int(%d)
-+ ["ref_count"]=>
-+ int(0)
+ ["mem_size"]=>
+ int(%d)
+}
-+============================
-+
-+IT #18
-+============================
+string(4) "key0"
+array(3) {
+ ["key"]=>
+ ["mem_size"]=>
+ int(%d)
+}
-+string(5) "key10"
-+array(3) {
-+ ["key"]=>
-+ string(5) "key10"
-+ ["num_hits"]=>
-+ int(0)
-+ ["mem_size"]=>
-+ int(%d)
-+}
+============================
+
+===DONE===
-diff -Naur php-5.3.1.orig/ext/apc/tests/iterator_007.phpt php-5.3.1/ext/apc/tests/iterator_007.phpt
---- php-5.3.1.orig/ext/apc/tests/iterator_007.phpt 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/iterator_007.phpt 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/iterator_007.phpt
@@ -0,0 +1,36 @@
+--TEST--
+APC: APCIterator Overwriting the ctor
+bool(false)
+bool(false)
+
-diff -Naur php-5.3.1.orig/ext/apc/tests/php_5_3_ns.inc php-5.3.1/ext/apc/tests/php_5_3_ns.inc
---- php-5.3.1.orig/ext/apc/tests/php_5_3_ns.inc 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/php_5_3_ns.inc 1970-01-01 10:13:08.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/php_5_3_ns.inc
@@ -0,0 +1,18 @@
+<?php
+namespace Foo\Bar;
+ sort();
+ }
+}
-diff -Naur php-5.3.1.orig/ext/apc/tests/skipif.inc php-5.3.1/ext/apc/tests/skipif.inc
---- php-5.3.1.orig/ext/apc/tests/skipif.inc 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/tests/skipif.inc 1970-01-01 10:14:21.000000000 +0100
+--- /dev/null
++++ b/ext/apc/tests/skipif.inc
@@ -0,0 +1,6 @@
+<?php
+
+//if (!ini_get('apc.enabled')) die("skip apc not enabled");
+
+?>
-diff -Naur php-5.3.1.orig/ext/apc/TODO php-5.3.1/ext/apc/TODO
---- php-5.3.1.orig/ext/apc/TODO 1970-01-01 01:00:00.000000000 +0100
-+++ php-5.3.1/ext/apc/TODO 1970-01-01 10:13:08.000000000 +0100
-@@ -0,0 +1,30 @@
+--- /dev/null
++++ b/ext/apc/TODO
+@@ -0,0 +1,32 @@
+Known Bugs
+
+1. Gallery2 doesn't work with PHP5+APC. There is something wrong
+ in the apc_store() function in php_apc.c but I am wondering if it needs to do more
+ than that.
+
-+Enhancements
++Windows
+
-+1. Some faster platform-specific locking mechanisms wouldd be nice. futex support
-+ for the 2.6 Linux kernels, and/or x86-specific spinlock support.
++1. The following configurations (build arguments) have not been implemented yet
+
-+2. The optimizer needs a lot of work.
++ (*) --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
+
-+3. Assert() elimination in the optimizer when some debug flag somewhere isn't set.
++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