Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
php5-APCu
php5-APCu-remove-bin.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File php5-APCu-remove-bin.patch of Package php5-APCu
Index: apcu-4.0.10/apc_api.h =================================================================== --- apcu-4.0.10.orig/apc_api.h 2015-12-07 10:01:44.000000000 +0100 +++ apcu-4.0.10/apc_api.h 2016-05-24 16:25:41.211854104 +0200 @@ -24,6 +24,5 @@ #include "apc_pool_api.h" #include "apc_sma_api.h" #include "apc_cache_api.h" -#include "apc_bin_api.h" #endif Index: apcu-4.0.10/apc_bin_api.h =================================================================== --- apcu-4.0.10.orig/apc_bin_api.h 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | APC | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2011 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Brian Shire <shire@php.net> | - +----------------------------------------------------------------------+ - - */ - -/* $Id: apc_bin_api.h 328743 2012-12-12 07:58:32Z ab $ */ - -#ifndef APC_BIN_API_H -#define APC_BIN_API_H - -#include "ext/standard/basic_functions.h" - -/* APC binload flags */ -#define APC_BIN_VERIFY_MD5 1 << 0 -#define APC_BIN_VERIFY_CRC32 1 << 1 - -typedef struct _apc_bd_entry_t { - unsigned char type; - uint num_functions; - uint num_classes; - struct { - char* str; - uint len; - } key; - apc_cache_entry_t val; -} apc_bd_entry_t; - -typedef struct _apc_bd_t { - unsigned int size; - int swizzled; - unsigned char md5[16]; - php_uint32 crc; - unsigned int num_entries; - apc_bd_entry_t *entries; - int num_swizzled_ptrs; - void ***swizzled_ptrs; -} apc_bd_t; - -PHP_APCU_API apc_bd_t* apc_bin_dump(apc_cache_t* cache, HashTable *user_vars TSRMLS_DC); -PHP_APCU_API int apc_bin_load(apc_cache_t* cache, apc_bd_t *bd, int flags TSRMLS_DC); - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker - * vim<600: expandtab sw=4 ts=4 sts=4 - */ Index: apcu-4.0.10/apc_bin.c =================================================================== --- apcu-4.0.10.orig/apc_bin.c 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,557 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | APC | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2011 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Brian Shire <shire@php.net> | - | Xinchen Hui <laruence@php.net> | - +----------------------------------------------------------------------+ - - */ - -/* $Id: apc_bin.c 328828 2012-12-18 15:18:39Z remi $ */ - -/* Creates an architecture specific binary output to a string or file containing - * the current cache contents. This is accomplished via the apc_copy_* functions and - * "swizzling" pointers to achieve position independence. - */ - -#include "apc_globals.h" -#include "apc_bin.h" -#include "apc_php.h" -#include "apc_sma.h" -#include "apc_pool.h" -#include "apc_cache.h" - -#include "ext/standard/md5.h" - -/* in apc_cache.c */ -extern zval* apc_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC); - -#define APC_BINDUMP_DEBUG 0 - -#if APC_BINDUMP_DEBUG - -#define SWIZZLE(bd, ptr) \ - do { \ - if((ptrdiff_t)bd < (ptrdiff_t)ptr && (size_t)ptr < ((size_t)bd + bd->size)) { \ - printf("SWIZZLE: %x ~> ", ptr); \ - ptr = (void*)((ptrdiff_t)(ptr) - (ptrdiff_t)(bd)); \ - printf("%x in %s on line %d", ptr, __FILE__, __LINE__); \ - } else if((ptrdiff_t)ptr > bd->size) { /* not swizzled */ \ - apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (ptrdiff_t)bd, ptr, ((size_t)bd + bd->size), __FILE__, __LINE__); \ - return; \ - } \ - printf("\n"); \ - } while(0); - -#define UNSWIZZLE(bd, ptr) \ - do { \ - printf("UNSWIZZLE: %x -> ", ptr); \ - ptr = (void*)((ptrdiff_t)(ptr) + (ptrdiff_t)(bd)); \ - printf("%x in %s on line %d \n", ptr, __FILE__, __LINE__); \ - } while(0); - -#else /* !APC_BINDUMP_DEBUG */ - -#define SWIZZLE(bd, ptr) \ - do { \ - if((ptrdiff_t)bd < (ptrdiff_t)ptr && (size_t)ptr < ((size_t)bd + bd->size)) { \ - ptr = (void*)((ptrdiff_t)(ptr) - (ptrdiff_t)(bd)); \ - } else if((size_t)ptr > bd->size) { /* not swizzled */ \ - apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (ptrdiff_t)bd, ptr, ((size_t)bd + bd->size), __FILE__, __LINE__); \ - return NULL; \ - } \ - } while(0); - -#define UNSWIZZLE(bd, ptr) \ - do { \ - ptr = (void*)((ptrdiff_t)(ptr) + (ptrdiff_t)(bd)); \ - } while(0); - -#endif - -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); - -#if APC_BINDUMP_DEBUG -#define apc_swizzle_ptr(bd, ctxt, ll, ptr) _apc_swizzle_ptr(bd, ctxt, ll, (void*)ptr, __FILE__, __LINE__ TSRMLS_CC) -#else -#define apc_swizzle_ptr(bd, ctxt, ll, ptr) _apc_swizzle_ptr(bd, ctxt, ll, (void*)ptr, NULL, 0 TSRMLS_CC) -#endif - -static void _apc_swizzle_ptr(apc_bd_t *bd, apc_context_t* ctxt, zend_llist *ll, void **ptr, const char* file, int line TSRMLS_DC); -static void apc_swizzle_hashtable(apc_bd_t *bd, apc_context_t* ctxt, zend_llist *ll, HashTable *ht, apc_swizzle_cb_t swizzle_cb, int is_ptr TSRMLS_DC); -static void apc_swizzle_zval(apc_bd_t *bd, apc_context_t* ctxt, zend_llist *ll, zval *zv TSRMLS_DC); - -static apc_bd_t* apc_swizzle_bd(apc_bd_t* bd, zend_llist *ll TSRMLS_DC); -static int apc_unswizzle_bd(apc_bd_t *bd, int flags TSRMLS_DC); - -/* {{{ apc_bd_alloc - * callback for copy_* functions */ -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 TSRMLS_DC) { - size_t *size; - if(zend_hash_index_find(&APCG(apc_bd_alloc_list), (ulong)ptr, (void**)&size) == FAILURE) { - apc_error("apc_bd_free could not free pointer (not found in list: %x)" TSRMLS_CC, ptr); - return; - } - APCG(apc_bd_alloc_ptr) = (void*)((size_t)APCG(apc_bd_alloc_ptr) - *size); - zend_hash_index_del(&APCG(apc_bd_alloc_list), (ulong)ptr); -} /* }}} */ - -/* {{{ apc_bd_alloc_ex - * set ranges or allocate a block of data from an already (e)malloc'd range. - * if ptr_new is not NULL, it will reset the pointer to start at ptr_new, - * 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 TSRMLS_DC) { - void *rval; - - rval = APCG(apc_bd_alloc_ptr); - if(ptr_new != NULL) { /* reset ptrs */ - APCG(apc_bd_alloc_ptr) = ptr_new; - APCG(apc_bd_alloc_ubptr) = (void*)((unsigned char *) ptr_new + size); - } else { /* alloc block */ - APCG(apc_bd_alloc_ptr) = (void*)((size_t)APCG(apc_bd_alloc_ptr) + size); -#if APC_BINDUMP_DEBUG - 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_error("Exceeded bounds check in apc_bd_alloc_ex by %d bytes." TSRMLS_CC, (unsigned char *) APCG(apc_bd_alloc_ptr) - (unsigned char *) APCG(apc_bd_alloc_ubptr)); - return NULL; - } - zend_hash_index_update(&APCG(apc_bd_alloc_list), (ulong)rval, &size, sizeof(size_t), NULL); - } - - return rval; -} /* }}} */ - -/* {{{ _apc_swizzle_ptr */ -static void _apc_swizzle_ptr(apc_bd_t *bd, apc_context_t* ctxt, zend_llist *ll, void **ptr, const char* file, int line TSRMLS_DC) { - if(*ptr) { - if((ptrdiff_t)bd < (ptrdiff_t)*ptr && (size_t)*ptr < ((size_t)bd + bd->size)) { - zend_llist_add_element(ll, &ptr); -#if APC_BINDUMP_DEBUG - printf("[%06d] apc_swizzle_ptr: %x -> %x ", zend_llist_count(ll), ptr, *ptr); - printf(" in %s on line %d \n", file, line); -#endif - } else if((size_t)ptr > bd->size) { - apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (ptrdiff_t)bd, *ptr, ((ptrdiff_t)bd + bd->size), file, line); \ - return; - } - } -} /* }}} */ - -/* {{{ apc_swizzle_hashtable */ -static void apc_swizzle_hashtable(apc_bd_t *bd, apc_context_t* ctxt, zend_llist *ll, HashTable *ht, apc_swizzle_cb_t swizzle_cb, int is_ptr TSRMLS_DC) { - uint i; - Bucket **bp, **bp_prev; - - bp = &ht->pListHead; - while(*bp) { - bp_prev = bp; - bp = &(*bp)->pListNext; - if(is_ptr) { - swizzle_cb(bd, ll, *(void**)(*bp_prev)->pData TSRMLS_CC); - apc_swizzle_ptr(bd, ctxt, ll, (*bp_prev)->pData); - } else { - swizzle_cb(bd, ll, (void**)(*bp_prev)->pData TSRMLS_CC); - } -#ifdef ZEND_ENGINE_2_4 - if ((*bp_prev)->nKeyLength) { - if (IS_INTERNED((*bp_prev)->arKey)) { - /* we should dump that internal string out */ - char *tmp = apc_bd_alloc((*bp_prev)->nKeyLength TSRMLS_CC); - memcpy(tmp, (*bp_prev)->arKey, (*bp_prev)->nKeyLength); - (*bp_prev)->arKey = tmp; - } - apc_swizzle_ptr(bd, ctxt, ll, &(*bp_prev)->arKey); - } -#endif - apc_swizzle_ptr(bd, ctxt, ll, &(*bp_prev)->pData); - if((*bp_prev)->pDataPtr) { - apc_swizzle_ptr(bd, ctxt, ll, &(*bp_prev)->pDataPtr); - } - if((*bp_prev)->pListLast) { - apc_swizzle_ptr(bd, ctxt, ll, &(*bp_prev)->pListLast); - } - if((*bp_prev)->pNext) { - apc_swizzle_ptr(bd, ctxt, ll, &(*bp_prev)->pNext); - } - if((*bp_prev)->pLast) { - apc_swizzle_ptr(bd, ctxt, ll, &(*bp_prev)->pLast); - } - apc_swizzle_ptr(bd, ctxt, ll, bp_prev); - } - for(i=0; i < ht->nTableSize; i++) { - if(ht->arBuckets[i]) { - apc_swizzle_ptr(bd, ctxt, ll, &ht->arBuckets[i]); - } - } - apc_swizzle_ptr(bd, ctxt, ll, &ht->pListTail); - - apc_swizzle_ptr(bd, ctxt, ll, &ht->arBuckets); -} /* }}} */ - -/* {{{ apc_swizzle_zval */ -static void apc_swizzle_zval(apc_bd_t *bd, apc_context_t* ctxt, zend_llist *ll, zval *zv TSRMLS_DC) { - - if(ctxt->copied.nTableSize) { - if(zend_hash_index_exists(&ctxt->copied, (ulong)zv)) { - return; - } - zend_hash_index_update(&ctxt->copied, (ulong)zv, (void**)&zv, sizeof(zval*), NULL); - } - - switch(Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) { - case IS_NULL: - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - case IS_RESOURCE: - /* nothing to do */ - break; - case IS_CONSTANT: - case IS_STRING: - apc_swizzle_ptr(bd, ctxt, ll, &zv->value.str.val); - break; - case IS_ARRAY: - apc_swizzle_hashtable(bd, ctxt, ll, zv->value.ht, (apc_swizzle_cb_t)apc_swizzle_zval, 1 TSRMLS_CC); - apc_swizzle_ptr(bd, ctxt, ll, &zv->value.ht); - break; - case IS_OBJECT: - break; - default: - assert(0); /* shouldn't happen */ - } -} /* }}} */ - -/* {{{ apc_swizzle_bd */ -static apc_bd_t* apc_swizzle_bd(apc_bd_t* bd, zend_llist *ll TSRMLS_DC) { - unsigned int i; - int count; - PHP_MD5_CTX context; - unsigned char digest[16]; - register php_uint32 crc; - void ***ptr; - void ***ptr_list; - - count = zend_llist_count(ll); - ptr_list = emalloc(count * sizeof(void**)); - ptr = zend_llist_get_first(ll); - for(i=0; i < count; i++) { -#if APC_BINDUMP_DEBUG - printf("[%06d] ", i+1); -#endif - SWIZZLE(bd, **ptr); /* swizzle ptr */ - if((ptrdiff_t)bd < (ptrdiff_t)*ptr && (size_t)*ptr < ((size_t)bd + bd->size)) { /* exclude ptrs that aren't actually included in the ptr list */ -#if APC_BINDUMP_DEBUG - printf("[------] "); -#endif - SWIZZLE(bd, *ptr); /* swizzle ptr list */ - ptr_list[i] = *ptr; - } - ptr = zend_llist_get_next(ll); - } - SWIZZLE(bd, bd->entries); - - if(count > 0) { - bd = erealloc(bd, bd->size + (count * sizeof(void**))); - bd->num_swizzled_ptrs = count; - bd->swizzled_ptrs = (void***)((unsigned char *)bd + bd->size -2); /* extra -1 for null termination */ - bd->size += count * sizeof(void**); - memcpy(bd->swizzled_ptrs, ptr_list, count * sizeof(void**)); - SWIZZLE(bd, bd->swizzled_ptrs); - } else { - bd->num_swizzled_ptrs = 0; - bd->swizzled_ptrs = NULL; - } - ((unsigned char*)bd)[((bd->size >= 1) ? (bd->size-1) : 0)] = 0; /* silence null termination for zval strings */ - efree(ptr_list); - bd->swizzled = 1; - - /* Generate MD5/CRC32 checksum */ - memset(bd->md5, 0, 16); - bd->crc=0; - - PHP_MD5Init(&context); - PHP_MD5Update(&context, (const unsigned char*)bd, bd->size); - PHP_MD5Final(digest, &context); - crc = apc_crc32((unsigned char*)bd, bd->size); - - memmove(bd->md5, digest, 16); - bd->crc = crc; - - return bd; -} /* }}} */ - -/* {{{ apc_unswizzle_bd */ -static int apc_unswizzle_bd(apc_bd_t *bd, int flags TSRMLS_DC) { - unsigned int i; - unsigned char md5_orig[16]; - unsigned char digest[16]; - PHP_MD5_CTX context; - register php_uint32 crc; - php_uint32 crc_orig; - - /* Verify the md5 or crc32 before we unswizzle */ - memmove(md5_orig, bd->md5, 16); - memset(bd->md5, 0, 16); - crc_orig = bd->crc; - bd->crc=0; - - if(flags & APC_BIN_VERIFY_MD5) { - PHP_MD5Init(&context); - PHP_MD5Update(&context, (const unsigned char*)bd, bd->size); - PHP_MD5Final(digest, &context); - if(memcmp(md5_orig, digest, 16)) { - apc_error("MD5 checksum of binary dump failed." TSRMLS_CC); - return -1; - } - } - if(flags & APC_BIN_VERIFY_CRC32) { - crc = apc_crc32((unsigned char*)bd, bd->size); - if(crc_orig != crc) { - apc_error("CRC32 checksum of binary dump failed." TSRMLS_CC); - return -1; - } - } - memcpy(bd->md5, md5_orig, 16); /* add back md5 checksum */ - bd->crc = crc_orig; - - UNSWIZZLE(bd, bd->entries); - UNSWIZZLE(bd, bd->swizzled_ptrs); - for(i=0; i < bd->num_swizzled_ptrs; i++) { - if(bd->swizzled_ptrs[i]) { - UNSWIZZLE(bd, bd->swizzled_ptrs[i]); - if(*bd->swizzled_ptrs[i] && (*bd->swizzled_ptrs[i] < (void*)bd)) { - UNSWIZZLE(bd, *bd->swizzled_ptrs[i]); - } - } - } - - bd->swizzled=0; - - return 0; -} /* }}} */ - -/* {{{ apc_bin_checkfilter */ -static int apc_bin_checkfilter(HashTable *filter, const char *key, uint key_len) { - zval **zptr; - - if(filter == NULL) { - return 1; - } - - if(zend_hash_find(filter, (char*)key, key_len, (void**)&zptr) == SUCCESS) { - if(Z_TYPE_PP(zptr) == IS_LONG && Z_LVAL_PP(zptr) == 0) { - return 0; - } - } else { - return 0; - } - - - return 1; -} /* }}} */ - -/* {{{ apc_bin_dump */ -PHP_APCU_API apc_bd_t* apc_bin_dump(apc_cache_t* cache, HashTable *user_vars TSRMLS_DC) { - apc_cache_slot_t *sp; - apc_bd_entry_t *ep; - int i, count=0; - apc_bd_t *bd; - zend_llist ll; - size_t size=0; - apc_context_t ctxt; - void *pool_ptr; - - zend_llist_init(&ll, sizeof(void*), NULL, 0); - zend_hash_init(&APCG(apc_bd_alloc_list), 0, NULL, NULL, 0); - - /* flip the hash for faster filter checking */ - user_vars = apc_flip_hash(user_vars); - - APC_RLOCK(cache->header); - - /* get size and entry counts */ - for(i=0; i < cache->nslots; i++) { - sp = cache->slots[i]; - for(; sp != NULL; sp = sp->next) { - if(apc_bin_checkfilter(user_vars, sp->key.str, sp->key.len)) { - size += sizeof(apc_bd_entry_t*) + sizeof(apc_bd_entry_t); - size += sp->value->mem_size - (sizeof(apc_cache_entry_t)); - count++; - } - } - } - - size += sizeof(apc_bd_t) +1; /* +1 for null termination */ - bd = emalloc(size); - bd->size = (unsigned int)size; - pool_ptr = emalloc(sizeof(apc_pool)); - apc_bd_alloc_ex(pool_ptr, sizeof(apc_pool) TSRMLS_CC); - - ctxt.serializer = cache->serializer; - 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_warning("Unable to allocate memory for pool." TSRMLS_CC); - return NULL; - } - - ctxt.copy = APC_COPY_OTHER; /* avoid stupid ALLOC_ZVAL calls here, hack */ - apc_bd_alloc_ex((void*)((size_t)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 TSRMLS_CC); - - /* User entries */ - zend_hash_init(&ctxt.copied, 0, NULL, NULL, 0); - count = 0; - for(i=0; i < cache->nslots; i++) { - sp = cache->slots[i]; - for(; sp != NULL; sp = sp->next) { - if(apc_bin_checkfilter(user_vars, sp->key.str, sp->key.len)) { - ep = &bd->entries[count]; - - /* copy key with current pool */ - ep->key.str = apc_pmemcpy(sp->key.str, sp->key.len, ctxt.pool TSRMLS_CC); - ep->key.len = sp->key.len; - - if ((Z_TYPE_P(sp->value->val) == IS_ARRAY && cache->serializer) - || Z_TYPE_P(sp->value->val) == IS_OBJECT) { - /* avoiding hash copy, hack */ - uint type = Z_TYPE_P(sp->value->val); - Z_TYPE_P(sp->value->val) = IS_STRING; - ep->val.val = apc_copy_zval(NULL, sp->value->val, &ctxt TSRMLS_CC); - - Z_TYPE_P(ep->val.val) = IS_OBJECT; - sp->value->val->type = type; - } else if (Z_TYPE_P(sp->value->val) == IS_ARRAY && !cache->serializer) { - /* this is a little complicated, we have to unserialize it first, then serialize it again */ - zval *garbage; - ctxt.copy = APC_COPY_OUT; - garbage = apc_copy_zval(NULL, sp->value->val, &ctxt TSRMLS_CC); - ctxt.copy = APC_COPY_IN; - ep->val.val = apc_copy_zval(NULL, garbage, &ctxt TSRMLS_CC); - ep->val.val->type = IS_OBJECT; - /* a memleak can not be avoided: zval_ptr_dtor(&garbage); */ - ctxt.copy = APC_COPY_OTHER; - } else { - ep->val.val = apc_copy_zval(NULL, sp->value->val, &ctxt TSRMLS_CC); - } - ep->val.ttl = sp->value->ttl; - - /* swizzle pointers */ - zend_hash_clean(&ctxt.copied); - if (ep->val.val->type == IS_OBJECT) { - apc_swizzle_ptr(bd, &ctxt, &ll, &bd->entries[count].val.val->value.str.val); - } else { - apc_swizzle_zval(bd, &ctxt, &ll, bd->entries[count].val.val TSRMLS_CC); - } - apc_swizzle_ptr(bd, &ctxt, &ll, &bd->entries[count].val.val); - apc_swizzle_ptr(bd, &ctxt, &ll, &bd->entries[count].key.str); - - count++; - } - } - } - zend_hash_destroy(&ctxt.copied); - ctxt.copied.nTableSize=0; - - /* append swizzle pointer list to bd */ - bd = apc_swizzle_bd(bd, &ll TSRMLS_CC); - zend_llist_destroy(&ll); - zend_hash_destroy(&APCG(apc_bd_alloc_list)); - - APC_RUNLOCK(cache->header); - - if(user_vars) { - zend_hash_destroy(user_vars); - efree(user_vars); - } - - efree(pool_ptr); - - return bd; -} /* }}} */ - -/* {{{ apc_bin_load */ -PHP_APCU_API int apc_bin_load(apc_cache_t* cache, apc_bd_t *bd, int flags TSRMLS_DC) { - apc_bd_entry_t *ep; - uint i; - apc_context_t ctxt; - - if (bd->swizzled) { - if(apc_unswizzle_bd(bd, flags TSRMLS_CC) < 0) { - return -1; - } - } - - for(i = 0; i < bd->num_entries; i++) { - ctxt.pool = apc_pool_create(APC_SMALL_POOL, (apc_malloc_t) apc_sma_malloc, (apc_free_t) apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC); - if (!ctxt.pool) { /* TODO need to cleanup previous pools */ - apc_warning("Unable to allocate memory for pool." TSRMLS_CC); - goto failure; - } - ep = &bd->entries[i]; - { - zval *data; - uint use_copy = 0; - switch (Z_TYPE_P(ep->val.val)) { - case IS_OBJECT: - ctxt.copy = APC_COPY_OUT; - data = apc_copy_zval(NULL, ep->val.val, &ctxt TSRMLS_CC); - use_copy = 1; - break; - default: - data = ep->val.val; - break; - } - ctxt.copy = APC_COPY_IN; - - apc_cache_store( - cache, ep->key.str, ep->key.len, data, ep->val.ttl, 0 TSRMLS_CC); - - if (use_copy) { - zval_ptr_dtor(&data); - } - } - } - - return 0; - -failure: - apc_pool_destroy(ctxt.pool TSRMLS_CC); - apc_warning("Unable to allocate memory for apc binary load/dump functionality." TSRMLS_CC); - - HANDLE_UNBLOCK_INTERRUPTIONS(); - return -1; -} /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker - * vim<600: expandtab sw=4 ts=4 sts=4 - */ Index: apcu-4.0.10/apc_bin.h =================================================================== --- apcu-4.0.10.orig/apc_bin.h 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | APC | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2011 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Brian Shire <shire@php.net> | - +----------------------------------------------------------------------+ - - */ - -/* $Id: apc_bin.h 328743 2012-12-12 07:58:32Z ab $ */ - -#ifndef APC_BIN_H -#define APC_BIN_H - -#include "apc.h" - -#ifndef APC_BIN_API_H -# include "apc_bin_api.h" -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker - * vim<600: expandtab sw=4 ts=4 sts=4 - */ Index: apcu-4.0.10/php_apc.c =================================================================== --- apcu-4.0.10.orig/php_apc.c 2015-12-07 10:01:44.000000000 +0100 +++ apcu-4.0.10/php_apc.c 2016-05-24 16:25:41.211854104 +0200 @@ -36,7 +36,6 @@ #include "apc_iterator.h" #include "apc_sma.h" #include "apc_lock.h" -#include "apc_bin.h" #include "php_globals.h" #include "php_ini.h" #include "ext/standard/info.h" @@ -70,16 +69,6 @@ PHP_FUNCTION(apcu_inc); PHP_FUNCTION(apcu_dec); PHP_FUNCTION(apcu_cas); PHP_FUNCTION(apcu_exists); - -PHP_FUNCTION(apcu_bin_dump); -PHP_FUNCTION(apcu_bin_load); -PHP_FUNCTION(apcu_bin_dumpfile); -PHP_FUNCTION(apcu_bin_loadfile); - -#ifdef APC_FULL_BC -PHP_FUNCTION(apc_bin_dumpfile); -PHP_FUNCTION(apc_bin_dump); -#endif /* }}} */ /* {{{ ZEND_DECLARE_MODULE_GLOBALS(apcu) */ @@ -336,9 +325,6 @@ static PHP_MINIT_FUNCTION(apcu) /* initialize iterator object */ apc_iterator_init(module_number TSRMLS_CC); } - - REGISTER_LONG_CONSTANT("APC_BIN_VERIFY_MD5", APC_BIN_VERIFY_MD5, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("APC_BIN_VERIFY_CRC32", APC_BIN_VERIFY_CRC32, CONST_CS | CONST_PERSISTENT); } #ifndef REGISTER_BOOL_CONSTANT @@ -1055,308 +1041,6 @@ PHP_FUNCTION(apcu_delete) { } /* }}} */ -/* {{{ proto mixed apcu_bin_dump([array vars]) - Returns a binary dump of the given user variables from the APC cache. - A NULL for vars signals a dump of every entry, while array() will dump nothing. - */ -PHP_FUNCTION(apcu_bin_dump) { - - zval *z_vars = NULL; - HashTable *h_vars; - apc_bd_t *bd; - - if (!APCG(enabled)) { - apc_warning("APC is not enabled, apc_bin_dump not available." TSRMLS_CC); - RETURN_FALSE; - } - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &z_vars) == FAILURE) { - return; - } - - h_vars = z_vars ? Z_ARRVAL_P(z_vars) : NULL; - bd = apc_bin_dump(apc_user_cache, h_vars TSRMLS_CC); - if (bd) { - RETVAL_STRINGL((char*)bd, bd->size-1, 0); - } else { - apc_error("Unknown error encountered during apc_bin_dump." TSRMLS_CC); - RETVAL_NULL(); - } - - return; -} -/* }}} */ - -#ifdef APC_FULL_BC -/* {{{ proto mixed apc_bin_dump([array files [, array user_vars]]) - Compatibility mode for old APC - */ -PHP_FUNCTION(apc_bin_dump) { - - zval *z_files = NULL, *z_user_vars = NULL; - HashTable *h_user_vars; - apc_bd_t *bd; - - if(!APCG(enabled)) { - apc_warning("APC is not enabled, apc_bin_dump not available." TSRMLS_CC); - RETURN_FALSE; - } - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &z_files, &z_user_vars) == FAILURE) { - return; - } - - h_user_vars = z_user_vars ? Z_ARRVAL_P(z_user_vars) : NULL; - bd = apc_bin_dump(apc_user_cache, h_user_vars TSRMLS_CC); - if(bd) { - RETVAL_STRINGL((char*)bd, bd->size-1, 0); - } else { - apc_error("Unknown error encountered during apc_bin_dump." TSRMLS_CC); - RETVAL_NULL(); - } - - return; -} -/* }}} */ -#endif - -/* {{{ proto mixed apcu_bin_dumpfile(array vars, string filename, [int flags [, resource context]]) - Output a binary dump of the given user variables from the APC cache to the named file. - */ -PHP_FUNCTION(apcu_bin_dumpfile) { - - zval *z_vars = NULL; - HashTable *h_vars; - char *filename = NULL; - int filename_len; - long flags=0; - zval *zcontext = NULL; - php_stream_context *context = NULL; - php_stream *stream; - int numbytes = 0; - apc_bd_t *bd; - - if (!APCG(enabled)) { - apc_warning("APC is not enabled, apc_bin_dumpfile not available." TSRMLS_CC); - RETURN_FALSE; - } - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!s|lr!", &z_vars, &filename, &filename_len, &flags, &zcontext) == FAILURE) { - return; - } - - if (!filename_len) { - apc_error("apc_bin_dumpfile filename argument must be a valid filename." TSRMLS_CC); - RETURN_FALSE; - } - - h_vars = z_vars ? Z_ARRVAL_P(z_vars) : NULL; - bd = apc_bin_dump(apc_user_cache, h_vars TSRMLS_CC); - if (!bd) { - apc_error("Unknown error encountered during apc_bin_dumpfile." TSRMLS_CC); - RETURN_FALSE; - } - - - /* Most of the following has been taken from the file_get/put_contents functions */ - - context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); - stream = php_stream_open_wrapper_ex(filename, (flags & PHP_FILE_APPEND) ? "ab" : "wb", - ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); - if (stream == NULL) { - efree(bd); - 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_error("Unable to get a lock on file in apc_bin_dumpfile." TSRMLS_CC); - RETURN_FALSE; - } - - numbytes = php_stream_write(stream, (char*)bd, bd->size); - if (numbytes != bd->size) { - numbytes = -1; - } - - php_stream_close(stream); - efree(bd); - - if (numbytes < 0) { - apc_error("Only %d of %d bytes written, possibly out of free disk space" TSRMLS_CC, numbytes, bd->size); - RETURN_FALSE; - } - - RETURN_LONG(numbytes); -} -/* }}} */ - -#ifdef APC_FULL_BC -/* {{{ proto mixed apc_bin_dumpfile(array files, array user_vars, string filename, [int flags [, resource context]]) - Compatibility mode for old APC - */ -PHP_FUNCTION(apc_bin_dumpfile) { - - zval *z_files = NULL, *z_user_vars = NULL; - HashTable *h_user_vars; - char *filename = NULL; - int filename_len; - long flags=0; - zval *zcontext = NULL; - php_stream_context *context = NULL; - php_stream *stream; - int numbytes = 0; - apc_bd_t *bd; - - if(!APCG(enabled)) { - apc_warning("APC is not enabled, apc_bin_dumpfile not available." TSRMLS_CC); - RETURN_FALSE; - } - - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!s|lr!", &z_files, &z_user_vars, &filename, &filename_len, &flags, &zcontext) == -FAILURE) { - return; - } - - if(!filename_len) { - 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(apc_user_cache, h_user_vars TSRMLS_CC); - if(!bd) { - apc_error("Unknown error encountered during apc_bin_dumpfile." TSRMLS_CC); - RETURN_FALSE; - } - - - /* Most of the following has been taken from the file_get/put_contents functions */ - - context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); - stream = php_stream_open_wrapper_ex(filename, (flags & PHP_FILE_APPEND) ? "ab" : "wb", - ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); - if (stream == NULL) { - efree(bd); - 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_error("Unable to get a lock on file in apc_bin_dumpfile." TSRMLS_CC); - RETURN_FALSE; - } - - numbytes = php_stream_write(stream, (char*)bd, bd->size); - if(numbytes != bd->size) { - numbytes = -1; - } - - php_stream_close(stream); - efree(bd); - - if(numbytes < 0) { - apc_error("Only %d of %d bytes written, possibly out of free disk space" TSRMLS_CC, numbytes, bd->size); - RETURN_FALSE; - } - - RETURN_LONG(numbytes); -} -/* }}} */ -#endif - -/* {{{ proto mixed apcu_bin_load(string data, [int flags]) - Load the given binary dump into the APC file/user cache. - */ -PHP_FUNCTION(apcu_bin_load) { - - int data_len; - char *data; - long flags = 0; - - if (!APCG(enabled)) { - apc_warning("APC is not enabled, apc_bin_load not available." TSRMLS_CC); - RETURN_FALSE; - } - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &flags) == FAILURE) { - return; - } - - if (!data_len || 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; - } - - apc_bin_load(apc_user_cache, (apc_bd_t*)data, (int)flags TSRMLS_CC); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto mixed apc_bin_loadfile(string filename, [resource context, [int flags]]) - Load the given binary dump from the named file into the APC file/user cache. - */ -PHP_FUNCTION(apcu_bin_loadfile) { - - char *filename; - int filename_len; - zval *zcontext = NULL; - long flags = 0; - php_stream_context *context = NULL; - php_stream *stream; - char *data; - int len; - - if (!APCG(enabled)) { - apc_warning("APC is not enabled, apc_bin_loadfile not available." TSRMLS_CC); - RETURN_FALSE; - } - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r!l", &filename, &filename_len, &zcontext, &flags) == FAILURE) { - return; - } - - if (!filename_len) { - apc_error("apc_bin_loadfile filename argument must be a valid filename." TSRMLS_CC); - RETURN_FALSE; - } - - context = php_stream_context_from_zval(zcontext, 0); - stream = php_stream_open_wrapper_ex(filename, "rb", - ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context); - if (!stream) { - 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_warning("File passed to apc_bin_loadfile was empty: %s." TSRMLS_CC, filename); - RETURN_FALSE; - } else if (len < 0) { - 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_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); - - apc_bin_load(apc_user_cache, (apc_bd_t*)data, (int)flags TSRMLS_CC); - efree(data); - - RETURN_TRUE; -} -/* }}} */ - /* {{{ arginfo */ #if (PHP_MAJOR_VERSION >= 6 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3)) # define PHP_APC_ARGINFO @@ -1437,50 +1121,6 @@ PHP_APC_ARGINFO ZEND_BEGIN_ARG_INFO(arginfo_apcu_exists, 0) ZEND_ARG_INFO(0, keys) ZEND_END_ARG_INFO() - -PHP_APC_ARGINFO -ZEND_BEGIN_ARG_INFO_EX(arginfo_apcu_bin_dump, 0, 0, 0) - ZEND_ARG_INFO(0, user_vars) -ZEND_END_ARG_INFO() - -PHP_APC_ARGINFO -ZEND_BEGIN_ARG_INFO_EX(arginfo_apcu_bin_dumpfile, 0, 0, 2) - ZEND_ARG_INFO(0, user_vars) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, context) -ZEND_END_ARG_INFO() - -PHP_APC_ARGINFO -ZEND_BEGIN_ARG_INFO_EX(arginfo_apcu_bin_load, 0, 0, 1) - ZEND_ARG_INFO(0, data) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -PHP_APC_ARGINFO -ZEND_BEGIN_ARG_INFO_EX(arginfo_apcu_bin_loadfile, 0, 0, 1) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, context) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - - -#ifdef APC_FULL_BC -PHP_APC_ARGINFO -ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_bin_dump, 0, 0, 0) - ZEND_ARG_INFO(0, files) - ZEND_ARG_INFO(0, user_vars) -ZEND_END_ARG_INFO() - -PHP_APC_ARGINFO -ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_bin_dumpfile, 0, 0, 3) - ZEND_ARG_INFO(0, files) - ZEND_ARG_INFO(0, user_vars) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, flags) - ZEND_ARG_INFO(0, context) -ZEND_END_ARG_INFO() -#endif /* }}} */ /* {{{ apcu_functions[] */ @@ -1498,10 +1138,6 @@ zend_function_entry apcu_functions[] = { PHP_FE(apcu_dec, arginfo_apcu_inc) PHP_FE(apcu_cas, arginfo_apcu_cas) PHP_FE(apcu_exists, arginfo_apcu_exists) - PHP_FE(apcu_bin_dump, arginfo_apcu_bin_dump) - PHP_FE(apcu_bin_load, arginfo_apcu_bin_load) - PHP_FE(apcu_bin_dumpfile, arginfo_apcu_bin_dumpfile) - PHP_FE(apcu_bin_loadfile, arginfo_apcu_bin_loadfile) {NULL, NULL, NULL} }; /* }}} */ @@ -1543,10 +1179,6 @@ zend_function_entry apc_functions[] = { PHP_FALIAS(apc_dec, apcu_dec, arginfo_apcu_inc) PHP_FALIAS(apc_cas, apcu_cas, arginfo_apcu_cas) PHP_FALIAS(apc_exists, apcu_exists, arginfo_apcu_exists) - PHP_FE(apc_bin_dump, arginfo_apc_bin_dump) - PHP_FE(apc_bin_dumpfile, arginfo_apc_bin_dumpfile) - PHP_FALIAS(apc_bin_load, apcu_bin_load, arginfo_apcu_bin_load) - PHP_FALIAS(apc_bin_loadfile, apcu_bin_loadfile, arginfo_apcu_bin_loadfile) {NULL, NULL, NULL} }; Index: apcu-4.0.10/config.m4 =================================================================== --- apcu-4.0.10.orig/config.m4 2015-12-07 10:01:44.000000000 +0100 +++ apcu-4.0.10/config.m4 2016-05-24 16:28:17.758469393 +0200 @@ -262,14 +262,14 @@ if test "$PHP_APCU" != "no"; then apc_signal.c \ apc_pool.c \ apc_iterator.c \ - apc_bin.c " + " PHP_CHECK_LIBRARY(rt, shm_open, [PHP_ADD_LIBRARY(rt,,APCU_SHARED_LIBADD)]) PHP_NEW_EXTENSION(apcu, $apc_sources, $ext_shared,, \\$(APCU_CFLAGS)) PHP_SUBST(APCU_SHARED_LIBADD) PHP_SUBST(APCU_CFLAGS) PHP_SUBST(PHP_LDFLAGS) - PHP_INSTALL_HEADERS(ext/apcu, [apc.h apc_api.h apc_cache_api.h apc_lock_api.h apc_pool_api.h apc_sma_api.h apc_bin_api.h apc_serializer.h]) + PHP_INSTALL_HEADERS(ext/apcu, [apc.h apc_api.h apc_cache_api.h apc_lock_api.h apc_pool_api.h apc_sma_api.h apc_serializer.h]) AC_DEFINE(HAVE_APCU, 1, [ ]) fi Index: apcu-4.0.10/tests/apc_bin_001.phpt =================================================================== --- apcu-4.0.10.orig/tests/apc_bin_001.phpt 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ ---TEST-- -APC: bindump user cache, variation 1 ---SKIPIF-- -<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> ---INI-- -apc.enabled=1 -apc.enable_cli=1 ---FILE-- -<?php -apc_clear_cache(); -apc_store('foo', 42); -$dump = apcu_bin_dump(array('foo')); -apc_clear_cache(); -var_dump(apc_fetch('foo')); -apcu_bin_load($dump, APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); -var_dump(apc_fetch('foo')); -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -bool(false) -int(42) -===DONE=== Index: apcu-4.0.10/tests/apc_bin_002.phpt =================================================================== --- apcu-4.0.10.orig/tests/apc_bin_002.phpt 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ ---TEST-- -APC: bindump user cache, variation 2 ---SKIPIF-- -<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> -<?php -/* XXX this is a hack, but otherwise the data for each platform - has te be created manually */ -apc_clear_cache(); -apc_store('foo', 42); -apcu_bin_dumpfile(array('foo'), dirname(__FILE__) . '/foo.bin', APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); ---INI-- -apc.enabled=1 -apc.enable_cli=1 ---FILE-- -<?php -apc_clear_cache(); -var_dump(apc_fetch('foo')); -apcu_bin_loadfile(dirname(__FILE__) . '/foo.bin', NULL, APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); -var_dump(apc_fetch('foo')); -?> -===DONE=== -<?php exit(0); ?> ---CLEAN-- -<?php -unlink(dirname(__FILE__) . '/foo.bin'); ---EXPECTF-- -bool(false) -int(42) -===DONE=== Index: apcu-4.0.10/tests/apc_bin_003.phpt =================================================================== --- apcu-4.0.10.orig/tests/apc_bin_003.phpt 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ ---TEST-- -APC: bindump user cache, variation 3 ---SKIPIF-- -<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> -<?php -/* XXX this is a hack, but otherwise the data for each platform - has te be created manually */ -apc_clear_cache(); -apc_store('foo', 42); -apc_store('bar', 'foo'); -apcu_bin_dumpfile(NULL, dirname(__FILE__) . '/foo.bin', APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); ---INI-- -apc.enabled=1 -apc.enable_cli=1 ---FILE-- -<?php -apc_clear_cache(); -var_dump(apc_fetch('foo')); -var_dump(apc_fetch('bar')); -apcu_bin_loadfile(dirname(__FILE__) . '/foo.bin', NULL, APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); -var_dump(apc_fetch('foo')); -var_dump(apc_fetch('bar')); -?> -===DONE=== -<?php exit(0); ?> ---CLEAN-- -<?php -unlink(dirname(__FILE__) . '/foo.bin'); ---EXPECTF-- -bool(false) -bool(false) -int(42) -string(3) "foo" -===DONE=== Index: apcu-4.0.10/tests/apc_bin_004.phpt =================================================================== --- apcu-4.0.10.orig/tests/apc_bin_004.phpt 2015-12-07 10:01:44.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ ---TEST-- -APC: bindump user cache, variation 4 (check apc_bin_* aliases work) ---SKIPIF-- -<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> ---INI-- -apc.enabled=1 -apc.enable_cli=1 ---FILE-- -<?php -apc_clear_cache(); -apc_store('foo', 42); -apc_bin_dumpfile(array('this', 'is', 'ignored'), array('foo'), dirname(__FILE__) . '/foo.bin', APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); -apc_clear_cache(); -var_dump(apc_fetch('foo')); -apc_bin_loadfile(dirname(__FILE__) . '/foo.bin', NULL, APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); -var_dump(apc_fetch('foo')); - -apc_clear_cache(); -apc_store('foo', 'bar'); -$dump = apc_bin_dump(array('this', 'is', 'ignored'), array('foo')); -apc_clear_cache(); -var_dump(apc_fetch('foo')); -apc_bin_load($dump, APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); -var_dump(apc_fetch('foo')); -?> -===DONE=== -<?php exit(0); ?> ---CLEAN-- -<?php -unlink(dirname(__FILE__) . '/foo.bin'); ---EXPECTF-- -bool(false) -int(42) -bool(false) -string(3) "bar" -===DONE===
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor