Addon: Mitch Member Reviews
XenForo Version: XF 2.2+ / 2.3
PHP Version: PHP 8.0+
Error
This error occurs when accessing the Member Reviews page without a valid
user_id, or when the controller returns $this->notFound() /
$this->error().
Root Cause
The controller method actionIndex() is strictly typed to return:
However, XenForo controller helpers such as:
• $this->notFound()
• $this->error()
• $this->noPermission()
return XF\Mvc\Reply\Error.
Under PHP 8+, this mismatch triggers a fatal TypeError.
Correct Fix (XenForo-Compliant)
XenForo controller actions must return
XF\Mvc\Reply\AbstractReply, which is the base class for all reply types
(View, Error, Redirect, etc.).
Quick Find & Replace Fix
File:
FIND
REPLACE WITH
FIND
REPLACE WITH
Result
• $this->view() → works
• $this->notFound() → works
• $this->error() → works
• No PHP 8+ fatal errors
• Fully XenForo-compliant controller behavior
Why This Matters
PHP 8 enforces strict return types.
XenForo controllers are designed to return multiple reply types.
Using AbstractReply is the correct and supported approach.
Bonus Note
If this error appears when visiting a URL such as:
That request does not supply a user_id, so the controller correctly
returns notFound(). The fatal error only occurs because of the
incorrect return type declaration.
After applying this fix, the request safely returns a 404 instead of
crashing PHP.
Status
Tested and confirmed working on:
• XenForo 2.2 / 2.3
• PHP 8.0 – 8.3
Regards,
CR0W
XenForo Version: XF 2.2+ / 2.3
PHP Version: PHP 8.0+
Code:
TypeError:
Mitch\MemberReviews\Pub\Controller\MemberReviews::actionIndex():
Return value must be of type XF\Mvc\Reply\View,
XF\Mvc\Reply\Error returned
This error occurs when accessing the Member Reviews page without a valid
user_id, or when the controller returns $this->notFound() /
$this->error().
The controller method actionIndex() is strictly typed to return:
PHP:
XF\Mvc\Reply\View
However, XenForo controller helpers such as:
• $this->notFound()
• $this->error()
• $this->noPermission()
return XF\Mvc\Reply\Error.
Under PHP 8+, this mismatch triggers a fatal TypeError.
XenForo controller actions must return
XF\Mvc\Reply\AbstractReply, which is the base class for all reply types
(View, Error, Redirect, etc.).
File:
Code:
src/addons/Mitch/MemberReviews/Pub/Controller/MemberReviews.php
PHP:
use XF\Mvc\Reply\View;
REPLACE WITH
PHP:
use XF\Mvc\Reply\AbstractReply;
PHP:
public function actionIndex(): View
REPLACE WITH
PHP:
public function actionIndex(): AbstractReply
• $this->view() → works
• $this->notFound() → works
• $this->error() → works
• No PHP 8+ fatal errors
• Fully XenForo-compliant controller behavior
PHP 8 enforces strict return types.
XenForo controllers are designed to return multiple reply types.
Using AbstractReply is the correct and supported approach.
If this error appears when visiting a URL such as:
Code:
/member-reviews/index.php?reputation
That request does not supply a user_id, so the controller correctly
returns notFound(). The fatal error only occurs because of the
incorrect return type declaration.
After applying this fix, the request safely returns a 404 instead of
crashing PHP.
Tested and confirmed working on:
• XenForo 2.2 / 2.3
• PHP 8.0 – 8.3
Regards,
CR0W