From: Reeze Xia Date: Wed, 4 Feb 2015 17:21:42 +0000 (+0800) Subject: Add test function arguments X-Git-Tag: PRE_PHP7_EREG_MYSQL_REMOVALS~3^2~13^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c84006f5ac11cb9b2409401cb381abb4d7a19e5;p=php Add test function arguments --- diff --git a/Zend/tests/return_types/internal_functions001.phpt b/Zend/tests/return_types/internal_functions001.phpt new file mode 100644 index 0000000000..8204161cb4 --- /dev/null +++ b/Zend/tests/return_types/internal_functions001.phpt @@ -0,0 +1,15 @@ +--TEST-- +Return type hinting for internal functions + +--SKIPIF-- + +--EXPECTF-- +Catchable fatal error: Return value of zend_test_func() must be of the type array, null returned in %s on line %d diff --git a/Zend/tests/return_types/internal_functions002.phpt b/Zend/tests/return_types/internal_functions002.phpt new file mode 100644 index 0000000000..65838a1a67 --- /dev/null +++ b/Zend/tests/return_types/internal_functions002.phpt @@ -0,0 +1,16 @@ +--TEST-- +Return type hinting for internal functions 2 + +--SKIPIF-- + +--EXPECTF-- +==DONE== diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 2fce4b7964..fe7c8f7556 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -87,6 +87,7 @@ static ZEND_FUNCTION(debug_backtrace); static ZEND_FUNCTION(debug_print_backtrace); #if ZEND_DEBUG static ZEND_FUNCTION(zend_test_func); +static ZEND_FUNCTION(zend_test_func2); #ifdef ZTS static ZEND_FUNCTION(zend_thread_id); #endif @@ -243,6 +244,14 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_extension_loaded, 0, 0, 1) ZEND_ARG_INFO(0, extension_name) ZEND_END_ARG_INFO() + +#ifdef ZEND_DEBUG +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_func, IS_ARRAY, NULL, 0) +ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_func2, IS_ARRAY, NULL, 1) +ZEND_END_ARG_INFO() +#endif + /* }}} */ static const zend_function_entry builtin_functions[] = { /* {{{ */ @@ -304,7 +313,8 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */ ZEND_FE(debug_backtrace, arginfo_debug_backtrace) ZEND_FE(debug_print_backtrace, arginfo_debug_print_backtrace) #if ZEND_DEBUG - ZEND_FE(zend_test_func, NULL) + ZEND_FE(zend_test_func, arginfo_zend_test_func) + ZEND_FE(zend_test_func2, arginfo_zend_test_func2) #ifdef ZTS ZEND_FE(zend_thread_id, NULL) #endif @@ -1954,6 +1964,13 @@ ZEND_FUNCTION(zend_test_func) zend_get_parameters(ZEND_NUM_ARGS(), 2, &arg1, &arg2); } +ZEND_FUNCTION(zend_test_func2) +{ + zval *arg1, *arg2; + + zend_get_parameters(ZEND_NUM_ARGS(), 2, &arg1, &arg2); +} + #ifdef ZTS ZEND_FUNCTION(zend_thread_id)