diff options
author | Andrei Zmievski <andrei@php.net> | 2002-09-16 01:36:48 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2002-09-16 01:36:48 +0000 |
commit | a35c61af3c0c48b86385ee579be2dca1d2b41494 (patch) | |
tree | f28d85a02d563be45ba23446df972580f8e73f62 | |
parent | 78a17be5e59cf15a93fd960a8936e5dbff1155e1 (diff) | |
download | php-git-a35c61af3c0c48b86385ee579be2dca1d2b41494.tar.gz |
MFZE1
-rw-r--r-- | Zend/zend_API.c | 2 | ||||
-rw-r--r-- | Zend/zend_API.h | 2 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 14 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 9 |
4 files changed, 21 insertions, 6 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 10f8f3477d..030ca9489f 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1290,7 +1290,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, /* 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)); } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index a90cca6139..09ca6e7aab 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -246,6 +246,8 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, #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); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 22afc71625..fdc9c49f9b 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -803,8 +803,9 @@ ZEND_FUNCTION(class_exists) 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(); @@ -813,9 +814,18 @@ ZEND_FUNCTION(function_exists) 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); } /* }}} */ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index b606d416d8..5b452d6e3f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -217,13 +217,16 @@ void shutdown_executor(TSRMLS_D) } } 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 |