diff --git a/NEWS b/NEWS index b1abfcaf440f0..0d98044331285 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS . Fixed incorrect check condition in ZEND_YIELD. (nielsdos) . Fixed incorrect check condition in type inference. (nielsdos) . Fix incorrect check in zend_internal_call_should_throw(). (nielsdos) + . arginfo / zpp validation can now be skipped on debug build with + ZEND_SUPPRESS_ARGINFO_ZPP_MISMATCH=1 (zeriyoshi) - FFI: . Fixed incorrect bitshifting and masking in ffi bitfield. (nielsdos) diff --git a/Zend/tests/arginfo_zpp_mismatch.inc b/Zend/tests/arginfo_zpp_mismatch.inc index 221c347aaa915..57bc23949204e 100644 --- a/Zend/tests/arginfo_zpp_mismatch.inc +++ b/Zend/tests/arginfo_zpp_mismatch.inc @@ -10,6 +10,7 @@ function skipFunction($function): bool { || $function === 'zend_create_unterminated_string' || $function === 'zend_test_array_return' || $function === 'zend_leak_bytes' + || $function === 'zend_test_arginfo_zpp_mismatch' /* mess with output */ || (is_string($function) && str_starts_with($function, 'ob_')) || $function === 'output_add_rewrite_var' diff --git a/Zend/tests/arginfo_zpp_mismatch_suppress.phpt b/Zend/tests/arginfo_zpp_mismatch_suppress.phpt new file mode 100644 index 0000000000000..392cd4c215e5b --- /dev/null +++ b/Zend/tests/arginfo_zpp_mismatch_suppress.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test suppressing arginfo / zpp mismatch +--EXTENSIONS-- +zend_test +--SKIPIF-- + +--ENV-- +ZEND_SUPPRESS_ARGINFO_ZPP_MISMATCH=1 +--FILE-- + +--ENV-- +ZEND_SUPPRESS_ARGINFO_ZPP_MISMATCH=0 +--FILE-- +internal_function.handler == ZEND_FN(pass) || (fbc->internal_function.fn_flags & ZEND_ACC_FAKE_CLOSURE)) { /* Be lenient about the special pass function and about fake closures. */ return 0; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 17469fab0c11e..957ad61c29437 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -271,6 +271,10 @@ struct _zend_executor_globals { zend_string *filename_override; zend_long lineno_override; +#ifdef ZEND_DEBUG + bool suppress_arginfo_zpp_mismatch; +#endif + void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 96898d2d71f1c..f89828af89308 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -335,8 +335,21 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_iterable_legacy, 0, 1, IS_I ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arg2, IS_ITERABLE, 1, "null") ZEND_END_ARG_INFO() +static ZEND_FUNCTION(zend_test_arginfo_zpp_mismatch) +{ + zend_long foo; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(foo); + ZEND_PARSE_PARAMETERS_END(); +} + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_arginfo_zpp_mismatch, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + static const zend_function_entry ext_function_legacy[] = { ZEND_FE(zend_iterable_legacy, arginfo_zend_iterable_legacy) + ZEND_FE(zend_test_arginfo_zpp_mismatch, arginfo_zend_test_arginfo_zpp_mismatch) ZEND_FE_END };