Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
088b111
ZPP: move ZPP tests to zend_test
Girgias Aug 9, 2026
5f27f03
zend_test: group ZPP test functions together
Girgias Aug 9, 2026
5eeaab8
zend_test: extract types generation
Girgias Aug 9, 2026
fe929da
zend_test: add output about checked types
Girgias Aug 12, 2026
b02f6b4
zend_test: use generic types file for other ZPP tests
Girgias Aug 9, 2026
896544a
zend_test: add numeric strings
Girgias Aug 9, 2026
bd87041
zend_test: add bool ZPP specifier test
Girgias Aug 9, 2026
7701638
zend_test: add int ZPP specifier test
Girgias Aug 9, 2026
53159b8
zend_test: add float ZPP specifier test
Girgias Aug 9, 2026
c942173
zend_test: add number ZPP specifier test
Girgias Aug 9, 2026
0a4065b
zend_test: add resource ZPP specifier test
Girgias Aug 12, 2026
4b436cf
Add class string and anonymous class string to test fixtures
Girgias Aug 13, 2026
b729dbd
zend_test: improve class name ZPP test
Girgias Aug 12, 2026
4e48d7d
zend_test: add object ZPP specifier test
Girgias Aug 12, 2026
c08d26a
zend_test: add Z_PARAM_OBJ ZPP specifier test
Girgias Aug 12, 2026
9175cc3
zend_test: improve testing for object|string ZPP
Girgias Aug 13, 2026
4883499
zend_test: add Z_PARAM_OBJ_OR_CLASS_NAME ZPP specifier test
Girgias Aug 13, 2026
75d96aa
improve number or str ZPP tests
Girgias Aug 13, 2026
5025421
zend_test: add object of class ZPP specifier test
Girgias Aug 13, 2026
65daf32
zend_test: add Z_PARAM_OBJ_OF_CLASS ZPP specifier test
Girgias Aug 13, 2026
efddc23
Improve testing of Z_PARAM_OBJ_OF_CLASS_OR_STR
Girgias Aug 13, 2026
6e723f2
zend_test: add Z_PARAM_OBJ_OF_CLASS_OR_LONG ZPP specifier test
Girgias Aug 13, 2026
edaab1a
Move ZPP tests to Zend/
Girgias Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
74 changes: 0 additions & 74 deletions Zend/tests/number_or_str_zpp.phpt

This file was deleted.

70 changes: 0 additions & 70 deletions Zend/tests/str_or_obj_of_class_zpp.phpt

This file was deleted.

53 changes: 0 additions & 53 deletions Zend/tests/str_or_obj_zpp.phpt

This file was deleted.

184 changes: 184 additions & 0 deletions Zend/tests/zpp/bool_zpp_specifier_strict_mode.phpt
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading