com php-src: Fix php_module_startup() when loading more than one additional module: main/main.c

From: Date: Wed, 04 Dec 2013 02:20:19 +0000
Subject: com php-src: Fix php_module_startup() when loading more than one additional module: main/main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74234@lists.php.net to get a copy of this message
Commit: 00a7b1ff7fed49df51d0392d47aa79f63bf1c66e Author: Sara Golemon <pollita@php.net> Tue, 3 Dec 2013 16:36:07 -0800 Parents: 6f52f566f3d3a08418917baa6b659249a39c3f18 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=00a7b1ff7fed49df51d0392d47aa79f63bf1c66e Log: Fix php_module_startup() when loading more than one additional module Dereferencing addition_modules within php_module_startup would point to a vector entirely on the stack (which is of course, wrong). Use a specialized helper to keep BC with the current php_module_startup() calling semantics. Fixes 63159 Thanks to @a-j-k Changed paths: M main/main.c Diff: diff --git a/main/main.c b/main/main.c index 5942b23..ce31cae 100644 --- a/main/main.c +++ b/main/main.c @@ -1929,6 +1929,23 @@ int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC) } return SUCCESS; } + +/* A very long time ago php_module_startup() was refactored in a way + * which broke calling it with more than one additional module. + * This alternative to php_register_extensions() works around that + * by walking the shallower structure. + * + * See algo: https://bugs.php.net/bug.php?id=63159 + */ +static int php_register_extensions_bc(zend_module_entry *ptr, int count TSRMLS_DC) +{ + while (count--) { + if (zend_register_internal_module(ptr++ TSRMLS_CC) == NULL) { + return FAILURE; + } + } + return SUCCESS; +} /* }}} */ #if defined(PHP_WIN32) && _MSC_VER >= 1400 @@ -2199,7 +2216,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod } /* start additional PHP extensions */ - php_register_extensions(&additional_modules, num_additional_modules TSRMLS_CC); + php_register_extensions_bc(additional_modules, num_additional_modules TSRMLS_CC); /* load and startup extensions compiled as shared objects (aka DLLs) as requested by php.ini entries

« previous php.cvs (#74234) next »