cvs: ZendEngine2 / zend_API.c zend_API.h zend_builtin_functions.c

From: Date: Mon, 16 Sep 2002 01:36:48 +0000
Subject: cvs: ZendEngine2 / zend_API.c zend_API.h zend_builtin_functions.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-429@lists.php.net to get a copy of this message
andrei Sun Sep 15 21:36:48 2002 EDT Modified files: /ZendEngine2 zend_API.c zend_API.h zend_builtin_functions.c Log: MFZE1 Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.131 ZendEngine2/zend_API.c:1.132 --- ZendEngine2/zend_API.c:1.131 Sun Sep 15 03:45:25 2002 +++ ZendEngine2/zend_API.c Sun Sep 15 21:36:47 2002 @@ -1290,7 +1290,7 @@ /* 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)); } Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.119 ZendEngine2/zend_API.h:1.120 --- ZendEngine2/zend_API.h:1.119 Sun Jun 9 10:20:37 2002 +++ ZendEngine2/zend_API.h Sun Sep 15 21:36:48 2002 @@ -246,6 +246,8 @@ #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); Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.147 ZendEngine2/zend_builtin_functions.c:1.148 --- ZendEngine2/zend_builtin_functions.c:1.147 Sun Sep 15 03:45:25 2002 +++ ZendEngine2/zend_builtin_functions.c Sun Sep 15 21:36:48 2002 @@ -803,8 +803,9 @@ 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,8 +814,17 @@ 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); }

« previous php.zend-engine.cvs (#429) next »