diff options
-rw-r--r-- | Zend/zend_builtin_functions.c | 31 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 32 | ||||
-rw-r--r-- | ext/standard/basic_functions.h | 1 |
3 files changed, 31 insertions, 33 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index a96c5bc683..07e60e57eb 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -54,6 +54,7 @@ static ZEND_FUNCTION(function_exists); static ZEND_FUNCTION(class_alias); #if ZEND_DEBUG static ZEND_FUNCTION(leak); +static ZEND_FUNCTION(leak_variable); #ifdef ZEND_TEST_EXCEPTIONS static ZEND_FUNCTION(crash); #endif @@ -180,6 +181,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_alias, 0, 0, 2) ZEND_ARG_INFO(0, autoload) ZEND_END_ARG_INFO() +#if ZEND_DEBUG +ZEND_BEGIN_ARG_INFO_EX(arginfo_leak_variable, 0, 0, 1) + ZEND_ARG_INFO(0, variable) + ZEND_ARG_INFO(0, leak_data) +ZEND_END_ARG_INFO() +#endif + ZEND_BEGIN_ARG_INFO_EX(arginfo_trigger_error, 0, 0, 1) ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, error_type) @@ -245,6 +253,7 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */ ZEND_FE(class_alias, arginfo_class_alias) #if ZEND_DEBUG ZEND_FE(leak, NULL) + ZEND_FE(leak_variable, arginfo_leak_variable) #ifdef ZEND_TEST_EXCEPTIONS ZEND_FE(crash, NULL) #endif @@ -1367,6 +1376,28 @@ ZEND_FUNCTION(leak) } /* }}} */ +/* {{{ proto leak_variable(mixed variable [, bool leak_data]) */ +ZEND_FUNCTION(leak_variable) +{ + zval *zv; + zend_bool leak_data = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &zv, &leak_data) == FAILURE) { + return; + } + + if (!leak_data) { + zval_add_ref(&zv); + } else if (Z_TYPE_P(zv) == IS_RESOURCE) { + zend_list_addref(Z_RESVAL_P(zv)); + } else if (Z_TYPE_P(zv) == IS_OBJECT) { + Z_OBJ_HANDLER_P(zv, add_ref)(zv TSRMLS_CC); + } else { + zend_error(E_WARNING, "Leaking non-zval data is only applicable to resources and objects"); + } +} +/* }}} */ + #ifdef ZEND_TEST_EXCEPTIONS ZEND_FUNCTION(crash) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a7918abfd6..930bb30332 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -853,11 +853,6 @@ ZEND_END_ARG_INFO() #if ZEND_DEBUG ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0) ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_leak_variable, 0, 0, 1) - ZEND_ARG_INFO(0, variable) - ZEND_ARG_INFO(0, leak_data) -ZEND_END_ARG_INFO() #endif #ifdef HAVE_GETLOADAVG @@ -3002,7 +2997,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(parse_ini_string, arginfo_parse_ini_string) #if ZEND_DEBUG PHP_FE(config_get_hash, arginfo_config_get_hash) - PHP_FE(leak_variable, arginfo_leak_variable) #endif PHP_FE(is_uploaded_file, arginfo_is_uploaded_file) PHP_FE(move_uploaded_file, arginfo_move_uploaded_file) @@ -5923,32 +5917,6 @@ PHP_FUNCTION(config_get_hash) /* {{{ */ zend_hash_apply_with_arguments(hash TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, return_value); } /* }}} */ - -/* {{{ proto leak_variable(variable [, leak_data]) */ -PHP_FUNCTION(leak_variable) -{ - zval *zv; - zend_bool leak_data = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &zv, &leak_data) == FAILURE) { - return; - } - - if (leak_data && (Z_TYPE_P(zv) != IS_RESOURCE && Z_TYPE_P(zv) != IS_OBJECT)) { - php_error_docref0(NULL TSRMLS_CC, E_WARNING, - "Leaking non-zval data is only applicable to resources and objects"); - return; - } - - if (!leak_data) { - zval_add_ref(&zv); - } else if (Z_TYPE_P(zv) == IS_RESOURCE) { - zend_list_addref(Z_RESVAL_P(zv)); - } else if (Z_TYPE_P(zv) == IS_OBJECT) { - Z_OBJ_HANDLER_P(zv, add_ref)(zv TSRMLS_CC); - } -} -/* }}} */ #endif #ifdef HAVE_GETLOADAVG diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 50dbce3c0e..4498e6cf8f 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -127,7 +127,6 @@ PHP_FUNCTION(parse_ini_file); PHP_FUNCTION(parse_ini_string); #if ZEND_DEBUG PHP_FUNCTION(config_get_hash); -PHP_FUNCTION(leak_variable); #endif PHP_FUNCTION(str_rot13); |