mirror of
https://github.com/php/php-src.git
synced 2026-04-09 00:53:30 +02:00
Allow disabling of functions for security reasons
This commit is contained in:
@@ -925,3 +925,31 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
|
||||
va_end(symbol_table_list);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Disabled functions support */
|
||||
|
||||
static ZEND_FUNCTION(display_disabled_function)
|
||||
{
|
||||
zend_error(E_WARNING, "%s() has been disabled for security reasons.", get_active_function_name());
|
||||
}
|
||||
|
||||
|
||||
static zend_function_entry disabled_function[] = {
|
||||
ZEND_FE(display_disabled_function, NULL)
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length)
|
||||
{
|
||||
CLS_FETCH();
|
||||
|
||||
if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
disabled_function[0].fname = function_name;
|
||||
return zend_register_functions(disabled_function, CG(function_table));
|
||||
}
|
||||
@@ -113,6 +113,7 @@ void zend_unregister_functions(zend_function_entry *functions, int count, HashTa
|
||||
ZEND_API int zend_register_module(zend_module_entry *module_entry);
|
||||
ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry);
|
||||
ZEND_API zend_module_entry *zend_get_module(int module_number);
|
||||
ZEND_API int zend_disable_function(char *function_name, uint function_name_length);
|
||||
|
||||
ZEND_API void wrong_param_count(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user