php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #58982
Patch apc-3.1.14-fix-warnings.diff revision 2013-01-09 12:07 UTC by hanno at hboeck dot de
Patch apc-3.1.13-fix-warnings.diff revision 2013-01-09 11:51 UTC by hanno at hboeck dot de

Patch apc-3.1.14-fix-warnings.diff for APC Bug #58982

Patch version 2013-01-09 12:07 UTC

Return to Bug #58982 | Download this patch
Patch Revisions:

Developer: hanno@hboeck.de

diff -Naur APC-3.1.14/apc_bin.c APC-3.1.14-1/apc_bin.c
--- APC-3.1.14/apc_bin.c	2013-01-03 03:11:59.000000000 +0100
+++ APC-3.1.14-1/apc_bin.c	2013-01-09 13:01:39.137525234 +0100
@@ -715,7 +715,7 @@
     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_warning("Unable to allocate memory for pool." TSRMLS_CC);
+        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
         return NULL;
     }
     ctxt.copy = APC_COPY_IN_OPCODE; /* avoid stupid ALLOC_ZVAL calls here, hack */
@@ -891,7 +891,7 @@
     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 TSRMLS_CC);
         if (!ctxt.pool) { /* TODO need to cleanup previous pools */
-            apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+            php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
             goto failure;
         }
         ep = &bd->entries[i];
diff -Naur APC-3.1.14/apc_cache.c APC-3.1.14-1/apc_cache.c
--- APC-3.1.14/apc_cache.c	2013-01-03 03:11:59.000000000 +0100
+++ APC-3.1.14-1/apc_cache.c	2013-01-09 13:01:39.138525222 +0100
@@ -1336,6 +1336,7 @@
 /* {{{ apc_cache_is_last_key */
 zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t TSRMLS_DC)
 {
+    char *log_message;
     apc_keyid_t *lastkey = &cache->header->lastkey;
     unsigned int keylen = key->data.user.identifier_len;
 #ifdef ZTS
@@ -1352,7 +1353,10 @@
         if(lastkey->mtime == t && FROM_DIFFERENT_THREAD(lastkey)) {
             /* potential cache slam */
             if(APCG(slam_defense)) {
-                apc_debug("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);
+                log_message = emalloc((key->data.user.identifier_len + 40) * sizeof(char));
+                sprintf(log_message, "Potential cache slam averted for key '%s'", key->data.user.identifier);
+                php_log_err(log_message TSRMLS_CC);
+                efree(log_message);
                 return 1;
             }
         }
diff -Naur APC-3.1.14/apc_main.c APC-3.1.14-1/apc_main.c
--- APC-3.1.14/apc_main.c	2013-01-03 03:11:59.000000000 +0100
+++ APC-3.1.14-1/apc_main.c	2013-01-09 13:02:06.828179053 +0100
@@ -451,7 +451,7 @@
                                                  apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
     if (!ctxt.pool) {
         UNLOAD_COMPILER_TABLES_HOOKS();
-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
         return FAILURE;
     }
     ctxt.copy = APC_COPY_IN_OPCODE;
@@ -615,7 +615,7 @@
         ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free,
                                                 apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
         if (!ctxt.pool) {
-            apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+            php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
             return old_compile_file(h, type TSRMLS_CC);
         }
         ctxt.copy = APC_COPY_OUT_OPCODE;
diff -Naur APC-3.1.14/php_apc.c APC-3.1.14-1/php_apc.c
--- APC-3.1.14/php_apc.c	2013-01-03 03:11:59.000000000 +0100
+++ APC-3.1.14-1/php_apc.c	2013-01-09 13:01:39.141525184 +0100
@@ -592,7 +592,7 @@
     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) {
         HANDLE_UNBLOCK_INTERRUPTIONS();
-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
+        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
         return 0;
     }
     ctxt.copy = APC_COPY_IN_USER;
@@ -841,7 +841,7 @@
 
     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);
+        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
         RETURN_FALSE;
     }
     ctxt.copy = APC_COPY_OUT_USER;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 01:01:29 2024 UTC