diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index 88d012149beb..cfe758db7961 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -615,6 +615,10 @@ static const func_info_t func_infos[] = { F1("serialize", MAY_BE_STRING), F1("xml_error_string", MAY_BE_STRING|MAY_BE_NULL), F1("xml_parser_get_option", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_BOOL), + FN("zend_resource", MAY_BE_RESOURCE), + FN("zend_resource_or_null", MAY_BE_RESOURCE|MAY_BE_NULL), + FN("zend_resource_slow_zpp", MAY_BE_RESOURCE), + FN("zend_resource_or_null_slow_zpp", MAY_BE_RESOURCE|MAY_BE_NULL), FN("zend_test_create_throwing_resource", MAY_BE_RESOURCE), FN("zip_open", MAY_BE_RESOURCE|MAY_BE_LONG|MAY_BE_FALSE), FN("zip_read", MAY_BE_RESOURCE|MAY_BE_FALSE), 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..66df820b21a3 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -225,6 +225,413 @@ 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); +} + +static ZEND_FUNCTION(zend_object) +{ + zval *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_object_or_null) +{ + zval *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OR_NULL(v) + ZEND_PARSE_PARAMETERS_END(); + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_object_slow_zpp) +{ + zval *v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_object_or_null_slow_zpp) +{ + zval *v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!", &v) == FAILURE) { + RETURN_THROWS(); + } + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_obj) +{ + zend_object *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJ(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_OBJ_COPY(v); +} + +static ZEND_FUNCTION(zend_obj_or_null) +{ + zend_object *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJ_OR_NULL(v) + ZEND_PARSE_PARAMETERS_END(); + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_OBJ_COPY(v); +} + +static ZEND_FUNCTION(zend_obj_or_class_name) +{ + zend_class_entry *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJ_OR_CLASS_NAME(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_STR_COPY(v->name); +} + +static ZEND_FUNCTION(zend_obj_or_class_name_or_null) +{ + zend_class_entry *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJ_OR_CLASS_NAME_OR_NULL(v) + ZEND_PARSE_PARAMETERS_END(); + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_STR_COPY(v->name); +} + +static ZEND_FUNCTION(zend_class_name) +{ + zend_class_entry *v = NULL; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_CLASS(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_STR_COPY(v->name); +} + +static ZEND_FUNCTION(zend_class_name_or_null) +{ + zend_class_entry *v = NULL; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_CLASS_OR_NULL(v) + ZEND_PARSE_PARAMETERS_END(); + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_STR_COPY(v->name); +} + +static ZEND_FUNCTION(zend_class_name_slow_zpp) +{ + zend_class_entry *v = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "C", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_STR_COPY(v->name); +} + +static ZEND_FUNCTION(zend_class_name_or_null_slow_zpp) +{ + zend_class_entry *v = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "C!", &v) == FAILURE) { + RETURN_THROWS(); + } + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_STR_COPY(v->name); +} + +static ZEND_FUNCTION(zend_resource) +{ + zval *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_RESOURCE(v) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_resource_or_null) +{ + zval *v; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_RESOURCE_OR_NULL(v) + ZEND_PARSE_PARAMETERS_END(); + + if (v == NULL) { + RETURN_NULL(); + } + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_resource_slow_zpp) +{ + zval *v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &v) == FAILURE) { + RETURN_THROWS(); + } + + RETURN_COPY(v); +} + +static ZEND_FUNCTION(zend_resource_or_null_slow_zpp) +{ + zval *v; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r!", &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 +685,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 +748,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 +878,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..04e50253ccf1 100644 --- a/ext/zend_test/test.stub.php +++ b/ext/zend_test/test.stub.php @@ -299,6 +299,63 @@ 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_object(object $param): object {} + function zend_object_or_null(object|null $param): object|null {} + function zend_object_slow_zpp(object $param): object {} + function zend_object_or_null_slow_zpp(object|null $param): object|null {} + + function zend_obj(object $param): object {} + function zend_obj_or_null(object|null $param): object|null {} + + function zend_obj_or_class_name(object|string $param): string {} + function zend_obj_or_class_name_or_null(object|string|null $param): string|null {} + + function zend_class_name(string $param): string {} + function zend_class_name_or_null(string|null $param): string|null {} + function zend_class_name_slow_zpp(string $param): string {} + function zend_class_name_or_null_slow_zpp(string|null $param): string|null {} + + /** + * @param resource $param + * @return resource + */ + function zend_resource($param) {} + /** + * @param resource|null $param + * @return resource|null + */ + function zend_resource_or_null($param) {} + /** + * @param resource $param + * @return resource + */ + function zend_resource_slow_zpp($param) {} + /** + * @param resource|null $param + * @return resource|null + */ + function zend_resource_or_null_slow_zpp($param) {} + 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..8b5bc52f8efd 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: 6499804aa782b477d471188835bce331e1c02137 * Has decl header: yes */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_trigger_bailout, 0, 0, IS_NEVER, 0) @@ -53,6 +53,100 @@ 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_INFO_EX(arginfo_zend_object, 0, 1, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, param, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_object_or_null, 0, 1, IS_OBJECT, 1) + ZEND_ARG_TYPE_INFO(0, param, IS_OBJECT, 1) +ZEND_END_ARG_INFO() + +#define arginfo_zend_object_slow_zpp arginfo_zend_object + +#define arginfo_zend_object_or_null_slow_zpp arginfo_zend_object_or_null + +#define arginfo_zend_obj arginfo_zend_object + +#define arginfo_zend_obj_or_null arginfo_zend_object_or_null + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_obj_or_class_name, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_MASK(0, param, MAY_BE_OBJECT|MAY_BE_STRING, NULL) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_obj_or_class_name_or_null, 0, 1, IS_STRING, 1) + ZEND_ARG_TYPE_MASK(0, param, MAY_BE_OBJECT|MAY_BE_STRING|MAY_BE_NULL, NULL) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_class_name, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_class_name_or_null, 0, 1, IS_STRING, 1) + ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 1) +ZEND_END_ARG_INFO() + +#define arginfo_zend_class_name_slow_zpp arginfo_zend_class_name + +#define arginfo_zend_class_name_or_null_slow_zpp arginfo_zend_class_name_or_null + +ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_resource, 0, 0, 1) + ZEND_ARG_INFO(0, param) +ZEND_END_ARG_INFO() + +#define arginfo_zend_resource_or_null arginfo_zend_resource + +#define arginfo_zend_resource_slow_zpp arginfo_zend_resource + +#define arginfo_zend_resource_or_null_slow_zpp arginfo_zend_resource + 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 +407,38 @@ 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_object); +static ZEND_FUNCTION(zend_object_or_null); +static ZEND_FUNCTION(zend_object_slow_zpp); +static ZEND_FUNCTION(zend_object_or_null_slow_zpp); +static ZEND_FUNCTION(zend_obj); +static ZEND_FUNCTION(zend_obj_or_null); +static ZEND_FUNCTION(zend_obj_or_class_name); +static ZEND_FUNCTION(zend_obj_or_class_name_or_null); +static ZEND_FUNCTION(zend_class_name); +static ZEND_FUNCTION(zend_class_name_or_null); +static ZEND_FUNCTION(zend_class_name_slow_zpp); +static ZEND_FUNCTION(zend_class_name_or_null_slow_zpp); +static ZEND_FUNCTION(zend_resource); +static ZEND_FUNCTION(zend_resource_or_null); +static ZEND_FUNCTION(zend_resource_slow_zpp); +static ZEND_FUNCTION(zend_resource_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 +575,38 @@ 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_object, arginfo_zend_object) + ZEND_FE(zend_object_or_null, arginfo_zend_object_or_null) + ZEND_FE(zend_object_slow_zpp, arginfo_zend_object_slow_zpp) + ZEND_FE(zend_object_or_null_slow_zpp, arginfo_zend_object_or_null_slow_zpp) + ZEND_FE(zend_obj, arginfo_zend_obj) + ZEND_FE(zend_obj_or_null, arginfo_zend_obj_or_null) + ZEND_FE(zend_obj_or_class_name, arginfo_zend_obj_or_class_name) + ZEND_FE(zend_obj_or_class_name_or_null, arginfo_zend_obj_or_class_name_or_null) + ZEND_FE(zend_class_name, arginfo_zend_class_name) + ZEND_FE(zend_class_name_or_null, arginfo_zend_class_name_or_null) + ZEND_FE(zend_class_name_slow_zpp, arginfo_zend_class_name_slow_zpp) + ZEND_FE(zend_class_name_or_null_slow_zpp, arginfo_zend_class_name_or_null_slow_zpp) + ZEND_FE(zend_resource, arginfo_zend_resource) + ZEND_FE(zend_resource_or_null, arginfo_zend_resource_or_null) + ZEND_FE(zend_resource_slow_zpp, arginfo_zend_resource_slow_zpp) + ZEND_FE(zend_resource_or_null_slow_zpp, arginfo_zend_resource_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..4e5c676db188 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: 6499804aa782b477d471188835bce331e1c02137 */ -#ifndef ZEND_TEST_DECL_a221a3df3815679d61fd546ba120fd3a374fe71f_H -#define ZEND_TEST_DECL_a221a3df3815679d61fd546ba120fd3a374fe71f_H +#ifndef ZEND_TEST_DECL_6499804aa782b477d471188835bce331e1c02137_H +#define ZEND_TEST_DECL_6499804aa782b477d471188835bce331e1c02137_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_6499804aa782b477d471188835bce331e1c02137_H */ diff --git a/ext/zend_test/test_legacy_arginfo.h b/ext/zend_test/test_legacy_arginfo.h index 05014c80fd5d..18dc62e3b65c 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: 6499804aa782b477d471188835bce331e1c02137 * Has decl header: yes */ ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_trigger_bailout, 0, 0, 0) @@ -49,19 +49,83 @@ 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_object arginfo_zend_bool + +#define arginfo_zend_object_or_null arginfo_zend_bool + +#define arginfo_zend_object_slow_zpp arginfo_zend_bool + +#define arginfo_zend_object_or_null_slow_zpp arginfo_zend_bool + +#define arginfo_zend_obj arginfo_zend_bool + +#define arginfo_zend_obj_or_null arginfo_zend_bool + +#define arginfo_zend_obj_or_class_name arginfo_zend_bool + +#define arginfo_zend_obj_or_class_name_or_null arginfo_zend_bool + +#define arginfo_zend_class_name arginfo_zend_bool + +#define arginfo_zend_class_name_or_null arginfo_zend_bool + +#define arginfo_zend_class_name_slow_zpp arginfo_zend_bool + +#define arginfo_zend_class_name_or_null_slow_zpp arginfo_zend_bool + +#define arginfo_zend_resource arginfo_zend_bool + +#define arginfo_zend_resource_or_null arginfo_zend_bool + +#define arginfo_zend_resource_slow_zpp arginfo_zend_bool + +#define arginfo_zend_resource_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 +340,38 @@ 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_object); +static ZEND_FUNCTION(zend_object_or_null); +static ZEND_FUNCTION(zend_object_slow_zpp); +static ZEND_FUNCTION(zend_object_or_null_slow_zpp); +static ZEND_FUNCTION(zend_obj); +static ZEND_FUNCTION(zend_obj_or_null); +static ZEND_FUNCTION(zend_obj_or_class_name); +static ZEND_FUNCTION(zend_obj_or_class_name_or_null); +static ZEND_FUNCTION(zend_class_name); +static ZEND_FUNCTION(zend_class_name_or_null); +static ZEND_FUNCTION(zend_class_name_slow_zpp); +static ZEND_FUNCTION(zend_class_name_or_null_slow_zpp); +static ZEND_FUNCTION(zend_resource); +static ZEND_FUNCTION(zend_resource_or_null); +static ZEND_FUNCTION(zend_resource_slow_zpp); +static ZEND_FUNCTION(zend_resource_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 +480,38 @@ 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_object, arginfo_zend_object) + ZEND_FE(zend_object_or_null, arginfo_zend_object_or_null) + ZEND_FE(zend_object_slow_zpp, arginfo_zend_object_slow_zpp) + ZEND_FE(zend_object_or_null_slow_zpp, arginfo_zend_object_or_null_slow_zpp) + ZEND_FE(zend_obj, arginfo_zend_obj) + ZEND_FE(zend_obj_or_null, arginfo_zend_obj_or_null) + ZEND_FE(zend_obj_or_class_name, arginfo_zend_obj_or_class_name) + ZEND_FE(zend_obj_or_class_name_or_null, arginfo_zend_obj_or_class_name_or_null) + ZEND_FE(zend_class_name, arginfo_zend_class_name) + ZEND_FE(zend_class_name_or_null, arginfo_zend_class_name_or_null) + ZEND_FE(zend_class_name_slow_zpp, arginfo_zend_class_name_slow_zpp) + ZEND_FE(zend_class_name_or_null_slow_zpp, arginfo_zend_class_name_or_null_slow_zpp) + ZEND_FE(zend_resource, arginfo_zend_resource) + ZEND_FE(zend_resource_or_null, arginfo_zend_resource_or_null) + ZEND_FE(zend_resource_slow_zpp, arginfo_zend_resource_slow_zpp) + ZEND_FE(zend_resource_or_null_slow_zpp, arginfo_zend_resource_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..49e056213e3a --- /dev/null +++ b/ext/zend_test/tests/zpp/bool_zpp_specifier_strict_mode.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test bool ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_bool($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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 +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 +Using false: +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Using true: +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using 42: +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 +Using 73.5: +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 +Using 'string': +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 +Using '15': +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 +Using '56.7': +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 +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..705487f8ba73 --- /dev/null +++ b/ext/zend_test/tests/zpp/bool_zpp_specifier_weak_mode.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test bool ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_bool($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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 + +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 +Using false: +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Using true: +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using 42: +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using 73.5: +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using 'string': +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using '15': +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using '56.7': +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using 'stdClass': +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using anon class name: +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..df7345ce3c21 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,43 +7,186 @@ 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 */ +foreach ($types as $name => $type) { + echo "Using $name:\n"; + try { + var_dump(zend_class_name($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } try { - var_dump(zend_object_init_with_constructor($type)); + var_dump(zend_class_name_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_class_name($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null_slow_zpp($ref)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } } ?> ---EXPECT-- -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, null given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, false given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, true given -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 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 -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, resource given +--EXPECTF-- +Using null: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, null given +NULL +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +NULL +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, null given +NULL +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +NULL +Using false: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, false given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, false given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, false given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, false given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, given +Using true: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, true given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, true given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 1 given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, true given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, true given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 1 given +Using 42: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, int given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, int given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 42 given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, int given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, int given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 42 given +Using 73.5: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, float given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, float given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 73.5 given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, float given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, float given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 73.5 given +Using 'string': +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, string given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, string given +Using '15': +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 15 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 15 given +Using '56.7': +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 56.7 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 56.7 given +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, array given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Array given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, array given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Array given +Using new stdClass(): +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, stdClass given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, stdClass given +Error: Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, stdClass given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, stdClass given +Error: Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string +Using new S(): +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, S given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, S given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, S class given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, S given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, S given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, S class given +Using STDOUT: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, resource given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, resource given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Resource id #2 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Resource id #2 given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, resource given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, resource given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Resource id #2 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Resource id #2 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..0ffe8f18899f 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,29 +5,48 @@ zend_test --FILE-- $type) { + echo "Using $name:\n"; + try { + var_dump(zend_class_name($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; try { - var_dump(zend_object_init_with_constructor($type)); + var_dump(zend_class_name($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_class_name_or_null_slow_zpp($ref)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } @@ -35,14 +54,141 @@ foreach ($types as $type) { ?> --EXPECTF-- -Deprecated: zend_object_init_with_constructor(): Passing null to parameter #1 ($class) of type string is deprecated in %s on line %d -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, 1 given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, 42 given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be a valid class name, 73.5 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 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 a valid class name, S class given -TypeError: zend_object_init_with_constructor(): Argument #1 ($class) must be of type string, resource given +Using null: + +Deprecated: zend_class_name(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, given +NULL +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +NULL + +Deprecated: zend_class_name(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, given +NULL +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +NULL +Using false: +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, given +Using true: +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 1 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 1 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 1 given +Using 42: +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 42 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 42 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 42 given +Using 73.5: +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 73.5 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 73.5 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 73.5 given +Using 'string': +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, string given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, string given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, string given +Using '15': +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 15 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 15 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 15 given +Using '56.7': +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 56.7 given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, 56.7 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, 56.7 given +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, array given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Array given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, array given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Array given + +Warning: Array to string conversion in %s on line %d +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Array given +Using new stdClass(): +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, stdClass given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, stdClass given +Error: Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, stdClass given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, stdClass given +Error: Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string +Using new S(): +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, S class given +TypeError: zend_class_name(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, S class given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, S class given +Using STDOUT: +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, resource given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, resource given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Resource id #2 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Resource id #2 given +TypeError: zend_class_name(): Argument #1 ($param) must be of type string, resource given +TypeError: zend_class_name_or_null(): Argument #1 ($param) must be of type ?string, resource given +TypeError: zend_class_name_slow_zpp(): Argument #1 ($param) must be a valid class name, Resource id #2 given +TypeError: zend_class_name_or_null_slow_zpp(): Argument #1 ($param) must be a valid class name or null, Resource id #2 given diff --git a/ext/zend_test/tests/zpp/float_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/float_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..2d316737b7cd --- /dev/null +++ b/ext/zend_test/tests/zpp/float_zpp_specifier_strict_mode.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test float ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_float($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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, null given +NULL +TypeError: zend_float_slow_zpp(): Argument #1 ($param) must be of type float, null given +NULL +Using false: +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 +Using true: +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 +Using 42: +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +Using 73.5: +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +Using 'string': +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 +Using '15': +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 +Using '56.7': +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 +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..1520e8055bd3 --- /dev/null +++ b/ext/zend_test/tests/zpp/float_zpp_specifier_weak_mode.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test float ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_float($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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 + +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 +Using false: +float(0) +float(0) +float(0) +float(0) +float(0) +float(0) +float(0) +float(0) +Using true: +float(1) +float(1) +float(1) +float(1) +float(1) +float(1) +float(1) +float(1) +Using 42: +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +float(42) +Using 73.5: +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +Using 'string': +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 +Using '15': +float(15) +float(15) +float(15) +float(15) +float(15) +float(15) +float(15) +float(15) +Using '56.7': +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..58585c3656cd --- /dev/null +++ b/ext/zend_test/tests/zpp/int_zpp_specifier_strict_mode.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test int ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_int($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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, null given +NULL +TypeError: zend_int_slow_zpp(): Argument #1 ($param) must be of type int, null given +NULL +Using false: +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 +Using true: +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 +Using 42: +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +Using 73.5: +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 +Using 'string': +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 +Using '15': +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 +Using '56.7': +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 +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..9258d6864355 --- /dev/null +++ b/ext/zend_test/tests/zpp/int_zpp_specifier_weak_mode.phpt @@ -0,0 +1,222 @@ +--TEST-- +Test int ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_int($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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 + +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 +Using false: +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +Using true: +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +Using 42: +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +Using 73.5: + +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) +Using 'string': +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 +Using '15': +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +Using '56.7': + +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) +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..6ad345a0bc7c --- /dev/null +++ b/ext/zend_test/tests/zpp/number_or_str_zpp.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test Z_PARAM_NUMBER_OR_STR() and Z_PARAM_NUMBER_OR_STR_OR_NULL +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_number_or_string($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_number_or_string_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Using null: + +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 +Using false: +int(0) +int(0) +Using true: +int(1) +int(1) +Using 42: +int(42) +int(42) +Using 73.5: +float(73.5) +float(73.5) +Using 'string': +string(6) "string" +string(6) "string" +Using '15': +string(2) "15" +string(2) "15" +Using '56.7': +string(4) "56.7" +string(4) "56.7" +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +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 +Using new stdClass(): +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 +Using new S(): +string(7) "S class" +string(7) "S class" +Using STDOUT: +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..c8058d9d7aa1 --- /dev/null +++ b/ext/zend_test/tests/zpp/number_zpp_specifier_strict_mode.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test bool ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_number($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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, null given +NULL +TypeError: zend_number_slow_zpp(): Argument #1 ($param) must be of type int|float, null given +NULL +Using false: +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 +Using true: +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 +Using 42: +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +Using 73.5: +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +Using 'string': +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 +Using '15': +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 +Using '56.7': +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 +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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..4622b8001393 --- /dev/null +++ b/ext/zend_test/tests/zpp/number_zpp_specifier_weak_mode.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test bool ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_number($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->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-- +Using 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 + +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 +Using false: +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +Using true: +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +Using 42: +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +int(42) +Using 73.5: +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +float(73.5) +Using 'string': +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 +Using '15': +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +int(15) +Using '56.7': +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +float(56.7) +Using 'stdClass': +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 +Using anon class name: +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 +Using []: +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 +Using new stdClass(): +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 +Using new S(): +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 +Using STDOUT: +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/obj_or_class_name_zpp_strict_mode.phpt b/ext/zend_test/tests/zpp/obj_or_class_name_zpp_strict_mode.phpt new file mode 100644 index 000000000000..8bb15d08c780 --- /dev/null +++ b/ext/zend_test/tests/zpp/obj_or_class_name_zpp_strict_mode.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test Z_PARAM_OBJ_OR_CLASS_NAME() and Z_PARAM_OBJ_OR_CLASS_NAME_OR_NULL (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_obj_or_class_name($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_obj_or_class_name_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Using null: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, null given +NULL +Using false: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, false given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, false given +Using true: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, true given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, true given +Using 42: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, int given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, int given +Using 73.5: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, float given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, float given +Using 'string': +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, string given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, string given +Using '15': +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, string given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, string given +Using '56.7': +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, string given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, string given +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, array given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, array given +Using new stdClass(): +string(8) "stdClass" +string(8) "stdClass" +Using new S(): +string(1) "S" +string(1) "S" +Using STDOUT: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, resource given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, resource given diff --git a/ext/zend_test/tests/zpp/obj_or_class_name_zpp_weak_mode.phpt b/ext/zend_test/tests/zpp/obj_or_class_name_zpp_weak_mode.phpt new file mode 100644 index 000000000000..e5044547ac35 --- /dev/null +++ b/ext/zend_test/tests/zpp/obj_or_class_name_zpp_weak_mode.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test Z_PARAM_OBJ_OR_CLASS_NAME() and Z_PARAM_OBJ_OR_CLASS_NAME_OR_NULL (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_obj_or_class_name($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_obj_or_class_name_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Using null: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, null given +NULL +Using false: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, false given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, false given +Using true: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, true given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, true given +Using 42: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, int given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, int given +Using 73.5: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, float given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, float given +Using 'string': +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, string given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, string given +Using '15': +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, string given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, string given +Using '56.7': +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, string given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, string given +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, array given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, array given +Using new stdClass(): +string(8) "stdClass" +string(8) "stdClass" +Using new S(): +string(1) "S" +string(1) "S" +Using STDOUT: +TypeError: zend_obj_or_class_name(): Argument #1 ($param) must be an object or a valid class name, resource given +TypeError: zend_obj_or_class_name_or_null(): Argument #1 ($param) must be an object, a valid class name, or null, resource given diff --git a/ext/zend_test/tests/zpp/obj_or_str_zpp_strict_mode.phpt b/ext/zend_test/tests/zpp/obj_or_str_zpp_strict_mode.phpt new file mode 100644 index 000000000000..f8b999835863 --- /dev/null +++ b/ext/zend_test/tests/zpp/obj_or_str_zpp_strict_mode.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test Z_PARAM_OBJ_OR_STR() and Z_PARAM_OBJ_OR_STR_OR_NULL (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_string_or_object($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_string_or_object_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Using null: +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, null given +NULL +Using false: +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, false given +TypeError: zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, false given +Using true: +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, true given +TypeError: zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, true given +Using 42: +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, int given +TypeError: zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, int given +Using 73.5: +TypeError: zend_string_or_object(): Argument #1 ($param) must be of type object|string, float given +TypeError: zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, float given +Using 'string': +string(6) "string" +string(6) "string" +Using '15': +string(2) "15" +string(2) "15" +Using '56.7': +string(4) "56.7" +string(4) "56.7" +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +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 +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +object(S)#3 (0) { +} +object(S)#3 (0) { +} +Using STDOUT: +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/obj_or_str_zpp_weak_mode.phpt b/ext/zend_test/tests/zpp/obj_or_str_zpp_weak_mode.phpt new file mode 100644 index 000000000000..7c6d4db7e649 --- /dev/null +++ b/ext/zend_test/tests/zpp/obj_or_str_zpp_weak_mode.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test Z_PARAM_OBJ_OR_STR() and Z_PARAM_OBJ_OR_STR_OR_NULL (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_string_or_object($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_string_or_object_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Using null: + +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 +Using false: +string(0) "" +string(0) "" +Using true: +string(1) "1" +string(1) "1" +Using 42: +string(2) "42" +string(2) "42" +Using 73.5: +string(4) "73.5" +string(4) "73.5" +Using 'string': +string(6) "string" +string(6) "string" +Using '15': +string(2) "15" +string(2) "15" +Using '56.7': +string(4) "56.7" +string(4) "56.7" +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +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 +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +object(S)#3 (0) { +} +object(S)#3 (0) { +} +Using STDOUT: +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/obj_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/obj_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..fecfb294bb45 --- /dev/null +++ b/ext/zend_test/tests/zpp/obj_zpp_specifier_strict_mode.phpt @@ -0,0 +1,116 @@ +--TEST-- +Test Z_PARAM_OBJ() and Z_PARAM_OBJ_OR_NULL (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_obj($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_obj_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_obj($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_obj_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +Using null: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_obj(): Argument #1 ($param) must be of type object, null given +NULL +Using false: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, false given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, false given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, false given +Using true: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, true given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, true given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, true given +Using 42: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, int given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, int given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, int given +Using 73.5: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, float given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, float given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, float given +Using 'string': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using '15': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using '56.7': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using 'stdClass': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using anon class name: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using []: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, array given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, array given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, array given +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +Using STDOUT: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, resource given diff --git a/ext/zend_test/tests/zpp/obj_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/obj_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..0557f1f03f37 --- /dev/null +++ b/ext/zend_test/tests/zpp/obj_zpp_specifier_weak_mode.phpt @@ -0,0 +1,114 @@ +--TEST-- +Test Z_PARAM_OBJ() and Z_PARAM_OBJ_OR_NULL (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_obj($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_obj_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_obj($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_obj_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +Using null: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_obj(): Argument #1 ($param) must be of type object, null given +NULL +Using false: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, false given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, false given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, false given +Using true: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, true given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, true given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, true given +Using 42: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, int given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, int given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, int given +Using 73.5: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, float given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, float given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, float given +Using 'string': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using '15': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using '56.7': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using 'stdClass': +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using anon class name: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, string given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, string given +Using []: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, array given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, array given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, array given +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +Using STDOUT: +TypeError: zend_obj(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_obj(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_obj_or_null(): Argument #1 ($param) must be of type ?object, resource given diff --git a/ext/zend_test/tests/zpp/object_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/object_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..c0f66a7846aa --- /dev/null +++ b/ext/zend_test/tests/zpp/object_zpp_specifier_strict_mode.phpt @@ -0,0 +1,200 @@ +--TEST-- +Test object ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_object($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_object($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +Using null: +TypeError: zend_object(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_object(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, null given +NULL +Using false: +TypeError: zend_object(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_object(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, false given +Using true: +TypeError: zend_object(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_object(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, true given +Using 42: +TypeError: zend_object(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_object(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, int given +Using 73.5: +TypeError: zend_object(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_object(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, float given +Using 'string': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using '15': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using '56.7': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using 'stdClass': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using anon class name: +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using []: +TypeError: zend_object(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_object(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, array given +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +Using STDOUT: +TypeError: zend_object(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_object(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, resource given diff --git a/ext/zend_test/tests/zpp/object_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/object_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..d97078aaca46 --- /dev/null +++ b/ext/zend_test/tests/zpp/object_zpp_specifier_weak_mode.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test object ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_object($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_object($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_object_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +Using null: +TypeError: zend_object(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_object(): Argument #1 ($param) must be of type object, null given +NULL +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, null given +NULL +Using false: +TypeError: zend_object(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_object(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, false given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, false given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, false given +Using true: +TypeError: zend_object(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_object(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, true given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, true given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, true given +Using 42: +TypeError: zend_object(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_object(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, int given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, int given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, int given +Using 73.5: +TypeError: zend_object(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_object(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, float given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, float given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, float given +Using 'string': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using '15': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using '56.7': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using 'stdClass': +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using anon class name: +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, string given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, string given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, string given +Using []: +TypeError: zend_object(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_object(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, array given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, array given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, array given +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +object(S)#3 (0) { +} +Using STDOUT: +TypeError: zend_object(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_object(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null(): Argument #1 ($param) must be of type ?object, resource given +TypeError: zend_object_slow_zpp(): Argument #1 ($param) must be of type object, resource given +TypeError: zend_object_or_null_slow_zpp(): Argument #1 ($param) must be of type ?object, resource given diff --git a/ext/zend_test/tests/zpp/resource_zpp_specifier_strict_mode.phpt b/ext/zend_test/tests/zpp/resource_zpp_specifier_strict_mode.phpt new file mode 100644 index 000000000000..3b3da48bdf5f --- /dev/null +++ b/ext/zend_test/tests/zpp/resource_zpp_specifier_strict_mode.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test resource ZPP specifier (strict_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_resource($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_resource($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +Using null: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, null given +NULL +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, null given +NULL +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, null given +NULL +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, null given +NULL +Using false: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, false given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, false given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, false given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, false given +Using true: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, true given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, true given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, true given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, true given +Using 42: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, int given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, int given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, int given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, int given +Using 73.5: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, float given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, float given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, float given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, float given +Using 'string': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using '15': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using '56.7': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using 'stdClass': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using anon class name: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using []: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, array given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, array given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, array given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, array given +Using new stdClass(): +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, stdClass given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, stdClass given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, stdClass given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, stdClass given +Using new S(): +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, S given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, S given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, S given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, S given +Using STDOUT: +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) diff --git a/ext/zend_test/tests/zpp/resource_zpp_specifier_weak_mode.phpt b/ext/zend_test/tests/zpp/resource_zpp_specifier_weak_mode.phpt new file mode 100644 index 000000000000..04bc27cb01dc --- /dev/null +++ b/ext/zend_test/tests/zpp/resource_zpp_specifier_weak_mode.phpt @@ -0,0 +1,182 @@ +--TEST-- +Test resource ZPP specifier (weak_mode) +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_resource($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null_slow_zpp($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + $ref =& $type; + try { + var_dump(zend_resource($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_resource_or_null_slow_zpp($ref)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +Using null: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, null given +NULL +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, null given +NULL +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, null given +NULL +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, null given +NULL +Using false: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, false given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, false given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, false given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, false given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, false given +Using true: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, true given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, true given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, true given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, true given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, true given +Using 42: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, int given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, int given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, int given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, int given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, int given +Using 73.5: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, float given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, float given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, float given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, float given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, float given +Using 'string': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using '15': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using '56.7': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using 'stdClass': +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using anon class name: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, string given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, string given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, string given +Using []: +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, array given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, array given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, array given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, array given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, array given +Using new stdClass(): +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, stdClass given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, stdClass given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, stdClass given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, stdClass given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, stdClass given +Using new S(): +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, S given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, S given +TypeError: zend_resource(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null(): Argument #1 ($param) must be of type resource or null, S given +TypeError: zend_resource_slow_zpp(): Argument #1 ($param) must be of type resource, S given +TypeError: zend_resource_or_null_slow_zpp(): Argument #1 ($param) must be of type resource or null, S given +Using STDOUT: +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) +resource(2) of type (stream) 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..f73f4e1284a8 --- /dev/null +++ b/ext/zend_test/tests/zpp/str_or_obj_of_class_zpp.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL +--EXTENSIONS-- +zend_test +--FILE-- + $type) { + echo "Using $name:\n"; + try { + var_dump(zend_string_or_stdclass($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } + try { + var_dump(zend_string_or_stdclass_or_null($type)); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} + +?> +--EXPECTF-- +Using null: + +Deprecated: zend_string_or_stdclass(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d +string(0) "" +NULL +Using false: +string(0) "" +string(0) "" +Using true: +string(1) "1" +string(1) "1" +Using 42: +string(2) "42" +string(2) "42" +Using 73.5: +string(4) "73.5" +string(4) "73.5" +Using 'string': +string(6) "string" +string(6) "string" +Using '15': +string(2) "15" +string(2) "15" +Using '56.7': +string(4) "56.7" +string(4) "56.7" +Using 'stdClass': +string(8) "stdClass" +string(8) "stdClass" +Using anon class name: +string(79) "class@anonymous%s" +string(79) "class@anonymous%s" +Using []: +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 +Using new stdClass(): +object(stdClass)#2 (0) { +} +object(stdClass)#2 (0) { +} +Using new S(): +string(7) "S class" +string(7) "S class" +Using STDOUT: +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/types.inc b/ext/zend_test/tests/zpp/types.inc new file mode 100644 index 000000000000..43cac4a15602 --- /dev/null +++ b/ext/zend_test/tests/zpp/types.inc @@ -0,0 +1,26 @@ + null, + 'false' => false, + 'true' => true, + '42' => 42, + '73.5' => 73.5, + "'string'" => 'string', + "'15'" => '15', + "'56.7'" => '56.7', + "'stdClass'" => 'stdClass', + 'anon class name' => $anon::class, + '[]' => [], + 'new stdClass()' => new stdClass(), + 'new S()' => new S(), + 'STDOUT' => STDOUT, +];