Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f8237a0
[`%pS` migration] Use `%pS` in Zend/zend_API.c
DanielEScherzer Aug 8, 2026
9b185ca
[`%pS` migration] Use `%pS` in Zend/zend_ast.c
DanielEScherzer Aug 8, 2026
3eb2cdc
[`%pS` migration] Use `%pS` in Zend/zend_attributes.c
DanielEScherzer Aug 8, 2026
f0d3ffa
[`%pS` migration] Use `%pS` in Zend/zend_builtin_functions.c
DanielEScherzer Aug 8, 2026
9d60681
[`%pS` migration] Use `%pS` in Zend/zend_closures.c
DanielEScherzer Aug 8, 2026
98682c4
[`%pS` migration] Use `%pS` in Zend/zend_compile.c
DanielEScherzer Aug 8, 2026
f915cf8
[`%pS` migration] Use `%pS` in Zend/zend_constants.c
DanielEScherzer Aug 8, 2026
b0e6fab
[`%pS` migration] Use `%pS` in Zend/zend_enum.c
DanielEScherzer Aug 8, 2026
afe8b7f
[`%pS` migration] Use `%pS` in Zend/zend_exceptions.c
DanielEScherzer Aug 8, 2026
31bf84a
[`%pS` migration] Use `%pS` in Zend/zend_execute_API.c
DanielEScherzer Aug 8, 2026
d7a7af5
[`%pS` migration] Use `%pS` in Zend/zend_execute.c
DanielEScherzer Aug 8, 2026
5a6d100
[`%pS` migration] Use `%pS` in Zend/zend_fibers.c
DanielEScherzer Aug 8, 2026
76a8c93
[`%pS` migration] Use `%pS` in Zend/zend_inheritance.c
DanielEScherzer Aug 8, 2026
2d4c282
[`%pS` migration] Use `%pS` in Zend/zend_ini.c
DanielEScherzer Aug 8, 2026
86fa4e2
[`%pS` migration] Use `%pS` in Zend/zend_interfaces.c
DanielEScherzer Aug 8, 2026
54bc5cb
[`%pS` migration] Use `%pS` in Zend/zend_lazy_objects.c
DanielEScherzer Aug 8, 2026
a156057
[`%pS` migration] Use `%pS` in Zend/zend_object_handlers.c
DanielEScherzer Aug 8, 2026
4ea9696
[`%pS` migration] Use `%pS` in Zend/zend_objects.c
DanielEScherzer Aug 8, 2026
aef3364
[`%pS` migration] Use `%pS` in Zend/zend_operators.c
DanielEScherzer Aug 8, 2026
21dde13
[`%pS` migration] Use `%pS` in Zend/zend_partial.c
DanielEScherzer Aug 8, 2026
8b2ad93
[`%pS` migration] Use `%pS` in Zend/zend_property_hooks.c
DanielEScherzer Aug 8, 2026
9f8f163
[`%pS` migration] Use `%pS` in Zend/zend_vm_def.h
DanielEScherzer Aug 8, 2026
b98335c
[`%pS` migration] Use `%pS` in Zend/zend_weakrefs.c
DanielEScherzer Aug 8, 2026
eb82bf9
[`%pS` migration] Use `%pS` in Zend/zend.c
DanielEScherzer Aug 8, 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
2 changes: 1 addition & 1 deletion Zend/tests/anon/gh15994.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ abstract class ParentClass {
$o = new class extends ParentClass {};
?>
--EXPECTF--
Fatal error: Class ParentClass@anonymous must implement 1 abstract method (ParentClass::f) in %sgh15994.php on line 7
Fatal error: Class ParentClass@anonymous%0%s must implement 1 abstract method (ParentClass::f) in %sgh15994.php on line 7
2 changes: 1 addition & 1 deletion Zend/tests/attributes/override/constants/anon_failure.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ echo "Done";

?>
--EXPECTF--
Fatal error: class@anonymous::C has #[\Override] attribute, but no matching parent constant exists in %s on line %d
Fatal error: class@anonymous%0%s::C has #[\Override] attribute, but no matching parent constant exists in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/attributes/override/properties_16.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ echo "Done";

?>
--EXPECTF--
Fatal error: I@anonymous::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d
Fatal error: I@anonymous%0%s::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d
6 changes: 3 additions & 3 deletions Zend/tests/dynamic_prop_deprecation_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ try {
echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
Err: Creation of dynamic property class@anonymous::$y is deprecated
Error: Cannot create dynamic property class@anonymous::$y
--EXPECTF--
Err: Creation of dynamic property class@anonymous%0%s::$y is deprecated
Error: Cannot create dynamic property class@anonymous%0%s::$y
4 changes: 2 additions & 2 deletions Zend/tests/gh19304.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ try {
}

?>
--EXPECT--
TypeError: Cannot assign int to property class@anonymous::$v of type self
--EXPECTF--
TypeError: Cannot assign int to property class@anonymous%0%s of type self
2 changes: 1 addition & 1 deletion Zend/tests/readonly_classes/gh10377_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ $readonly_anon = new #[AllowDynamicProperties] readonly class {

?>
--EXPECTF--
Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class class@anonymous in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class class@anonymous%0%s in %s on line %d
12 changes: 6 additions & 6 deletions Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -284,27 +284,27 @@ caught Exception 3
caught Exception 4
caught Exception 5

Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d
Deprecated: Creation of dynamic property class@anonymous%0%s::$foo is deprecated in %s on line %d
caught Exception 6
caught Exception 7
caught Exception 8
caught Exception 9
caught Exception 10

Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d
Deprecated: Creation of dynamic property class@anonymous%0%s::$foo is deprecated in %s on line %d
caught Exception 11

Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d
Deprecated: Creation of dynamic property class@anonymous%0%s::$foo is deprecated in %s on line %d
caught Exception 12
caught Exception 13

Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d
Deprecated: Creation of dynamic property class@anonymous%0%s::$foo is deprecated in %s on line %d
caught Exception 14

Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d
Notice: Indirect modification of overloaded element of ArrayAccess@anonymous%0%s has no effect in %s on line %d
caught Exception 15

Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d
Notice: Indirect modification of overloaded element of ArrayAccess@anonymous%0%s has no effect in %s on line %d
caught Exception 16
caught Exception 17
caught Exception 18
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $thing = new class() {
var_dump($thing->int);
?>
--EXPECTF--
Fatal error: Uncaught Error: Typed property class@anonymous::$int must not be accessed before initialization in %s:%d
Fatal error: Uncaught Error: Typed property class@anonymous%0%s::$int must not be accessed before initialization in %s:%d
Stack trace:
#0 {main}
thrown in %s on line 6
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $thing = new class() {
$var = &$thing->int;
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot access uninitialized non-nullable property class@anonymous::$int by reference in %s:%d
Fatal error: Uncaught Error: Cannot access uninitialized non-nullable property class@anonymous%0%s::$int by reference in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ new class("PHP 7 is better than you, and it knows it ...") {
};
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous::$int of type int in %s:%d
Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous%0%s::$int of type int in %s:%d
Stack trace:
#0 %s(%d): class@anonymous->__construct('PHP 7 is better...')
#1 {main}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ new class(new Dummy) {
};
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Cannot assign Dummy to property class@anonymous::$std of type stdClass in %s:%d
Fatal error: Uncaught TypeError: Cannot assign Dummy to property class@anonymous%0%s::$std of type stdClass in %s:%d
Stack trace:
#0 %s(%d): class@anonymous->__construct(Object(Dummy))
#1 {main}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_033.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ try {
var_dump($foo);
?>
--EXPECTF--
TypeError: Cannot assign float to reference held by property class@anonymous::$qux of type int
TypeError: Cannot assign float to reference held by property class@anonymous%0%s::$qux of type int
object(class@anonymous)#1 (4) {
["foo"]=>
int(2)
Expand Down
6 changes: 3 additions & 3 deletions Zend/tests/type_declarations/typed_properties_034.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ try {

var_dump($foo);
?>
--EXPECT--
--EXPECTF--
int(42)
TypeError: Cannot assign null to property class@anonymous::$baz of type int
TypeError: Cannot assign null to property class@anonymous%0%s::$baz of type int
int(1)
int(10)
int(10)
TypeError: Cannot assign null to reference held by property class@anonymous::$baz of type int
TypeError: Cannot assign null to reference held by property class@anonymous%0%s::$baz of type int
object(class@anonymous)#1 (2) {
["bar"]=>
&int(10)
Expand Down
8 changes: 4 additions & 4 deletions Zend/tests/type_declarations/typed_properties_038.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ try {
var_dump($foo);
?>
--EXPECTF--
TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value
TypeError: Cannot increment property class@anonymous%0%s::$bar of type int past its maximal value
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
TypeError: Cannot assign float to property class@anonymous::$bar of type int
TypeError: Cannot assign float to property class@anonymous%0%s::$bar of type int
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value
TypeError: Cannot increment property class@anonymous%0%s::$bar of type int past its maximal value
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
TypeError: Cannot assign float to property class@anonymous::$bar of type int
TypeError: Cannot assign float to property class@anonymous%0%s::$bar of type int
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
Expand Down
10 changes: 5 additions & 5 deletions Zend/tests/type_declarations/typed_properties_044.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ try {
}

?>
--EXPECT--
--EXPECTF--
int(0)
int(-2)
int(-1)
int(-1)
TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value
TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$bar of type ?int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$bar of type ?int past its maximal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$bar of type ?int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$bar of type ?int past its minimal value
14 changes: 7 additions & 7 deletions Zend/tests/type_declarations/typed_properties_062.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ $a->_ = 1;
var_dump($a->foo);

?>
--EXPECT--
--EXPECTF--
int(2)
int(21)
TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int
TypeError: Cannot assign string to reference held by property class@anonymous%0%s::$foo of type int
int(21)
int(20)
int(19)
TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int
TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$foo of type int
int(0)
int(1)
14 changes: 7 additions & 7 deletions Zend/tests/type_declarations/typed_properties_063.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ $_ = 1;
var_dump($a->foo);

?>
--EXPECT--
--EXPECTF--
int(2)
int(21)
TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int
TypeError: Cannot assign string to reference held by property class@anonymous%0%s::$foo of type int
int(21)
int(20)
int(19)
TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int
TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$foo of type int
int(0)
int(1)
14 changes: 7 additions & 7 deletions Zend/tests/type_declarations/typed_properties_064.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ $_[0] = 1;
var_dump($a->foo);

?>
--EXPECT--
--EXPECTF--
int(2)
int(21)
TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int
TypeError: Cannot assign string to reference held by property class@anonymous%0%s::$foo of type int
int(21)
int(20)
int(19)
TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int
TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$foo of type int
int(0)
int(1)
10 changes: 5 additions & 5 deletions Zend/tests/type_declarations/typed_properties_065.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ try {
echo gettype($a->foo),"\n";

?>
--EXPECT--
--EXPECTF--
offsetSet(2)
int(1)
offsetSet(11)
Expand All @@ -61,11 +61,11 @@ offsetSet(1e50)
int(1)
int(0)
int(-1)
TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its minimal value
integer
TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its maximal value
integer
TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
TypeError: Cannot increment a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its maximal value
integer
8 changes: 4 additions & 4 deletions Zend/tests/type_declarations/typed_properties_078.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ $ref = new ArrayIterator();
var_dump($ref instanceof ArrayIterator);

?>
--EXPECT--
--EXPECTF--
array(0) {
}
TypeError: Cannot assign array to property class@anonymous::$t of type ?Traversable
TypeError: Cannot assign array to property class@anonymous%0%s::$t of type ?Traversable
array(0) {
}
array(1) {
[0]=>
int(1)
}
TypeError: Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array
TypeError: Cannot assign ArrayIterator to reference held by property class@anonymous%0%s::$a of type ?array
bool(false)
TypeError: Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable
TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$t of type ?Traversable
bool(false)
bool(true)
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ try {
}
?>
--EXPECTF--
TypeError: class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d
TypeError: class@anonymous%0%s::testParam(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d
TypeError: class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned
23 changes: 11 additions & 12 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ static ZEND_INI_MH(OnUpdateMaxAllowedStackSize) /* {{{ */
zend_long size = zend_ini_parse_quantity_warn(new_value, entry->name);

if (size < ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED) {
zend_error(E_WARNING, "Invalid \"%s\" setting. Value must be >= %d, but got " ZEND_LONG_FMT,
ZSTR_VAL(entry->name), ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED, size);
zend_error(E_WARNING, "Invalid \"%pS\" setting. Value must be >= %d, but got " ZEND_LONG_FMT,
entry->name, ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED, size);
return FAILURE;
}

Expand Down Expand Up @@ -228,8 +228,8 @@ static ZEND_INI_MH(OnUpdateReservedStackSize) /* {{{ */
if (size == 0) {
size = min;
} else if (size < min) {
zend_error(E_WARNING, "Invalid \"%s\" setting. Value must be >= " ZEND_ULONG_FMT ", but got " ZEND_ULONG_FMT "\n",
ZSTR_VAL(entry->name), min, size);
zend_error(E_WARNING, "Invalid \"%pS\" setting. Value must be >= " ZEND_ULONG_FMT ", but got " ZEND_ULONG_FMT "\n",
entry->name, min, size);
return FAILURE;
}

Expand Down Expand Up @@ -1833,7 +1833,7 @@ ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const c
if (EG(current_execute_data) && !CG(in_compilation)) {
zend_throw_exception_ex(exception_ce, 0, "%pS", message);
} else {
zend_error_noreturn(E_ERROR, "%s", ZSTR_VAL(message));
zend_error_noreturn(E_ERROR, "%pS", message);
}

zend_string_release(message);
Expand All @@ -1854,25 +1854,24 @@ ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *contain
if (zend_string_equals(container, ZSTR_KNOWN(ZEND_STR_STRING))) {
zend_throw_error(NULL, "Cannot unset string offsets");
} else {
zend_type_error("Cannot unset offset of type %s on %s", zend_zval_type_name(offset), ZSTR_VAL(container));
zend_type_error("Cannot unset offset of type %s on %pS", zend_zval_type_name(offset), container);
}
return;
default:
zend_type_error("Cannot access offset of type %s on %s",
zend_zval_type_name(offset), ZSTR_VAL(container));
zend_type_error("Cannot access offset of type %s on %pS",
zend_zval_type_name(offset), container);
return;
}
}

ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */
{
va_list va;
char *message = NULL;

va_start(va, format);
zend_vspprintf(&message, 0, format, va);
zend_throw_exception(zend_ce_type_error, message, 0);
efree(message);
zend_string *message = zend_vstrpprintf(0, format, va);
zend_throw_exception_ex(zend_ce_type_error, 0, "%pS", message);
zend_string_release(message);
va_end(va);
} /* }}} */

Expand Down
Loading
Loading