com php-src: Add test function arguments: Zend/tests/return_t ypes/internal_functions001.phpt Zend/tests/return _types/internal_functions002.phpt
Zend/zend_bui ltin_functions.c
| From: | Dmitry Stogov | Date: | Wed, 04 Feb 2015 17:21:42 +0000 |
| Subject: | com php-src: Add test function arguments: Zend/tests/return_t ypes/internal_functions001.phpt Zend/tests/return _types/internal_functions002.phpt Zend/zend_bui ltin_functions.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84648@lists.php.net to get a copy of this message | ||
Commit: 2c84006f5ac11cb9b2409401cb381abb4d7a19e5
Author: Reeze Xia <reeze@php.net> Thu, 5 Feb 2015 01:21:42 +0800
Parents: bff4c47fa7f2b356bddd0a87f07ed32d61ec56fe
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2c84006f5ac11cb9b2409401cb381abb4d7a19e5
Log:
Add test function arguments
Changed paths:
A Zend/tests/return_types/internal_functions001.phpt
A Zend/tests/return_types/internal_functions002.phpt
M Zend/zend_builtin_functions.c
Diff:
diff --git a/Zend/tests/return_types/internal_functions001.phpt
b/Zend/tests/return_types/internal_functions001.phpt
new file mode 100644
index 0000000..8204161
--- /dev/null
+++ b/Zend/tests/return_types/internal_functions001.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Return type hinting for internal functions
+
+--SKIPIF--
+<?php
+if (!function_exists('zend_test_func')) {
+ print 'skip';
+}
+
+--FILE--
+<?php
+zend_test_func();
+?>
+--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 0000000..65838a1
--- /dev/null
+++ b/Zend/tests/return_types/internal_functions002.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Return type hinting for internal functions 2
+
+--SKIPIF--
+<?php
+if (!function_exists('zend_test_func2')) {
+ print 'skip';
+}
+
+--FILE--
+<?php
+zend_test_func2();
+echo "==DONE==\n"
+?>
+--EXPECTF--
+==DONE==
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 2fce4b7..fe7c8f7 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)