Commit 308a2411107 for php.net
commit 308a24111074e1b8880d929339e36d85e7b2df8c
Author: Gina Peter Banyard <girgias@php.net>
Date: Fri Aug 14 16:06:35 2026 +0100
Zend: write tests for some ZPP specifiers (#23192)
This adds dedicated tests for ZPP specifiers with dedicated functions defined in ext/zend_test rather than using whatever function might be suitable, as it may get refactored.
This covers the ZPP specifiers for "slow" and fast ZPP, including nullable, for:
- `bool`
- `int`
- `float`
- `int|float`
- `int|float|string` (Fast ZPP only)
- `resource`
- `object`
- `object|string` (Fast ZPP only)
- Object of a class
- Object of class OR int (Fast ZPP only)
- Object of class OR string (Fast ZPP only)
- Class name
- Object OR class name
Missing specifiers that are relagated to later are:
- `array`
- `array|object`
- `array|int`
- `array|string`
- `callable`
- `string` (including "path" checking for null bytes)
- `string|int`
- Enum
- Zval
- Variadics
diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h
index 88d012149be..cfe758db796 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 6ee47ec6f63..00000000000
--- 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--
-<?php
-
-class Foo {}
-class ToString {
- public function __toString() {
- return "ToString";
- }
-}
-
-var_dump(zend_number_or_string("string"));
-var_dump(zend_number_or_string(1));
-var_dump(zend_number_or_string(5.5));
-var_dump(zend_number_or_string(null));
-var_dump(zend_number_or_string(false));
-var_dump(zend_number_or_string(true));
-var_dump(zend_number_or_string(new ToString()));
-
-try {
- zend_string_or_object([]);
-} catch (TypeError $exception) {
- echo $exception->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 dec9bee69d5..00000000000
--- 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--
-<?php
-
-class Foo {}
-class ToString {
- public function __toString() {
- return "ToString";
- }
-}
-
-var_dump(zend_string_or_stdclass("string"));
-var_dump(zend_string_or_stdclass(1));
-var_dump(zend_string_or_stdclass(null));
-var_dump(zend_string_or_stdclass(new stdClass()));
-var_dump(zend_string_or_stdclass(new ToString()));
-
-try {
- zend_string_or_stdclass([]);
-} catch (TypeError $exception) {
- echo $exception->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 3c71bde5fd3..00000000000
--- 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--
-<?php
-
-class Foo {}
-
-var_dump(zend_string_or_object("string"));
-var_dump(zend_string_or_object(1));
-var_dump(zend_string_or_object(null));
-var_dump(zend_string_or_object(new stdClass()));
-var_dump(zend_string_or_object(new Foo()));
-
-try {
- zend_string_or_object([]);
-} catch (TypeError $exception) {
- echo $exception->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/Zend/tests/zpp/bool_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/bool_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..49e056213e3
--- /dev/null
+++ b/Zend/tests/zpp/bool_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test bool ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..705487f8ba7
--- /dev/null
+++ b/Zend/tests/zpp/bool_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test bool ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/class-string_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/class-string_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..bdc48e27d4a
--- /dev/null
+++ b/Zend/tests/zpp/class-string_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test class string ZPP specifier
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+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_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;
+ }
+}
+
+?>
+--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(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/class-string_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/class-string_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..9341ecbb410
--- /dev/null
+++ b/Zend/tests/zpp/class-string_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test class string ZPP specifier
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+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_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;
+ }
+}
+
+?>
+--EXPECTF--
+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(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/float_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/float_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..2d316737b7c
--- /dev/null
+++ b/Zend/tests/zpp/float_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test float ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..1520e8055bd
--- /dev/null
+++ b/Zend/tests/zpp/float_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test float ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/int_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/int_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..58585c3656c
--- /dev/null
+++ b/Zend/tests/zpp/int_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test int ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..9258d686435
--- /dev/null
+++ b/Zend/tests/zpp/int_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test int ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/iterable_or_null.phpt
similarity index 100%
rename from Zend/tests/iterable_or_null.phpt
rename to Zend/tests/zpp/iterable_or_null.phpt
diff --git a/Zend/tests/zpp/number_or_str_zpp_strict_mode.phpt b/Zend/tests/zpp/number_or_str_zpp_strict_mode.phpt
new file mode 100644
index 00000000000..15c616c3709
--- /dev/null
+++ b/Zend/tests/zpp/number_or_str_zpp_strict_mode.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test Z_PARAM_NUMBER_OR_STR() and Z_PARAM_NUMBER_OR_STR_OR_NULL (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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:
+TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, null given
+NULL
+Using false:
+TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, false given
+TypeError: zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, false given
+Using true:
+TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, true given
+TypeError: zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, true given
+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(%d) "class@anonymous%s"
+string(%d) "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():
+TypeError: zend_number_or_string(): Argument #1 ($param) must be of type string|int|float, S given
+TypeError: zend_number_or_string_or_null(): Argument #1 ($param) must be of type string|int|float|null, S given
+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/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt b/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt
new file mode 100644
index 00000000000..f0a8985297f
--- /dev/null
+++ b/Zend/tests/zpp/number_or_str_zpp_weak_mode.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test Z_PARAM_NUMBER_OR_STR() and Z_PARAM_NUMBER_OR_STR_OR_NULL (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/number_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/number_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..a91dd9f7b28
--- /dev/null
+++ b/Zend/tests/zpp/number_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test number ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..2cdc710405a
--- /dev/null
+++ b/Zend/tests/zpp/number_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test number ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/obj_of_class_or_int_zpp_strict_mode.phpt b/Zend/tests/zpp/obj_of_class_or_int_zpp_strict_mode.phpt
new file mode 100644
index 00000000000..360160d4845
--- /dev/null
+++ b/Zend/tests/zpp/obj_of_class_or_int_zpp_strict_mode.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS_OR_LONG() and Z_PARAM_OBJ_OF_CLASS_OR_LONG_OR_NULL() (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_obj_stdclass_or_int($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_obj_stdclass_or_int_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECT--
+Using null:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, null given
+NULL
+Using false:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, false given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, false given
+Using true:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, true given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, true given
+Using 42:
+int(42)
+int(42)
+Using 73.5:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, float given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, float given
+Using 'string':
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using '15':
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using '56.7':
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using 'stdClass':
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using anon class name:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using []:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, array given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, array given
+Using new stdClass():
+object(stdClass)#2 (0) {
+}
+object(stdClass)#2 (0) {
+}
+Using new S():
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, S given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, S given
+Using STDOUT:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, resource given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, resource given
diff --git a/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt
new file mode 100644
index 00000000000..6322c56ddf6
--- /dev/null
+++ b/Zend/tests/zpp/obj_of_class_or_int_zpp_weak_mode.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS_OR_LONG() and Z_PARAM_OBJ_OF_CLASS_OR_LONG_OR_NULL() (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_obj_stdclass_or_int($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_obj_stdclass_or_int_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECTF--
+Using null:
+
+Deprecated: zend_obj_stdclass_or_int(): Passing null to parameter #1 ($param) of type stdClass|int|null 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:
+
+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_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using '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)
+Using 'stdClass':
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using anon class name:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, string given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, string given
+Using []:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, array given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, array given
+Using new stdClass():
+object(stdClass)#2 (0) {
+}
+object(stdClass)#2 (0) {
+}
+Using new S():
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, S given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, S given
+Using STDOUT:
+TypeError: zend_obj_stdclass_or_int(): Argument #1 ($param) must be of type stdClass|int, resource given
+TypeError: zend_obj_stdclass_or_int_or_null(): Argument #1 ($param) must be of type stdClass|int|null, resource given
diff --git a/Zend/tests/zpp/obj_of_class_or_str_zpp_strict_mode.phpt b/Zend/tests/zpp/obj_of_class_or_str_zpp_strict_mode.phpt
new file mode 100644
index 00000000000..8a216dadbc4
--- /dev/null
+++ b/Zend/tests/zpp/obj_of_class_or_str_zpp_strict_mode.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_obj_stdclass_or_string($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_obj_stdclass_or_string_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECTF--
+Using null:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, null given
+NULL
+Using false:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, false given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|string|null, false given
+Using true:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, true given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|string|null, true given
+Using 42:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, int given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|string|null, int given
+Using 73.5:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, float given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|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(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+Using []:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, array given
+TypeError: zend_obj_stdclass_or_string_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():
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, S given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|string|null, S given
+Using STDOUT:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, resource given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|string|null, resource given
diff --git a/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt
new file mode 100644
index 00000000000..be0dcbc7496
--- /dev/null
+++ b/Zend/tests/zpp/obj_of_class_or_str_zpp_weak_mode.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_obj_stdclass_or_string($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_obj_stdclass_or_string_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECTF--
+Using null:
+
+Deprecated: zend_obj_stdclass_or_string(): Passing null to parameter #1 ($param) of type stdClass|string|null 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(%d) "class@anonymous%s"
+string(%d) "class@anonymous%s"
+Using []:
+TypeError: zend_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, array given
+TypeError: zend_obj_stdclass_or_string_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_obj_stdclass_or_string(): Argument #1 ($param) must be of type stdClass|string, resource given
+TypeError: zend_obj_stdclass_or_string_or_null(): Argument #1 ($param) must be of type stdClass|string|null, resource given
diff --git a/Zend/tests/zpp/obj_of_class_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/obj_of_class_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..b337a74d6a8
--- /dev/null
+++ b/Zend/tests/zpp/obj_of_class_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS() and Z_PARAM_OBJ_OF_CLASS_OR_NULL() (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_object_sdtClass($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ $ref =& $type;
+ try {
+ var_dump(zend_object_sdtClass($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECT--
+Using null:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+Using false:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+Using true:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+Using 42:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+Using 73.5:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+Using 'string':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '15':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '56.7':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using 'stdClass':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using anon class name:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using []:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, 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():
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+Using STDOUT:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
diff --git a/Zend/tests/zpp/obj_of_class_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/obj_of_class_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..cbd0d6ffeee
--- /dev/null
+++ b/Zend/tests/zpp/obj_of_class_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS() and Z_PARAM_OBJ_OF_CLASS_OR_NULL() (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_object_sdtClass($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ $ref =& $type;
+ try {
+ var_dump(zend_object_sdtClass($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECT--
+Using null:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+Using false:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+Using true:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+Using 42:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+Using 73.5:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+Using 'string':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '15':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '56.7':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using 'stdClass':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using anon class name:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using []:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, 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():
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+Using STDOUT:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
diff --git a/Zend/tests/zpp/obj_or_class_name_zpp_strict_mode.phpt b/Zend/tests/zpp/obj_or_class_name_zpp_strict_mode.phpt
new file mode 100644
index 00000000000..9bdfd66ae4e
--- /dev/null
+++ b/Zend/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--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/obj_or_class_name_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_or_class_name_zpp_weak_mode.phpt
new file mode 100644
index 00000000000..c14250a14f9
--- /dev/null
+++ b/Zend/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--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/obj_or_str_zpp_strict_mode.phpt b/Zend/tests/zpp/obj_or_str_zpp_strict_mode.phpt
new file mode 100644
index 00000000000..9614acdee27
--- /dev/null
+++ b/Zend/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--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/obj_or_str_zpp_weak_mode.phpt b/Zend/tests/zpp/obj_or_str_zpp_weak_mode.phpt
new file mode 100644
index 00000000000..76198926ffe
--- /dev/null
+++ b/Zend/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--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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(%d) "class@anonymous%s"
+string(%d) "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/Zend/tests/zpp/obj_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/obj_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..fecfb294bb4
--- /dev/null
+++ b/Zend/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--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/obj_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/obj_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..0557f1f03f3
--- /dev/null
+++ b/Zend/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--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/object_of_class_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/object_of_class_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..94c31e1972f
--- /dev/null
+++ b/Zend/tests/zpp/object_of_class_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test object of class ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_object_sdtClass($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ $ref =& $type;
+ try {
+ var_dump(zend_object_sdtClass($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECT--
+Using null:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+Using false:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+Using true:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+Using 42:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+Using 73.5:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+Using 'string':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '15':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '56.7':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using 'stdClass':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using anon class name:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using []:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, 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():
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+Using STDOUT:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
diff --git a/Zend/tests/zpp/object_of_class_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/object_of_class_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..b5ed5029645
--- /dev/null
+++ b/Zend/tests/zpp/object_of_class_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test object of class ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $type) {
+ echo "Using $name:\n";
+ try {
+ var_dump(zend_object_sdtClass($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($type));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ $ref =& $type;
+ try {
+ var_dump(zend_object_sdtClass($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+ try {
+ var_dump(zend_object_sdtClass_or_null_slow_zpp($ref));
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ }
+}
+
+?>
+--EXPECT--
+Using null:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, null given
+NULL
+Using false:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, false given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, false given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, false given
+Using true:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, true given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, true given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, true given
+Using 42:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, int given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, int given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, int given
+Using 73.5:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, float given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, float given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, float given
+Using 'string':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '15':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using '56.7':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using 'stdClass':
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using anon class name:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, string given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, string given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, string given
+Using []:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, array given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, array given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, 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():
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, S given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, S given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, S given
+Using STDOUT:
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null(): Argument #1 ($param) must be of type ?stdClass, resource given
+TypeError: zend_object_sdtClass_slow_zpp(): Argument #1 ($param) must be of type stdClass, resource given
+TypeError: zend_object_sdtClass_or_null_slow_zpp(): Argument #1 ($param) must be of type ?stdClass, resource given
diff --git a/Zend/tests/zpp/object_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/object_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..c0f66a7846a
--- /dev/null
+++ b/Zend/tests/zpp/object_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test object ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/object_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/object_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..d97078aaca4
--- /dev/null
+++ b/Zend/tests/zpp/object_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test object ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/resource_zpp_specifier_strict_mode.phpt b/Zend/tests/zpp/resource_zpp_specifier_strict_mode.phpt
new file mode 100644
index 00000000000..3b3da48bdf5
--- /dev/null
+++ b/Zend/tests/zpp/resource_zpp_specifier_strict_mode.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test resource ZPP specifier (strict_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/resource_zpp_specifier_weak_mode.phpt b/Zend/tests/zpp/resource_zpp_specifier_weak_mode.phpt
new file mode 100644
index 00000000000..04bc27cb01d
--- /dev/null
+++ b/Zend/tests/zpp/resource_zpp_specifier_weak_mode.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Test resource ZPP specifier (weak_mode)
+--EXTENSIONS--
+zend_test
+--FILE--
+<?php
+
+$types = require 'types.inc';
+
+foreach ($types as $name => $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/Zend/tests/zpp/types.inc b/Zend/tests/zpp/types.inc
new file mode 100644
index 00000000000..43cac4a1560
--- /dev/null
+++ b/Zend/tests/zpp/types.inc
@@ -0,0 +1,26 @@
+<?php
+
+class S {
+ public function __toString(): string {
+ return 'S class';
+ }
+}
+
+$anon = new class {};
+
+return [
+ 'null' => 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,
+];
diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c
index a880c09fc1f..82bfa8d38e3 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@ -225,14 +225,445 @@ static ZEND_FUNCTION(zend_delref)
RETURN_NULL();
}
-/* Tests Z_PARAM_OBJ_OR_STR */
-static ZEND_FUNCTION(zend_string_or_object)
+/* 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_object_sdtClass)
+{
+ zval *v;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJECT_OF_CLASS(v, zend_standard_class_def)
+ ZEND_PARSE_PARAMETERS_END();
+
+ RETURN_COPY(v);
+}
+
+static ZEND_FUNCTION(zend_object_sdtClass_or_null)
+{
+ zval *v;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJECT_OF_CLASS_OR_NULL(v, zend_standard_class_def)
+ ZEND_PARSE_PARAMETERS_END();
+
+ if (v == NULL) {
+ RETURN_NULL();
+ }
+ RETURN_COPY(v);
+}
+
+static ZEND_FUNCTION(zend_object_sdtClass_slow_zpp)
+{
+ zval *v;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &v, zend_standard_class_def) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ RETURN_COPY(v);
+}
+
+static ZEND_FUNCTION(zend_object_sdtClass_or_null_slow_zpp)
+{
+ zval *v;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O!", &v, zend_standard_class_def) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (v == NULL) {
+ RETURN_NULL();
+ }
+ RETURN_COPY(v);
+}
+
+static ZEND_FUNCTION(zend_obj_sdtClass)
+{
+ zend_object *v;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJ_OF_CLASS(v, zend_standard_class_def)
+ ZEND_PARSE_PARAMETERS_END();
+
+ RETURN_OBJ_COPY(v);
+}
+
+static ZEND_FUNCTION(zend_obj_sdtClass_or_null)
+{
+ zend_object *v;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJ_OF_CLASS_OR_NULL(v, zend_standard_class_def)
+ ZEND_PARSE_PARAMETERS_END();
+
+ if (v == NULL) {
+ RETURN_NULL();
+ }
+ RETURN_OBJ_COPY(v);
+}
+
+static ZEND_FUNCTION(zend_obj_stdclass_or_string)
{
zend_string *str;
zend_object *object;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJ_OR_STR(object, str)
+ Z_PARAM_OBJ_OF_CLASS_OR_STR(object, zend_standard_class_def, str)
ZEND_PARSE_PARAMETERS_END();
if (str) {
@@ -242,14 +673,13 @@ static ZEND_FUNCTION(zend_string_or_object)
}
}
-/* Tests Z_PARAM_OBJ_OR_STR_OR_NULL */
-static ZEND_FUNCTION(zend_string_or_object_or_null)
+static ZEND_FUNCTION(zend_obj_stdclass_or_string_or_null)
{
zend_string *str;
zend_object *object;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJ_OR_STR_OR_NULL(object, str)
+ Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL(object, zend_standard_class_def, str)
ZEND_PARSE_PARAMETERS_END();
if (str) {
@@ -261,66 +691,116 @@ static ZEND_FUNCTION(zend_string_or_object_or_null)
}
}
-/* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR */
-static ZEND_FUNCTION(zend_string_or_stdclass)
+static ZEND_FUNCTION(zend_obj_stdclass_or_int)
{
- zend_string *str;
+ zend_long l;
zend_object *object;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJ_OF_CLASS_OR_STR(object, zend_standard_class_def, str)
+ Z_PARAM_OBJ_OF_CLASS_OR_LONG(object, zend_standard_class_def, l)
ZEND_PARSE_PARAMETERS_END();
- if (str) {
- RETURN_STR_COPY(str);
+ if (object) {
+ RETURN_OBJ_COPY(object);
} else {
+ RETURN_LONG(l);
+ }
+}
+
+static ZEND_FUNCTION(zend_obj_stdclass_or_int_or_null)
+{
+ zend_long l;
+ zend_object *object;
+ bool is_null;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJ_OF_CLASS_OR_LONG_OR_NULL(object, zend_standard_class_def, l, is_null)
+ ZEND_PARSE_PARAMETERS_END();
+
+ if (is_null) {
+ RETURN_NULL();
+ } else if (object) {
RETURN_OBJ_COPY(object);
+ } else {
+ RETURN_LONG(l);
}
}
-static ZEND_FUNCTION(zend_test_compile_string)
+static ZEND_FUNCTION(zend_resource)
{
- zend_string *source_string = NULL;
- zend_string *filename = NULL;
- zend_long position = ZEND_COMPILE_POSITION_AT_OPEN_TAG;
+ zval *v;
- ZEND_PARSE_PARAMETERS_START(3, 3)
- Z_PARAM_STR(source_string)
- Z_PARAM_PATH_STR(filename)
- Z_PARAM_LONG(position)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(v)
ZEND_PARSE_PARAMETERS_END();
- zend_op_array *op_array = NULL;
+ RETURN_COPY(v);
+}
- op_array = compile_string(source_string, ZSTR_VAL(filename), position);
+static ZEND_FUNCTION(zend_resource_or_null)
+{
+ zval *v;
- if (op_array) {
- zval retval;
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE_OR_NULL(v)
+ ZEND_PARSE_PARAMETERS_END();
- 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();
+ if (v == NULL) {
+ RETURN_NULL();
+ }
+ RETURN_COPY(v);
+}
- destroy_op_array(op_array);
- efree_size(op_array, sizeof(zend_op_array));
+static ZEND_FUNCTION(zend_resource_slow_zpp)
+{
+ zval *v;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &v) == FAILURE) {
+ RETURN_THROWS();
}
- return;
+ RETURN_COPY(v);
}
-/* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL */
-static ZEND_FUNCTION(zend_string_or_stdclass_or_null)
+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)
{
zend_string *str;
zend_object *object;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL(object, zend_standard_class_def, str)
+ Z_PARAM_OBJ_OR_STR(object, str)
+ ZEND_PARSE_PARAMETERS_END();
+
+ if (str) {
+ RETURN_STR_COPY(str);
+ } else {
+ RETURN_OBJ_COPY(object);
+ }
+}
+
+/* Tests Z_PARAM_OBJ_OR_STR_OR_NULL */
+static ZEND_FUNCTION(zend_string_or_object_or_null)
+{
+ zend_string *str;
+ zend_object *object;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJ_OR_STR_OR_NULL(object, str)
ZEND_PARSE_PARAMETERS_END();
if (str) {
@@ -376,6 +856,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 +986,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 7c96ea176a8..3c09668bddb 100644
--- a/ext/zend_test/test.stub.php
+++ b/ext/zend_test/test.stub.php
@@ -299,15 +299,80 @@ 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 {}
+
+ function zend_object_sdtClass(stdClass $param): stdClass {}
+ function zend_object_sdtClass_or_null(stdClass|null $param): stdClass|null {}
+ function zend_object_sdtClass_slow_zpp(stdClass $param): stdClass {}
+ function zend_object_sdtClass_or_null_slow_zpp(stdClass|null $param): stdClass|null {}
+
+ function zend_obj_sdtClass(stdClass $param): stdClass {}
+ function zend_obj_sdtClass_or_null(stdClass|null $param): stdClass|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 {}
- /** @param stdClass|string $param */
- function zend_string_or_stdclass($param): stdClass|string {}
+ function zend_obj_stdclass_or_string(stdClass|string|null $param): stdClass|string {}
+ function zend_obj_stdclass_or_string_or_null(stdClass|string|null $param): stdClass|string|null {}
- /** @param stdClass|string|null $param */
- function zend_string_or_stdclass_or_null($param): stdClass|string|null {}
+ function zend_obj_stdclass_or_int(stdClass|int|null $param): stdClass|int {}
+ function zend_obj_stdclass_or_int_or_null(stdClass|int|null $param): stdClass|int|null {}
function zend_number_or_string(string|int|float $param): string|int|float {}
diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h
index b2e342382db..93fdadb7f6b 100644
Binary files a/ext/zend_test/test_arginfo.h and b/ext/zend_test/test_arginfo.h differ
diff --git a/ext/zend_test/test_decl.h b/ext/zend_test/test_decl.h
index ea6a2c94fbd..7e41dc18eab 100644
Binary files a/ext/zend_test/test_decl.h and b/ext/zend_test/test_decl.h differ
diff --git a/ext/zend_test/test_legacy_arginfo.h b/ext/zend_test/test_legacy_arginfo.h
index 05014c80fd5..479a678df77 100644
Binary files a/ext/zend_test/test_legacy_arginfo.h and b/ext/zend_test/test_legacy_arginfo.h differ
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
deleted file mode 100644
index a72d504a2db..00000000000
--- a/ext/zend_test/tests/zpp/class-string_zpp_specifier_strict_mode.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Test class string ZPP specifier
---EXTENSIONS--
-zend_test
---FILE--
-<?php
-
-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,
-];
-
-foreach ($types as $type) {
- /* Use zend_object_init_with_constructor() function as it used Z_PARAM_CLASS */
- try {
- var_dump(zend_object_init_with_constructor($type));
- } 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
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
deleted file mode 100644
index 2110ecc4a0e..00000000000
--- a/ext/zend_test/tests/zpp/class-string_zpp_specifier_weak_mode.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-Test class string ZPP specifier
---EXTENSIONS--
-zend_test
---FILE--
-<?php
-
-class S {
- public function __toString(): string {
- return 'S class';
- }
-}
-
-$types = [
- null,
- false,
- true,
- 42,
- 73.5,
- 'string',
- [],
- new stdClass(),
- new S(),
- STDOUT,
-];
-
-foreach ($types as $type) {
- /* Use zend_object_init_with_constructor() function as it used Z_PARAM_CLASS */
- try {
- var_dump(zend_object_init_with_constructor($type));
- } catch (Throwable $e) {
- echo $e::class, ': ', $e->getMessage(), PHP_EOL;
- }
-}
-
-?>
---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