Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 6 additions & 17 deletions ext/standard/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
/* }}} */

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions ext/standard/dl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 2 additions & 3 deletions sapi/fpm/fpm/fpm_php.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
Loading