diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index b5f75747ef73..10f54d2395c1 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -94,6 +94,7 @@ PHP 8.7 INTERNALS UPGRADE NOTES . _php_math_basetozval() now returns zend_result instead of void. It throws an exception and returns FAILURE if the input contains invalid characters for the given base. + . php_dl() has been removed, use php_load_extension() instead. ======================== 4. OpCode changes diff --git a/ext/standard/dl.c b/ext/standard/dl.c index ca8ba57a16e9..ad2035fb5c74 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -64,14 +64,15 @@ PHPAPI PHP_FUNCTION(dl) zend_rc_debug = false; #endif - php_dl(filename, MODULE_TEMPORARY, return_value, 0); - if (Z_TYPE_P(return_value) == IS_TRUE) { - EG(full_tables_cleanup) = 1; + zend_result loaded = php_load_extension(filename, MODULE_TEMPORARY, false); + if (loaded == SUCCESS) { + EG(full_tables_cleanup) = true; } #if ZEND_RC_DEBUG zend_rc_debug = orig_rc_debug; #endif + RETURN_BOOL(loaded == SUCCESS); } /* }}} */ @@ -105,7 +106,7 @@ PHPAPI void *php_load_shlib(const char *path, char **errp) /* }}} */ /* {{{ php_load_extension */ -PHPAPI int php_load_extension(const char *filename, int type, int start_now) +PHPAPI zend_result php_load_extension(const char *filename, int type, bool start_now) { void *handle; char *libpath; @@ -266,7 +267,7 @@ PHPAPI void *php_load_shlib(const char *path, char **errp) return NULL; } -PHPAPI int php_load_extension(const char *filename, int type, int start_now) +PHPAPI zend_result php_load_extension(const char *filename, int type, bool start_now) { php_dl_error(filename); @@ -275,18 +276,6 @@ PHPAPI int php_load_extension(const char *filename, int type, int start_now) #endif -/* {{{ php_dl */ -PHPAPI void php_dl(const char *file, int type, zval *return_value, int start_now) -{ - /* Load extension */ - if (php_load_extension(file, type, start_now) == FAILURE) { - RETVAL_FALSE; - } else { - RETVAL_TRUE; - } -} -/* }}} */ - PHP_MINFO_FUNCTION(dl) { #if defined(HAVE_LIBDL) diff --git a/ext/standard/dl.h b/ext/standard/dl.h index 9354caa2ca8d..bd0118bd6ab2 100644 --- a/ext/standard/dl.h +++ b/ext/standard/dl.h @@ -17,8 +17,7 @@ #ifndef DL_H #define DL_H -PHPAPI int php_load_extension(const char *filename, int type, int start_now); -PHPAPI void php_dl(const char *file, int type, zval *return_value, int start_now); +PHPAPI zend_result php_load_extension(const char *filename, int type, bool start_now); PHPAPI void *php_load_shlib(const char *path, char **errp); /* dynamic loading functions */ diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 8deb107d0a38..5914def28a51 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -64,7 +64,6 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */ int value_len = strlen(value); if (!strcmp(name, "extension") && *value) { - zval zv; zend_interned_strings_switch_storage(0); #if ZEND_RC_DEBUG @@ -75,14 +74,14 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */ zend_rc_debug = false; #endif - php_dl(value, MODULE_PERSISTENT, &zv, 1); + zend_result loaded = php_load_extension(value, MODULE_PERSISTENT, true); #if ZEND_RC_DEBUG zend_rc_debug = orig_rc_debug; #endif zend_interned_strings_switch_storage(1); - return Z_TYPE(zv) == IS_TRUE ? FPM_PHP_INI_EXTENSION_LOADED : FPM_PHP_INI_EXTENSION_FAILED; + return loaded == SUCCESS ? FPM_PHP_INI_EXTENSION_LOADED : FPM_PHP_INI_EXTENSION_FAILED; } if (fpm_php_zend_ini_alter_master(name, name_len, value, value_len, mode, PHP_INI_STAGE_ACTIVATE) == FAILURE) {