Commit 036eb7cef04 for php
commit 036eb7cef04117f8ee8b951812c811e07595d799
Author: Gina Peter Banyard <girgias@php.net>
Date: Mon Nov 9 18:57:32 2026 +0000
std: remove php_dl() API (#25346)
One can just use php_load_extension() rather than passing a zval* to get the status answer
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index b5f75747ef7..10f54d2395c 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 ca8ba57a16e..ad2035fb5c7 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 9354caa2ca8..bd0118bd6ab 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 8deb107d0a3..5914def28a5 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) {