Hello, I need to simulate "enable_functions" configuration directive on my mutualized hosting environment. Goal is to enable some functions in a specific vhost which have been disabled globally.
To make as less changes as possible, here is what I did : In zend_API.h, I changed _zend_function_entry adding a pointer to itself to keep track of the original function in a disabled function : typedef struct _zend_function_entry { const char *fname; void (*handler)(INTERNAL_FUNCTION_PARAMETERS); const struct _zend_arg_info *arg_info; zend_uint num_args; zend_uint flags; struct _zend_function_entry* original; } zend_function_entry; In zend_API.c, I changed zend_disable_function to swap between original function and disabled function : ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */ { zend_function_entry *orig; zend_hash_find(CG(function_table), function_name, function_name_length+1, (void **) &orig); if(orig != NULL) { if(orig->original == NULL) { zend_function_entry *dummy; dummy = pemalloc(sizeof(zend_function_entry), 1); disabled_function[0].fname = function_name; disabled_function[0].original = orig; orig=dummy; if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; } return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC); } else { zend_function_entry *new; new=orig->original; if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; } return zend_register_functions(NULL, &new, CG(function_table), MODULE_PERSISTENT TSRMLS_CC); } } else { return FAILURE; } } /* }}} */ Expected behaviour is that each time a function is seen is the "disable_functions" directive, the original and disabled functions are swapped. So if I put "php_value disable_functions syslog" in a vhost, it should re-enable syslog which has been disabled globally. Of course it does not work. My code compiles but it does not work as expected. Could you help me please ? Perhaps a patch has already been made available for that ? Thank you very much, Best regards, Ben -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php