Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MFZE1

  • Loading branch information...
commit a35c61af3c0c48b86385ee579be2dca1d2b41494 1 parent 78a17be
Andrei Zmievski authored
View
2  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));
}
View
2  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);
View
14 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);
}
/* }}} */
View
9 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
Please sign in to comment.
Something went wrong with that request. Please try again.