Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

felloz's avatar

PHP 8: Error Unknown named parameter

Since Updated PHP to 8 I'm getting this error: Error Unknown named parameter $campaign

And point the error to this line:

public function callAction($method, $parameters)
{
	//This line error
	return call_user_func_array([$this, $method], $parameters);

}

This is my route:

Route::get('/campaign_sent/{campaing}', 'CampaignsController@sentView')
    ->where('campaign', '[0-9]+')
    ->middleware('auth');

And my Controller:

public function sentView(Campaign $campaignData)
{
	return view('emailcampaign.sent_view');
}

Everything was working great just before the update.

0 likes
4 replies
Sergiu17's avatar
Sergiu17
Best Answer
Level 60

Route::get('/campaign_sent/{campaign}', 'CampaignsController@sentView')

public function sentView(Campaign $campaignData)

those two highlighted should match

public function sentView(Campaign $campaign)
{
	return view('emailcampaign.sent_view');
}
1 like
felloz's avatar

Don't know how was working fine before the update.

Thank you!

Abhishek0116's avatar

Thanks, It's solved my issue. Everything were fine before update to PHP 8.0

I really did not understood what the exact problem was? But you solved it immediately.

Thank you so much.

1 like

Please or to participate in this conversation.