Common causes
- A function signature gained a new required parameter but old call sites were not updated
- WordPress add_action/add_filter registered with the default 1 accepted argument while the callback expects more
- Laravel route parameters or dependency injection not matching the controller method
- Callbacks passed to array_map, usort or event dispatchers with a different number of parameters
- A plugin or library update changed a public method signature
How to fix it
- Compare the call to the definition. The message shows how many arguments were passed and how many are expected, plus the calling file and line. Open both.
- Pass the missing arguments. Update the call site to supply every required parameter in the right order, or use named arguments in PHP 8 for clarity.
- Add sensible defaults. If the new parameter is optional in practice, give it a default (string $cc = '') so existing calls keep working.
- Fix WordPress hook arg counts. Set the fourth argument of add_action/add_filter to the number your callback takes, e.g. add_action('save_post', 'my_fn', 10, 3).
- Match framework routing. In Laravel, make sure the route has a {placeholder} for every non-injected controller parameter, and that names match.
- Check for signature changes after updates. If the error appeared after updating a package, read its changelog and update your overrides or calls.
WordPress
// callback takes 3 args, so tell WordPress to pass 3
add_action('save_post', 'acme_on_save', 10, 3);
function acme_on_save(int $post_id, WP_Post $post, bool $update): void
{
// ...
} How to stop it happening again
- Add new parameters with defaults to keep backward compatibility
- Use an IDE or static analysis to flag mismatched calls
- Pin and review major version updates of libraries you extend