[PATCH] Zend _CHECK_MEMORY_LIMIT fix

php.internals

Joe Orton

22 years ago
It looks like the _CHECK_MEMORY_LIMIT macro has one of the conditions reversed: the diff below is rather unreadable, if you read the original code the problem should be obvious: if (file) zend_error("..exhausted (tried...", ...) else zend_error("...exhausted at %s:%d (tried...", ..., file, lineno, ...) gcc 3.3 with -Wall is giving warnings on this macro since it expands to always pass a NULL as the %s argument in some places, but this isn't a real issue when inside an if (NULL) condition. Index: Zend/zend_alloc.c =================================================================== RCS file: /repository/Zend/Attic/zend_alloc.c,v retrieving revision 1.105.4.3 diff -u -r1.105.4.3 zend_alloc.c --- Zend/zend_alloc.c 15 Apr 2003 01:30:46 -0000 1.105.4.3 +++ Zend/zend_alloc.c 13 Oct 2003 11:21:27 -0000 @@ -70,9 +70,9 @@ if (AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \ AG(memory_limit) = AG(allocated_memory) + 1048576; \ if (file) { \ - zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", php_mem_limit, s); \ - } else { \ zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \ + } else { \ + zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", php_mem_limit, s); \ } \ } else { \ if (file) { \