/* Disabled functions support */
-static ZEND_FUNCTION(display_disabled_function)
+ZEND_API ZEND_FUNCTION(display_disabled_function)
{
zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C));
}
#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
+ZEND_API ZEND_FUNCTION(display_disabled_function);
+
#if ZEND_DEBUG
#define CHECK_ZVAL_STRING(z) \
if ((z)->value.str.val[ (z)->value.str.len ] != '\0') zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val);
ZEND_FUNCTION(function_exists)
{
zval **function_name;
+ zend_function *func;
char *lcname;
- int retval;
+ zend_bool retval;
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
lcname = estrndup((*function_name)->value.str.val, (*function_name)->value.str.len);
zend_str_tolower(lcname, (*function_name)->value.str.len);
- retval = zend_hash_exists(EG(function_table), lcname, (*function_name)->value.str.len+1);
+ retval = (zend_hash_find(EG(function_table), lcname, (*function_name)->value.str.len+1, (void **)&func) == SUCCESS);
efree(lcname);
+ /*
+ * A bit of a hack, but not a bad one: we see if the handler of the function
+ * is actually one that displays "function is disabled" message.
+ */
+ if (retval &&
+ func->internal_function.handler == zif_display_disabled_function) {
+ retval = 0;
+ }
+
RETURN_BOOL(retval);
}
/* }}} */
}
} zend_end_try();
- /* The regular list must be destroyed after the main symbol table and
- * op arrays are destroyed.
+ zend_try {
+ clean_non_persistent_constants(TSRMLS_C);
+ } zend_end_try();
+
+ /* The regular list must be destroyed after the main symbol table,
+ * op arrays, and constants are destroyed.
*/
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
zend_try {
- clean_non_persistent_constants(TSRMLS_C);
#if ZEND_DEBUG
signal(SIGSEGV, original_sigsegv_handler);
#endif