diff options
author | Johannes Schlüter <johannes@php.net> | 2012-05-08 17:30:05 +0200 |
---|---|---|
committer | Johannes Schlüter <johannes@php.net> | 2012-05-08 17:30:05 +0200 |
commit | e8e661128a4dcee9d2f35ed3443d567ba2ad7870 (patch) | |
tree | 2b2791a817b15c3c10e423a2e2e84b509ad7d8b5 /ext/mysqlnd/mysqlnd_plugin.c | |
parent | fb3b6bcf8384c375ddffce85d5e652ec609ccf7a (diff) | |
download | php-git-e8e661128a4dcee9d2f35ed3443d567ba2ad7870.tar.gz |
Fix #61704 (Crash apache, phpinfo() threading issue)
Diffstat (limited to 'ext/mysqlnd/mysqlnd_plugin.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_plugin.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c index 457596feab..2dbb57d1c8 100644 --- a/ext/mysqlnd/mysqlnd_plugin.c +++ b/ext/mysqlnd/mysqlnd_plugin.c @@ -169,7 +169,24 @@ PHPAPI void * _mysqlnd_plugin_find(const char * const name TSRMLS_DC) /* {{{ _mysqlnd_plugin_apply_with_argument */ PHPAPI void _mysqlnd_plugin_apply_with_argument(apply_func_arg_t apply_func, void * argument TSRMLS_DC) { - zend_hash_apply_with_argument(&mysqlnd_registered_plugins, apply_func, argument TSRMLS_CC); + /* Note: We want to be thread-safe (read-only), so we can use neither + * zend_hash_apply_with_argument nor zend_hash_internal_pointer_reset and + * friends + */ + Bucket *p; + + p = mysqlnd_registered_plugins.pListHead; + while (p != NULL) { + int result = apply_func(p->pData, argument TSRMLS_CC); + + if (result & ZEND_HASH_APPLY_REMOVE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mysqlnd_plugin_apply_with_argument must not remove table entries"); + } + p = p->pListNext; + if (result & ZEND_HASH_APPLY_STOP) { + break; + } + } } /* }}} */ |