Skip to content

Commit 173e367

Browse files
danognielsdos
authored andcommitted
Refactor
1 parent 5e98bec commit 173e367

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Zend/zend_API.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
/* these variables are true statics/globals, and have to be mutex'ed on every access */
4141
ZEND_API HashTable module_registry;
4242

43-
ZEND_API bool use_deepbind = false;
43+
ZEND_API bool zend_dl_use_deepbind = false;
4444

4545
static zend_module_entry **module_request_startup_handlers;
4646
static zend_module_entry **module_request_shutdown_handlers;
@@ -49,6 +49,11 @@ static zend_module_entry **modules_dl_loaded;
4949

5050
static zend_class_entry **class_cleanup_handlers;
5151

52+
ZEND_API void zend_set_dl_use_deepbind(bool use_deepbind)
53+
{
54+
zend_dl_use_deepbind = use_deepbind;
55+
}
56+
5257
ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */
5358
{
5459
zval *param_ptr;

Zend/zend_API.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ typedef struct _zend_fcall_info_cache {
343343
ZEND_API int zend_next_free_module(void);
344344

345345
BEGIN_EXTERN_C()
346+
ZEND_API void zend_set_dl_use_deepbind(bool use_deepbind);
347+
346348
ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array);
347349

348350
/* internal function to efficiently copy parameters when executing __call() */

Zend/zend_portability.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@
166166
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
167167
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer)
168168
# if defined(LM_ID_NEWLM)
169-
ZEND_API extern bool use_deepbind;
170-
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | (use_deepbind ? RTLD_DEEPBIND : 0))
169+
ZEND_API extern bool zend_dl_use_deepbind;
170+
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | (zend_dl_use_deepbind ? RTLD_DEEPBIND : 0))
171171
# else
172172
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
173173
# endif

sapi/apache2handler/sapi_apache2.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,12 @@ static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp
461461
return OK;
462462
}
463463

464-
ZEND_API extern bool use_deepbind;
465-
466464
static int
467465
php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
468466
{
469467
void *data = NULL;
470468
const char *userdata_key = "apache2hook_post_config";
471-
use_deepbind = true;
469+
zend_set_dl_use_deepbind(true);
472470

473471
/* Apache will load, unload and then reload a DSO module. This
474472
* prevents us from starting PHP until the second load. */

0 commit comments

Comments
 (0)