diff --git a/Zend/tests/number_or_str_zpp.phpt b/Zend/tests/number_or_str_zpp.phpt deleted file mode 100644 index 6ee47ec6f63d..000000000000 --- a/Zend/tests/number_or_str_zpp.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -Test Z_PARAM_NUMBER_OR_STR() and Z_PARAM_NUMBER_OR_STR_OR_NULL ---EXTENSIONS-- -zend_test ---FILE-- -getMessage() . "\n"; -} -try { - zend_number_or_string(new Foo()); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} - -var_dump(zend_number_or_string_or_null("string")); -var_dump(zend_number_or_string_or_null(1)); -var_dump(zend_number_or_string_or_null(5.5)); -var_dump(zend_number_or_string_or_null(null)); -var_dump(zend_number_or_string_or_null(false)); -var_dump(zend_number_or_string_or_null(true)); -var_dump(zend_number_or_string_or_null(new ToString())); - -try { - zend_number_or_string_or_null([]); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} -try { - zend_number_or_string_or_null(new Foo()); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} - -?> ---EXPECTF-- -string(6) "string" -int(1) -float(5.5) - -Deprecated: zend_number_or_string(): Passing null to parameter #1 ($param) of type string|int|float is deprecated in %s on line %d -int(0) -int(0) -int(1) -string(8) "ToString" -zend_string_or_object(): Argument #1 ($param) must be of type object|string, array given -zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, Foo given -string(6) "string" -int(1) -float(5.5) -NULL -int(0) -int(1) -string(8) "ToString" -zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, array given -zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, Foo given diff --git a/Zend/tests/str_or_obj_of_class_zpp.phpt b/Zend/tests/str_or_obj_of_class_zpp.phpt deleted file mode 100644 index dec9bee69d5c..000000000000 --- a/Zend/tests/str_or_obj_of_class_zpp.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL ---EXTENSIONS-- -zend_test ---FILE-- -getMessage() . "\n"; -} - -try { - zend_string_or_stdclass(new Foo()); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} - -var_dump(zend_string_or_stdclass_or_null("string")); -var_dump(zend_string_or_stdclass_or_null(1)); -var_dump(zend_string_or_stdclass_or_null(null)); -var_dump(zend_string_or_stdclass_or_null(new stdClass())); -var_dump(zend_string_or_stdclass_or_null(new ToString())); - -try { - zend_string_or_stdclass_or_null([]); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} - -try { - zend_string_or_stdclass_or_null(new Foo()); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} - -?> ---EXPECTF-- -string(6) "string" -string(1) "1" - -Deprecated: zend_string_or_stdclass(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d -string(0) "" -object(stdClass)#1 (0) { -} -string(8) "ToString" -zend_string_or_stdclass(): Argument #1 ($param) must be of type stdClass|string, array given -zend_string_or_stdclass(): Argument #1 ($param) must be of type stdClass|string, Foo given -string(6) "string" -string(1) "1" -NULL -object(stdClass)#1 (0) { -} -string(8) "ToString" -zend_string_or_stdclass_or_null(): Argument #1 ($param) must be of type stdClass|string|null, array given -zend_string_or_stdclass_or_null(): Argument #1 ($param) must be of type stdClass|string|null, Foo given diff --git a/Zend/tests/str_or_obj_zpp.phpt b/Zend/tests/str_or_obj_zpp.phpt deleted file mode 100644 index 3c71bde5fd3a..000000000000 --- a/Zend/tests/str_or_obj_zpp.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Test Z_PARAM_OBJ_OR_STR() and Z_PARAM_OBJ_OR_STR_OR_NULL ---EXTENSIONS-- -zend_test ---FILE-- -getMessage() . "\n"; -} - -var_dump(zend_string_or_object_or_null("string")); -var_dump(zend_string_or_object_or_null(1)); -var_dump(zend_string_or_object_or_null(null)); -var_dump(zend_string_or_object_or_null(new stdClass())); -var_dump(zend_string_or_object_or_null(new Foo())); - -try { - zend_string_or_object_or_null([]); -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; -} - -?> ---EXPECTF-- -string(6) "string" -string(1) "1" - -Deprecated: zend_string_or_object(): Passing null to parameter #1 ($param) of type object|string is deprecated in %s on line %d -string(0) "" -object(stdClass)#1 (0) { -} -object(Foo)#1 (0) { -} -zend_string_or_object(): Argument #1 ($param) must be of type object|string, array given -string(6) "string" -string(1) "1" -NULL -object(stdClass)#2 (0) { -} -object(Foo)#2 (0) { -} -zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, array given diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index a880c09fc1ff..d4e3f53e48cc 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -225,6 +225,213 @@ static ZEND_FUNCTION(zend_delref) RETURN_NULL(); } +/* BEGIN ZPP test functions */ +static ZEND_FUNCTION(zend_bool) +{ + bool v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_BOOL(v); +} + +static ZEND_FUNCTION(zend_bool_or_null) +{ + bool v; + bool is_null; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL_OR_NULL(v, is_null) + ZEND_PARSE_PARAMETERS_END(); + + if (is_null) { + RETURN_NULL(); + } + RETURN_BOOL(v); +} + +static ZEND_FUNCTION(zend_bool_slow_zpp) +{ + bool v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_BOOL(v); +} + +static ZEND_FUNCTION(zend_bool_or_null_slow_zpp) +{ + bool v; + bool is_null; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b!", &v, &is_null) == FAILURE) { + RETURN_THROWS(); + } + + if (is_null) { + RETURN_NULL(); + } + RETURN_BOOL(v); +} + +static ZEND_FUNCTION(zend_int) +{ + zend_long v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_LONG(v); +} + +static ZEND_FUNCTION(zend_int_or_null) +{ + zend_long v; + bool is_null; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG_OR_NULL(v, is_null) + ZEND_PARSE_PARAMETERS_END(); + + if (is_null) { + RETURN_NULL(); + } + RETURN_LONG(v); +} + +static ZEND_FUNCTION(zend_int_slow_zpp) +{ + zend_long v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_LONG(v); +} + +static ZEND_FUNCTION(zend_int_or_null_slow_zpp) +{ + zend_long v; + bool is_null; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l!", &v, &is_null) == FAILURE) { + RETURN_THROWS(); + } + + if (is_null) { + RETURN_NULL(); + } + RETURN_LONG(v); +} + +static ZEND_FUNCTION(zend_float) +{ + double v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_DOUBLE(v); +} + +static ZEND_FUNCTION(zend_float_or_null) +{ + double v; + bool is_null; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE_OR_NULL(v, is_null) + ZEND_PARSE_PARAMETERS_END(); + + if (is_null) { + RETURN_NULL(); + } + RETURN_DOUBLE(v); +} + +static ZEND_FUNCTION(zend_float_slow_zpp) +{ + double v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_DOUBLE(v); +} + +static ZEND_FUNCTION(zend_float_or_null_slow_zpp) +{ + double v; + bool is_null; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d!", &v, &is_null) == FAILURE) { + RETURN_THROWS(); + } + + if (is_null) { + RETURN_NULL(); + } + RETURN_DOUBLE(v); +} + +static ZEND_FUNCTION(zend_number) +{ + zval *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_NUMBER(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_number_or_null) +{ + zval *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_NUMBER_OR_NULL(v) + ZEND_PARSE_PARAMETERS_END(); + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_number_slow_zpp) +{ + zval *v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "n", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_number_or_null_slow_zpp) +{ + zval *v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "n!", &v) == FAILURE) { + RETURN_THROWS(); + } + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_COPY(v); +} + /* Tests Z_PARAM_OBJ_OR_STR */ static ZEND_FUNCTION(zend_string_or_object) { @@ -278,41 +485,6 @@ static ZEND_FUNCTION(zend_string_or_stdclass) } } -static ZEND_FUNCTION(zend_test_compile_string) -{ - zend_string *source_string = NULL; - zend_string *filename = NULL; - zend_long position = ZEND_COMPILE_POSITION_AT_OPEN_TAG; - - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(source_string) - Z_PARAM_PATH_STR(filename) - Z_PARAM_LONG(position) - ZEND_PARSE_PARAMETERS_END(); - - zend_op_array *op_array = NULL; - - op_array = compile_string(source_string, ZSTR_VAL(filename), position); - - if (op_array) { - zval retval; - - zend_try { - ZVAL_UNDEF(&retval); - zend_execute(op_array, &retval); - } zend_catch { - destroy_op_array(op_array); - efree_size(op_array, sizeof(zend_op_array)); - zend_bailout(); - } zend_end_try(); - - destroy_op_array(op_array); - efree_size(op_array, sizeof(zend_op_array)); - } - - return; -} - /* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL */ static ZEND_FUNCTION(zend_string_or_stdclass_or_null) { @@ -376,6 +548,77 @@ static ZEND_FUNCTION(zend_number_or_string_or_null) } } +/* TESTS Z_PARAM_ITERABLE and Z_PARAM_ITERABLE_OR_NULL */ +static ZEND_FUNCTION(zend_iterable) +{ + zval *arg1, *arg2; + + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ITERABLE(arg1) + Z_PARAM_OPTIONAL + Z_PARAM_ITERABLE_OR_NULL(arg2) + ZEND_PARSE_PARAMETERS_END(); +} + +static ZEND_FUNCTION(zend_iterable_legacy) +{ + zval *arg1, *arg2; + + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ITERABLE(arg1) + Z_PARAM_OPTIONAL + Z_PARAM_ITERABLE_OR_NULL(arg2) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_COPY(arg1); +} + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_iterable_legacy, 0, 1, IS_ITERABLE, 0) + ZEND_ARG_TYPE_INFO(0, arg1, IS_ITERABLE, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arg2, IS_ITERABLE, 1, "null") +ZEND_END_ARG_INFO() + +static const zend_function_entry ext_function_legacy[] = { + ZEND_FE(zend_iterable_legacy, arginfo_zend_iterable_legacy) + ZEND_FE_END +}; +/* END ZPP test functions */ + +static ZEND_FUNCTION(zend_test_compile_string) +{ + zend_string *source_string = NULL; + zend_string *filename = NULL; + zend_long position = ZEND_COMPILE_POSITION_AT_OPEN_TAG; + + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_STR(source_string) + Z_PARAM_PATH_STR(filename) + Z_PARAM_LONG(position) + ZEND_PARSE_PARAMETERS_END(); + + zend_op_array *op_array = NULL; + + op_array = compile_string(source_string, ZSTR_VAL(filename), position); + + if (op_array) { + zval retval; + + zend_try { + ZVAL_UNDEF(&retval); + zend_execute(op_array, &retval); + } zend_catch { + destroy_op_array(op_array); + efree_size(op_array, sizeof(zend_op_array)); + zend_bailout(); + } zend_end_try(); + + destroy_op_array(op_array); + efree_size(op_array, sizeof(zend_op_array)); + } + + return; +} + static ZEND_FUNCTION(zend_weakmap_attach) { zval *value; @@ -435,41 +678,6 @@ static ZEND_FUNCTION(zend_test_override_libxml_global_state) } #endif -/* TESTS Z_PARAM_ITERABLE and Z_PARAM_ITERABLE_OR_NULL */ -static ZEND_FUNCTION(zend_iterable) -{ - zval *arg1, *arg2; - - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ITERABLE(arg1) - Z_PARAM_OPTIONAL - Z_PARAM_ITERABLE_OR_NULL(arg2) - ZEND_PARSE_PARAMETERS_END(); -} - -static ZEND_FUNCTION(zend_iterable_legacy) -{ - zval *arg1, *arg2; - - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ITERABLE(arg1) - Z_PARAM_OPTIONAL - Z_PARAM_ITERABLE_OR_NULL(arg2) - ZEND_PARSE_PARAMETERS_END(); - - RETURN_COPY(arg1); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_iterable_legacy, 0, 1, IS_ITERABLE, 0) - ZEND_ARG_TYPE_INFO(0, arg1, IS_ITERABLE, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arg2, IS_ITERABLE, 1, "null") -ZEND_END_ARG_INFO() - -static const zend_function_entry ext_function_legacy[] = { - ZEND_FE(zend_iterable_legacy, arginfo_zend_iterable_legacy) - ZEND_FE_END -}; - /* Call a method on a class or object using zend_call_method() */ static ZEND_FUNCTION(zend_call_method) { diff --git a/ext/zend_test/test.stub.php b/ext/zend_test/test.stub.php index 7c96ea176a88..b313ffc909b4 100644 --- a/ext/zend_test/test.stub.php +++ b/ext/zend_test/test.stub.php @@ -299,6 +299,26 @@ function zend_leak_bytes(int $bytes = 3): void {} function zend_delref(mixed $variable): void {} + function zend_bool(bool $param): bool {} + function zend_bool_or_null(bool|null $param): bool|null {} + function zend_bool_slow_zpp(bool $param): bool {} + function zend_bool_or_null_slow_zpp(bool|null $param): bool|null {} + + function zend_int(int $param): int {} + function zend_int_or_null(int|null $param): int|null {} + function zend_int_slow_zpp(int $param): int {} + function zend_int_or_null_slow_zpp(int|null $param): int|null {} + + function zend_float(float $param): float {} + function zend_float_or_null(float|null $param): float|null {} + function zend_float_slow_zpp(float $param): float {} + function zend_float_or_null_slow_zpp(float|null $param): float|null {} + + function zend_number(int|float $param): int|float {} + function zend_number_or_null(int|float|null $param): int|float|null {} + function zend_number_slow_zpp(int|float $param): int|float {} + function zend_number_or_null_slow_zpp(int|float|null $param): int|float|null {} + function zend_string_or_object(object|string $param): object|string {} function zend_string_or_object_or_null(object|string|null $param): object|string|null {} diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h index b2e342382db7..70f1937e6930 100644 --- a/ext/zend_test/test_arginfo.h +++ b/ext/zend_test/test_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit test.stub.php instead. - * Stub hash: a221a3df3815679d61fd546ba120fd3a374fe71f + * Stub hash: 644affbfdb8223583e0c401fa1243a84ed4636ad * Has decl header: yes */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_trigger_bailout, 0, 0, IS_NEVER, 0) @@ -53,6 +53,54 @@ ZEND_END_ARG_INFO() #define arginfo_zend_delref arginfo_zend_leak_variable +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_bool, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, param, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_bool_or_null, 0, 1, _IS_BOOL, 1) + ZEND_ARG_TYPE_INFO(0, param, _IS_BOOL, 1) +ZEND_END_ARG_INFO() + +#define arginfo_zend_bool_slow_zpp arginfo_zend_bool + +#define arginfo_zend_bool_or_null_slow_zpp arginfo_zend_bool_or_null + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_int, 0, 1, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, param, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_int_or_null, 0, 1, IS_LONG, 1) + ZEND_ARG_TYPE_INFO(0, param, IS_LONG, 1) +ZEND_END_ARG_INFO() + +#define arginfo_zend_int_slow_zpp arginfo_zend_int + +#define arginfo_zend_int_or_null_slow_zpp arginfo_zend_int_or_null + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_float, 0, 1, IS_DOUBLE, 0) + ZEND_ARG_TYPE_INFO(0, param, IS_DOUBLE, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_float_or_null, 0, 1, IS_DOUBLE, 1) + ZEND_ARG_TYPE_INFO(0, param, IS_DOUBLE, 1) +ZEND_END_ARG_INFO() + +#define arginfo_zend_float_slow_zpp arginfo_zend_float + +#define arginfo_zend_float_or_null_slow_zpp arginfo_zend_float_or_null + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zend_number, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE) + ZEND_ARG_TYPE_MASK(0, param, MAY_BE_LONG|MAY_BE_DOUBLE, NULL) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zend_number_or_null, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_NULL) + ZEND_ARG_TYPE_MASK(0, param, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_NULL, NULL) +ZEND_END_ARG_INFO() + +#define arginfo_zend_number_slow_zpp arginfo_zend_number + +#define arginfo_zend_number_or_null_slow_zpp arginfo_zend_number_or_null + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zend_string_or_object, 0, 1, MAY_BE_OBJECT|MAY_BE_STRING) ZEND_ARG_TYPE_MASK(0, param, MAY_BE_OBJECT|MAY_BE_STRING, NULL) ZEND_END_ARG_INFO() @@ -313,6 +361,22 @@ static ZEND_FUNCTION(zend_terminate_string); static ZEND_FUNCTION(zend_leak_variable); static ZEND_FUNCTION(zend_leak_bytes); static ZEND_FUNCTION(zend_delref); +static ZEND_FUNCTION(zend_bool); +static ZEND_FUNCTION(zend_bool_or_null); +static ZEND_FUNCTION(zend_bool_slow_zpp); +static ZEND_FUNCTION(zend_bool_or_null_slow_zpp); +static ZEND_FUNCTION(zend_int); +static ZEND_FUNCTION(zend_int_or_null); +static ZEND_FUNCTION(zend_int_slow_zpp); +static ZEND_FUNCTION(zend_int_or_null_slow_zpp); +static ZEND_FUNCTION(zend_float); +static ZEND_FUNCTION(zend_float_or_null); +static ZEND_FUNCTION(zend_float_slow_zpp); +static ZEND_FUNCTION(zend_float_or_null_slow_zpp); +static ZEND_FUNCTION(zend_number); +static ZEND_FUNCTION(zend_number_or_null); +static ZEND_FUNCTION(zend_number_slow_zpp); +static ZEND_FUNCTION(zend_number_or_null_slow_zpp); static ZEND_FUNCTION(zend_string_or_object); static ZEND_FUNCTION(zend_string_or_object_or_null); static ZEND_FUNCTION(zend_string_or_stdclass); @@ -449,6 +513,22 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(zend_leak_variable, arginfo_zend_leak_variable) ZEND_FE(zend_leak_bytes, arginfo_zend_leak_bytes) ZEND_FE(zend_delref, arginfo_zend_delref) + ZEND_FE(zend_bool, arginfo_zend_bool) + ZEND_FE(zend_bool_or_null, arginfo_zend_bool_or_null) + ZEND_FE(zend_bool_slow_zpp, arginfo_zend_bool_slow_zpp) + ZEND_FE(zend_bool_or_null_slow_zpp, arginfo_zend_bool_or_null_slow_zpp) + ZEND_FE(zend_int, arginfo_zend_int) + ZEND_FE(zend_int_or_null, arginfo_zend_int_or_null) + ZEND_FE(zend_int_slow_zpp, arginfo_zend_int_slow_zpp) + ZEND_FE(zend_int_or_null_slow_zpp, arginfo_zend_int_or_null_slow_zpp) + ZEND_FE(zend_float, arginfo_zend_float) + ZEND_FE(zend_float_or_null, arginfo_zend_float_or_null) + ZEND_FE(zend_float_slow_zpp, arginfo_zend_float_slow_zpp) + ZEND_FE(zend_float_or_null_slow_zpp, arginfo_zend_float_or_null_slow_zpp) + ZEND_FE(zend_number, arginfo_zend_number) + ZEND_FE(zend_number_or_null, arginfo_zend_number_or_null) + ZEND_FE(zend_number_slow_zpp, arginfo_zend_number_slow_zpp) + ZEND_FE(zend_number_or_null_slow_zpp, arginfo_zend_number_or_null_slow_zpp) ZEND_FE(zend_string_or_object, arginfo_zend_string_or_object) ZEND_FE(zend_string_or_object_or_null, arginfo_zend_string_or_object_or_null) ZEND_FE(zend_string_or_stdclass, arginfo_zend_string_or_stdclass) diff --git a/ext/zend_test/test_decl.h b/ext/zend_test/test_decl.h index ea6a2c94fbdf..4c71de5474e5 100644 --- a/ext/zend_test/test_decl.h +++ b/ext/zend_test/test_decl.h @@ -1,8 +1,8 @@ /* This is a generated file, edit test.stub.php instead. - * Stub hash: a221a3df3815679d61fd546ba120fd3a374fe71f */ + * Stub hash: 644affbfdb8223583e0c401fa1243a84ed4636ad */ -#ifndef ZEND_TEST_DECL_a221a3df3815679d61fd546ba120fd3a374fe71f_H -#define ZEND_TEST_DECL_a221a3df3815679d61fd546ba120fd3a374fe71f_H +#ifndef ZEND_TEST_DECL_644affbfdb8223583e0c401fa1243a84ed4636ad_H +#define ZEND_TEST_DECL_644affbfdb8223583e0c401fa1243a84ed4636ad_H typedef enum zend_enum_ZendTestUnitEnum { ZEND_ENUM_ZendTestUnitEnum_Foo = 1, @@ -27,4 +27,4 @@ typedef enum zend_enum_ZendTestEnumWithInterface { ZEND_ENUM_ZendTestEnumWithInterface_Bar = 2, } zend_enum_ZendTestEnumWithInterface; -#endif /* ZEND_TEST_DECL_a221a3df3815679d61fd546ba120fd3a374fe71f_H */ +#endif /* ZEND_TEST_DECL_644affbfdb8223583e0c401fa1243a84ed4636ad_H */ diff --git a/ext/zend_test/test_legacy_arginfo.h b/ext/zend_test/test_legacy_arginfo.h index 05014c80fd5d..e40c7b875ed6 100644 --- a/ext/zend_test/test_legacy_arginfo.h +++ b/ext/zend_test/test_legacy_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit test.stub.php instead. - * Stub hash: a221a3df3815679d61fd546ba120fd3a374fe71f + * Stub hash: 644affbfdb8223583e0c401fa1243a84ed4636ad * Has decl header: yes */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_trigger_bailout, 0, 0, 0) @@ -49,19 +49,51 @@ ZEND_END_ARG_INFO() #define arginfo_zend_delref arginfo_zend_leak_variable -ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_string_or_object, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_bool, 0, 0, 1) ZEND_ARG_INFO(0, param) ZEND_END_ARG_INFO() -#define arginfo_zend_string_or_object_or_null arginfo_zend_string_or_object +#define arginfo_zend_bool_or_null arginfo_zend_bool -#define arginfo_zend_string_or_stdclass arginfo_zend_string_or_object +#define arginfo_zend_bool_slow_zpp arginfo_zend_bool -#define arginfo_zend_string_or_stdclass_or_null arginfo_zend_string_or_object +#define arginfo_zend_bool_or_null_slow_zpp arginfo_zend_bool -#define arginfo_zend_number_or_string arginfo_zend_string_or_object +#define arginfo_zend_int arginfo_zend_bool -#define arginfo_zend_number_or_string_or_null arginfo_zend_string_or_object +#define arginfo_zend_int_or_null arginfo_zend_bool + +#define arginfo_zend_int_slow_zpp arginfo_zend_bool + +#define arginfo_zend_int_or_null_slow_zpp arginfo_zend_bool + +#define arginfo_zend_float arginfo_zend_bool + +#define arginfo_zend_float_or_null arginfo_zend_bool + +#define arginfo_zend_float_slow_zpp arginfo_zend_bool + +#define arginfo_zend_float_or_null_slow_zpp arginfo_zend_bool + +#define arginfo_zend_number arginfo_zend_bool + +#define arginfo_zend_number_or_null arginfo_zend_bool + +#define arginfo_zend_number_slow_zpp arginfo_zend_bool + +#define arginfo_zend_number_or_null_slow_zpp arginfo_zend_bool + +#define arginfo_zend_string_or_object arginfo_zend_bool + +#define arginfo_zend_string_or_object_or_null arginfo_zend_bool + +#define arginfo_zend_string_or_stdclass arginfo_zend_bool + +#define arginfo_zend_string_or_stdclass_or_null arginfo_zend_bool + +#define arginfo_zend_number_or_string arginfo_zend_bool + +#define arginfo_zend_number_or_string_or_null arginfo_zend_bool ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_iterable, 0, 0, 1) ZEND_ARG_INFO(0, arg1) @@ -276,6 +308,22 @@ static ZEND_FUNCTION(zend_terminate_string); static ZEND_FUNCTION(zend_leak_variable); static ZEND_FUNCTION(zend_leak_bytes); static ZEND_FUNCTION(zend_delref); +static ZEND_FUNCTION(zend_bool); +static ZEND_FUNCTION(zend_bool_or_null); +static ZEND_FUNCTION(zend_bool_slow_zpp); +static ZEND_FUNCTION(zend_bool_or_null_slow_zpp); +static ZEND_FUNCTION(zend_int); +static ZEND_FUNCTION(zend_int_or_null); +static ZEND_FUNCTION(zend_int_slow_zpp); +static ZEND_FUNCTION(zend_int_or_null_slow_zpp); +static ZEND_FUNCTION(zend_float); +static ZEND_FUNCTION(zend_float_or_null); +static ZEND_FUNCTION(zend_float_slow_zpp); +static ZEND_FUNCTION(zend_float_or_null_slow_zpp); +static ZEND_FUNCTION(zend_number); +static ZEND_FUNCTION(zend_number_or_null); +static ZEND_FUNCTION(zend_number_slow_zpp); +static ZEND_FUNCTION(zend_number_or_null_slow_zpp); static ZEND_FUNCTION(zend_string_or_object); static ZEND_FUNCTION(zend_string_or_object_or_null); static ZEND_FUNCTION(zend_string_or_stdclass); @@ -384,6 +432,22 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(zend_leak_variable, arginfo_zend_leak_variable) ZEND_FE(zend_leak_bytes, arginfo_zend_leak_bytes) ZEND_FE(zend_delref, arginfo_zend_delref) + ZEND_FE(zend_bool, arginfo_zend_bool) + ZEND_FE(zend_bool_or_null, arginfo_zend_bool_or_null) + ZEND_FE(zend_bool_slow_zpp, arginfo_zend_bool_slow_zpp) + ZEND_FE(zend_bool_or_null_slow_zpp, arginfo_zend_bool_or_null_slow_zpp) + ZEND_FE(zend_int, arginfo_zend_int) + ZEND_FE(zend_int_or_null, arginfo_zend_int_or_null) + ZEND_FE(zend_int_slow_zpp, arginfo_zend_int_slow_zpp) + ZEND_FE(zend_int_or_null_slow_zpp, arginfo_zend_int_or_null_slow_zpp) + ZEND_FE(zend_float, arginfo_zend_float) + ZEND_FE(zend_float_or_null, arginfo_zend_float_or_null) + ZEND_FE(zend_float_slow_zpp, arginfo_zend_float_slow_zpp) + ZEND_FE(zend_float_or_null_slow_zpp, arginfo_zend_float_or_null_slow_zpp) + ZEND_FE(zend_number, arginfo_zend_number) + ZEND_FE(zend_number_or_null, arginfo_zend_number_or_null) + ZEND_FE(zend_number_slow_zpp, arginfo_zend_number_slow_zpp) + ZEND_FE(zend_number_or_null_slow_zpp, arginfo_zend_number_or_null_slow_zpp) ZEND_FE(zend_string_or_object, arginfo_zend_string_or_object) ZEND_FE(zend_string_or_object_or_null, arginfo_zend_string_or_object_or_null) ZEND_FE(zend_string_or_stdclass, arginfo_zend_string_or_stdclass) diff --git a/ext/zend_test/tests/zpp/bool_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/bool_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..74d7c3749e9d --- /dev/null +++ b/ext/zend_test/tests/zpp/bool_zpp_specifier_strict_mode.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test bool ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_bool($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, null given +NULL +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, null given +NULL +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, null given +NULL +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, null given +NULL +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, int given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, int given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, int given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, int given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, int given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, int given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, int given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, int given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, float given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, float given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, float given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, float given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, float given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, float given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, float given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, float given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, string given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, string given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, resource given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, resource given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, resource given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, resource given diff --git a/ext/zend_test/tests/zpp/bool_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/bool_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..55822ef721e4 --- /dev/null +++ b/ext/zend_test/tests/zpp/bool_zpp_specifier_weak_mode.phpt @@ -0,0 +1,158 @@ +--TEST-- +Test bool ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_bool($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_bool_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_bool(): Passing null to parameter #1 ($param) of type bool is deprecated in %s on line %d +bool(false) +NULL + +Deprecated: zend_bool_slow_zpp(): Passing null to parameter #1 ($param) of type bool is deprecated in %s on line %d +bool(false) +NULL + +Deprecated: zend_bool(): Passing null to parameter #1 ($param) of type bool is deprecated in %s on line %d +bool(false) +NULL + +Deprecated: zend_bool_slow_zpp(): Passing null to parameter #1 ($param) of type bool is deprecated in %s on line %d +bool(false) +NULL +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, array given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, array given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, stdClass given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, stdClass given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, S given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, S given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, resource given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, resource given +TypeError: zend_bool(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null(): Argument #1 ($param) must be of type ?bool, resource given +TypeError: zend_bool_slow_zpp(): Argument #1 ($param) must be of type bool, resource given +TypeError: zend_bool_or_null_slow_zpp(): Argument #1 ($param) must be of type ?bool, resource given diff --git a/ext/zend_test/tests/zpp/class-string_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/class-string_zpp_specifier_strict_mode.phpt index a72d504a2db3..e3e17311132a 100644 --- a/ext/zend_test/tests/zpp/class-string_zpp_specifier_strict_mode.phpt +++ b/ext/zend_test/tests/zpp/class-string_zpp_specifier_strict_mode.phpt @@ -7,24 +7,7 @@ zend_test declare(strict_types=1); -class S { - public function __toString(): string { - return 'S class'; - } -} - -$types = [ - null, - false, - true, - 42, - 73.5, - 'string', - [], - new stdClass(), - new S(), - STDOUT, -]; +$types = require 'types.inc'; foreach ($types as $type) { /* Use zend_object_init_with_constructor() function as it used Z_PARAM_CLASS */ @@ -43,6 +26,8 @@ TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, int given TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, float given TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, string given +TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, 15 given +TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, 56.7 given TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, array given TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, stdClass given TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, S given diff --git a/ext/zend_test/tests/zpp/class-string_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/class-string_zpp_specifier_weak_mode.phpt index 2110ecc4a0e4..33a4231bdcce 100644 --- a/ext/zend_test/tests/zpp/class-string_zpp_specifier_weak_mode.phpt +++ b/ext/zend_test/tests/zpp/class-string_zpp_specifier_weak_mode.phpt @@ -5,24 +5,7 @@ zend_test --FILE-- getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_float($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +TypeError: zend_float(): Argument #1 ($param) must be of type float, null given +NULL +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, null given +NULL +TypeError: zend_float(): Argument #1 ($param) must be of type float, null given +NULL +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, null given +NULL +TypeError: zend_float(): Argument #1 ($param) must be of type float, false given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, false given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, false given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, false given +TypeError: zend_float(): Argument #1 ($param) must be of type float, false given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, false given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, false given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, false given +TypeError: zend_float(): Argument #1 ($param) must be of type float, true given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, true given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, true given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, true given +TypeError: zend_float(): Argument #1 ($param) must be of type float, true given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, true given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, true given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, true given +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, resource given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, resource given +TypeError: zend_float(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, resource given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, resource given diff --git a/ext/zend_test/tests/zpp/float_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/float_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..f3736cc483b6 --- /dev/null +++ b/ext/zend_test/tests/zpp/float_zpp_specifier_weak_mode.phpt @@ -0,0 +1,158 @@ +--TEST-- +Test float ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_float($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_float_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_float(): Passing null to parameter #1 ($param) of type float is deprecated in %s on line %d +float(0) +NULL + +Deprecated: zend_float_slow_zpp(): Passing null to parameter #1 ($param) of type float is deprecated in %s on line %d +float(0) +NULL + +Deprecated: zend_float(): Passing null to parameter #1 ($param) of type float is deprecated in %s on line %d +float(0) +NULL + +Deprecated: zend_float_slow_zpp(): Passing null to parameter #1 ($param) of type float is deprecated in %s on line %d +float(0) +NULL +float(0) +float(0) +float(0) +float(0) +float(0) +float(0) +float(0) +float(0) +float(1) +float(1) +float(1) +float(1) +float(1) +float(1) +float(1) +float(1) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, string given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, string given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, string given +float(15) +float(15) +float(15) +float(15) +float(15) +float(15) +float(15) +float(15) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +TypeError: zend_float(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, array given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, array given +TypeError: zend_float(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, stdClass given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, stdClass given +TypeError: zend_float(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, S given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, S given +TypeError: zend_float(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, resource given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, resource given +TypeError: zend_float(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null(): Argument #1 ($param) must be of type ?float, resource given +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, resource given +TypeError: zend_float_or_null_slow_zpp(): Argument #1 ($param) must be of type ?float, resource given diff --git a/ext/zend_test/tests/zpp/int_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/int_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..bb903fc3ce59 --- /dev/null +++ b/ext/zend_test/tests/zpp/int_zpp_specifier_strict_mode.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test int ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_int($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +TypeError: zend_int(): Argument #1 ($param) must be of type int, null given +NULL +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, null given +NULL +TypeError: zend_int(): Argument #1 ($param) must be of type int, null given +NULL +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, null given +NULL +TypeError: zend_int(): Argument #1 ($param) must be of type int, false given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, false given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, false given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, false given +TypeError: zend_int(): Argument #1 ($param) must be of type int, false given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, false given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, false given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, false given +TypeError: zend_int(): Argument #1 ($param) must be of type int, true given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, true given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, true given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, true given +TypeError: zend_int(): Argument #1 ($param) must be of type int, true given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, true given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, true given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, true given +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +TypeError: zend_int(): Argument #1 ($param) must be of type int, float given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, float given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, float given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, float given +TypeError: zend_int(): Argument #1 ($param) must be of type int, float given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, float given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, float given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, float given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, resource given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, resource given +TypeError: zend_int(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, resource given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, resource given diff --git a/ext/zend_test/tests/zpp/int_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/int_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..0bdfb5426f98 --- /dev/null +++ b/ext/zend_test/tests/zpp/int_zpp_specifier_weak_mode.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test int ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_int($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_int_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_int(): Passing null to parameter #1 ($param) of type int is deprecated in %s on line %d +int(0) +NULL + +Deprecated: zend_int_slow_zpp(): Passing null to parameter #1 ($param) of type int is deprecated in %s on line %d +int(0) +NULL + +Deprecated: zend_int(): Passing null to parameter #1 ($param) of type int is deprecated in %s on line %d +int(0) +NULL + +Deprecated: zend_int_slow_zpp(): Passing null to parameter #1 ($param) of type int is deprecated in %s on line %d +int(0) +NULL +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) + +Deprecated: Implicit conversion from float 73.5 to int loses precision in %s on line %d +int(73) +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, string given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, string given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, string given +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) + +Deprecated: Implicit conversion from float-string "56.7" to int loses precision in %s on line %d +int(56) +TypeError: zend_int(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, array given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, array given +TypeError: zend_int(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, stdClass given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, stdClass given +TypeError: zend_int(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, S given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, S given +TypeError: zend_int(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, resource given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, resource given +TypeError: zend_int(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null(): Argument #1 ($param) must be of type ?int, resource given +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, resource given +TypeError: zend_int_or_null_slow_zpp(): Argument #1 ($param) must be of type ?int, resource given diff --git a/Zend/tests/iterable_or_null.phpt b/ext/zend_test/tests/zpp/iterable_or_null.phpt similarity index 100% rename from Zend/tests/iterable_or_null.phpt rename to ext/zend_test/tests/zpp/iterable_or_null.phpt diff --git a/ext/zend_test/tests/zpp/number_or_str_zpp.phpt b/ext/zend_test/tests/zpp/number_or_str_zpp.phpt new file mode 100644 index 000000000000..67035933536a --- /dev/null +++ b/ext/zend_test/tests/zpp/number_or_str_zpp.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test Z_PARAM_NUMBER_OR_STR() and Z_PARAM_NUMBER_OR_STR_OR_NULL +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_string_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_number_or_string(): Passing null to parameter #1 ($param) of type string|int|float is deprecated in %s on line %d +int(0) +NULL +int(0) +int(0) +int(1) +int(1) +int(42) +int(42) +float(73.5) +float(73.5) +string(6) "string" +string(6) "string" +string(2) "15" +string(2) "15" +string(4) "56.7" +string(4) "56.7" +TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, array given +TypeError: zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, array given +TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, stdClass given +TypeError: zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, stdClass given +string(7) "S class" +string(7) "S class" +TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, resource given +TypeError: zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, resource given diff --git a/ext/zend_test/tests/zpp/number_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/number_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..6f1d40dd1acf --- /dev/null +++ b/ext/zend_test/tests/zpp/number_zpp_specifier_strict_mode.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test bool ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_number($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, null given +NULL +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, null given +NULL +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, null given +NULL +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, null given +NULL +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, false given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, false given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, false given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, false given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, false given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, false given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, false given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, false given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, true given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, true given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, true given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, true given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, true given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, true given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, true given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, true given +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, resource given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, resource given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, resource given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, resource given diff --git a/ext/zend_test/tests/zpp/number_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/number_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..a5443b2df313 --- /dev/null +++ b/ext/zend_test/tests/zpp/number_zpp_specifier_weak_mode.phpt @@ -0,0 +1,158 @@ +--TEST-- +Test bool ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_number($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_number(): Passing null to parameter #1 ($param) of type int|float is deprecated in %s on line %d +int(0) +NULL + +Deprecated: zend_number_slow_zpp(): Passing null to parameter #1 ($param) of type int|float is deprecated in %s on line %d +int(0) +NULL + +Deprecated: zend_number(): Passing null to parameter #1 ($param) of type int|float is deprecated in %s on line %d +int(0) +NULL + +Deprecated: zend_number_slow_zpp(): Passing null to parameter #1 ($param) of type int|float is deprecated in %s on line %d +int(0) +NULL +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, string given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, string given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, string given +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, array given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, array given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, stdClass given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, stdClass given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, S given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, S given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, resource given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, resource given +TypeError: zend_number(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null(): Argument #1 ($param) must be of type int|float|null, resource given +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, resource given +TypeError: zend_number_or_null_slow_zpp(): Argument #1 ($param) must be of type int|float|null, resource given diff --git a/ext/zend_test/tests/zpp/str_or_obj_of_class_zpp.phpt b/ext/zend_test/tests/zpp/str_or_obj_of_class_zpp.phpt new file mode 100644 index 000000000000..cb0f6025de61 --- /dev/null +++ b/ext/zend_test/tests/zpp/str_or_obj_of_class_zpp.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_string_or_stdclass_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_string_or_stdclass(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d +string(0) "" +NULL +string(0) "" +string(0) "" +string(1) "1" +string(1) "1" +string(2) "42" +string(2) "42" +string(4) "73.5" +string(4) "73.5" +string(6) "string" +string(6) "string" +string(2) "15" +string(2) "15" +string(4) "56.7" +string(4) "56.7" +TypeError: zend_string_or_stdclass(): Argument #1 ($param) must be of type stdClass|string, array given +TypeError: zend_string_or_stdclass_or_null(): Argument #1 ($param) must be of type stdClass|string|null, array given +object(stdClass)#1 (0) { +} +object(stdClass)#1 (0) { +} +string(7) "S class" +string(7) "S class" +TypeError: zend_string_or_stdclass(): Argument #1 ($param) must be of type stdClass|string, resource given +TypeError: zend_string_or_stdclass_or_null(): Argument #1 ($param) must be of type stdClass|string|null, resource given diff --git a/ext/zend_test/tests/zpp/str_or_obj_zpp.phpt b/ext/zend_test/tests/zpp/str_or_obj_zpp.phpt new file mode 100644 index 000000000000..449925b95031 --- /dev/null +++ b/ext/zend_test/tests/zpp/str_or_obj_zpp.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test Z_PARAM_OBJ_OR_STR() and Z_PARAM_OBJ_OR_STR_OR_NULL +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(zend_string_or_object_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Deprecated: zend_string_or_object(): Passing null to parameter #1 ($param) of type object|string is deprecated in %s on line %d +string(0) "" +NULL +string(0) "" +string(0) "" +string(1) "1" +string(1) "1" +string(2) "42" +string(2) "42" +string(4) "73.5" +string(4) "73.5" +string(6) "string" +string(6) "string" +string(2) "15" +string(2) "15" +string(4) "56.7" +string(4) "56.7" +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, array given +TypeError: zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, array given +object(stdClass)#1 (0) { +} +object(stdClass)#1 (0) { +} +object(S)#2 (0) { +} +object(S)#2 (0) { +} +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, resource given +TypeError: zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, resource given diff --git a/ext/zend_test/tests/zpp/types.inc b/ext/zend_test/tests/zpp/types.inc new file mode 100644 index 000000000000..ea78437baf19 --- /dev/null +++ b/ext/zend_test/tests/zpp/types.inc @@ -0,0 +1,22 @@ +