Skip to content

Commit 8faa6ef

Browse files
committed
Add test for void return type on internal function
1 parent 7909d45 commit 8faa6ef

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Return type for internal functions 3: Void return type
3+
--SKIPIF--
4+
<?php
5+
if (!function_exists('zend_test_void_return')) die('skip');
6+
--FILE--
7+
<?php
8+
var_dump(zend_test_void_return());
9+
?>
10+
--EXPECT--
11+
NULL

ext/zend_test/test.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ ZEND_END_ARG_INFO()
3737
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_nullable_array_return, IS_ARRAY, 1)
3838
ZEND_END_ARG_INFO()
3939

40+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_void_return, IS_VOID, 0)
41+
ZEND_END_ARG_INFO()
42+
4043
ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_terminate_string, 0, 0, 1)
4144
ZEND_ARG_INFO(1, str)
4245
ZEND_END_ARG_INFO()
@@ -64,6 +67,11 @@ ZEND_FUNCTION(zend_test_nullable_array_return)
6467
zend_parse_parameters(ZEND_NUM_ARGS(), "|zz", &arg1, &arg2);
6568
}
6669

70+
ZEND_FUNCTION(zend_test_void_return)
71+
{
72+
/* dummy */
73+
}
74+
6775
/* Create a string without terminating null byte. Must be termined with
6876
* zend_terminate_string() before destruction, otherwise a warning is issued
6977
* in debug builds. */
@@ -239,6 +247,7 @@ PHP_MINFO_FUNCTION(zend_test)
239247
static const zend_function_entry zend_test_functions[] = {
240248
ZEND_FE(zend_test_array_return, arginfo_zend_test_array_return)
241249
ZEND_FE(zend_test_nullable_array_return, arginfo_zend_test_nullable_array_return)
250+
ZEND_FE(zend_test_void_return, arginfo_zend_test_void_return)
242251
ZEND_FE(zend_create_unterminated_string, NULL)
243252
ZEND_FE(zend_terminate_string, arginfo_zend_terminate_string)
244253
ZEND_FE(zend_leak_bytes, NULL)

0 commit comments

Comments
 (0)