id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 51900 [PHP 8] Named parameters in hook `call_user_func_array()` calls ayeshrajans "PHP 8.0 is here, and it comes with named parameters. While named parameter is a new feature that syntax would simply not work in older PHP versions, [https://php.watch/versions/8.0/named-parameters#named-params-call_user_func_array `call_user_func_array function behaves differently]. WordPress uses `call_user_func_array` extensively throughout the code, including filters and actions. With PHP 8.0, if the second parameter (`$param_arr`) is an associative array, PHP tries to call the callable as a named parameter. See example: https://3v4l.org/RhjrU What this means for WordPress, is that all parameters that a registered action, filter, or a standard ""params"" value **must not be an associative array**. This behavior is not warned. If the parameter array keys match function parameters, that is mostly a safe call, but if there is at least one parameter name that does not match, PHP will then raise a fatal error. One easy way to ""normalize"" the parameters is to call `array_values` before calling the function. Before submitting any patches, I would like to request opinions if this is desirable for WordPress. I guess reports will come in once users start to use PHP 8.0, and it's probably an easier fix at `call_user_func_array()` call-site rather than the action/filter/params declaration. Disclosure: I am the author of the page linked at the top of this ticket; I believe it provides more context without typing the whole story. " enhancement closed normal General normal duplicate php8 close