From 071506e7ba2e496911d9a237d527838b66f28dba Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 26 Aug 2012 17:45:39 +0200 Subject: php-pecl-apc, version 3.1.12 + upstream patches --- apc-svn.patch | 183 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 89 insertions(+), 94 deletions(-) (limited to 'apc-svn.patch') diff --git a/apc-svn.patch b/apc-svn.patch index 3cb72ba..d2e4299 100644 --- a/apc-svn.patch +++ b/apc-svn.patch @@ -1,104 +1,99 @@ -Revision: http://svn.php.net/viewvc?view=revision&revision=325482 -- Fix bug #59829 APC should not try to canonicalize file URLs - -Revision: http://svn.php.net/viewvc?view=revision&revision=325483 -- Fix bug #61799 Typo in 'SEARCH' regex of apc.php - -Revision: http://svn.php.net/viewvc?view=revision&revision=325875 -- Fixed possible memory leak in apc_inc() and apc_dec() - -Revision: http://svn.php.net/viewvc?view=revision&revision=325977 -- Fix bug 62230 apc_copy_internal_strings does not copy terminating \0 of class entry - -Revision: http://svn.php.net/viewvc?view=revision&revision=326089 -- Make sure interned strings are null-terminated (cschneid) - ---- pecl/apc/trunk/apc_cache.c 2012/04/30 21:13:32 325481 -+++ pecl/apc/trunk/apc_cache.c 2012/05/01 00:09:36 325482 -@@ -944,7 +944,7 @@ +--- pecl/apc/trunk/apc_string.c 2012/08/22 14:36:28 327232 ++++ pecl/apc/trunk/apc_string.c 2012/08/22 14:54:39 327233 +@@ -206,48 +206,52 @@ + int count = APCG(shm_strings_buffer) / (sizeof(Bucket) + sizeof(Bucket*) * 2); - len = strlen(filename); - if(APCG(fpstat)==0) { -- if(IS_ABSOLUTE_PATH(filename,len)) { -+ if(IS_ABSOLUTE_PATH(filename,len) || strstr(filename, "://")) { - key->data.fpfile.fullpath = filename; - key->data.fpfile.fullpath_len = len; - key->h = string_nhash_8(key->data.fpfile.fullpath, key->data.fpfile.fullpath_len); ---- pecl/apc/trunk/apc.php 2012/05/01 00:09:36 325482 -+++ pecl/apc/trunk/apc.php 2012/05/01 00:34:04 325483 -@@ -91,7 +91,7 @@ - 'SORT1' => '/^[AHSMCDTZ]$/', // first sort key - 'SORT2' => '/^[DA]$/', // second sort key - 'AGGR' => '/^\d+$/', // aggregation by dir level -- 'SEARCH' => '~^[a-zA-Z0-1/_.-]*$~' // aggregation by dir level -+ 'SEARCH' => '~^[a-zA-Z0-9/_.-]*$~' // aggregation by dir level - ); + apc_interned_strings_data = (apc_interned_strings_data_t*) apc_sma_malloc(APCG(shm_strings_buffer) TSRMLS_CC); +- memset((void *)apc_interned_strings_data, 0, APCG(shm_strings_buffer)); ++ if (apc_interned_strings_data) { ++ memset((void *)apc_interned_strings_data, 0, APCG(shm_strings_buffer)); - // default cache mode ---- pecl/apc/trunk/php_apc.c 2012/05/27 16:15:36 325874 -+++ pecl/apc/trunk/php_apc.c 2012/05/27 17:15:26 325875 -@@ -724,6 +724,10 @@ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &strkey, &strkey_len, &(args.step), &success) == FAILURE) { - return; - } -+ -+ if (success) { -+ zval_dtor(success); -+ } +- CREATE_LOCK(APCSG(lock)); ++ CREATE_LOCK(APCSG(lock)); - if(_apc_update(strkey, strkey_len, inc_updater, &args TSRMLS_CC)) { - if(success) ZVAL_TRUE(success); -@@ -747,6 +751,10 @@ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &strkey, &strkey_len, &(args.step), &success) == FAILURE) { - return; - } -+ -+ if (success) { -+ zval_dtor(success); -+ } +- 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; ++ 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; - args.step = args.step * -1; +- apc_copy_internal_strings(TSRMLS_C); ++ apc_copy_internal_strings(TSRMLS_C); ++ } + } ---- pecl/apc/trunk/apc_string.c 2012/06/05 04:25:50 325976 -+++ pecl/apc/trunk/apc_string.c 2012/06/05 05:34:21 325977 -@@ -154,7 +154,7 @@ - } + 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; ++ if (apc_interned_strings_data) { ++ 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; - if (ce->name) { -- ce->name = apc_new_interned_string(ce->name, ce->name_length TSRMLS_CC); -+ ce->name = apc_new_interned_string(ce->name, ce->name_length+1 TSRMLS_CC); - } +- apc_sma_free(apc_interned_strings_data TSRMLS_CC); ++ apc_sma_free(apc_interned_strings_data TSRMLS_CC); - q = ce->properties_info.pListHead; -@@ -166,7 +166,7 @@ - } +- DESTROY_LOCK(APCSG(lock)); ++ DESTROY_LOCK(APCSG(lock)); ++ } + } + #endif - if (info->name) { -- info->name = apc_new_interned_string(info->name, info->name_length TSRMLS_CC); -+ info->name = apc_new_interned_string(info->name, info->name_length+1 TSRMLS_CC); - } +--- pecl/apc/trunk/apc_string.c 2012/08/23 07:39:44 327243 ++++ pecl/apc/trunk/apc_string.c 2012/08/23 09:08:12 327244 +@@ -248,8 +248,6 @@ + zend_interned_strings_snapshot = old_interned_strings_snapshot; + zend_interned_strings_restore = old_interned_strings_restore; - q = q->pListNext; ---- pecl/apc/trunk/apc_string.c 2012/06/05 05:34:21 325977 -+++ pecl/apc/trunk/apc_string.c 2012/06/11 04:29:57 326089 -@@ -91,17 +91,18 @@ - p = p->pNext; - } - -- if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >= -+ if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1) >= - APCSG(interned_strings_end)) { - /* no memory */ - return NULL; +- apc_sma_free(apc_interned_strings_data TSRMLS_CC); +- + DESTROY_LOCK(APCSG(lock)); } - - p = (Bucket *) APCSG(interned_strings_top); -- APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength); -+ APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1); - - p->arKey = (char*)(p+1); - memcpy(p->arKey, arKey, nKeyLength); -+ ((char *)p->arKey)[nKeyLength] = '\0'; - p->nKeyLength = nKeyLength; - p->h = h; - p->pData = &p->pDataPtr; + } -- cgit