Description
The following code:
<?php declare(strict_types=1);
$input = [1, 2, 3];
array_walk($input, printf(...));
Resulted in this output:
But I expected this output instead:
Fatal error: Uncaught TypeError: printf(): Argument #1 ($format) must be of type string, int given
By comparison, this code throws as expected:
<?php declare(strict_types=1);
$input = [1, 2, 3];
foreach ($input as $k => $i) {
printf($i, $k);
}
PHP Version
PHP 8.4.10 (cli) (built: Jul 3 2025 12:35:27) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.10, Copyright (c) Zend Technologies
with Zend OPcache v8.4.10, Copyright (c), by Zend Technologies
with Xdebug v3.4.2, Copyright (c) 2002-2025, by Derick Rethans
Operating System
No response