Fixed setupLogEntityActor can throw if moderator actions are triggered from CLI

Xon

Well-known member
Licensed customer
Affected version
2.3.10
PHP:
protected function setupLogEntityActor(ModeratorLog $log, User $actor)
{
    $log->user_id = $actor->user_id ?? 0;

    if ($actor->user_id == \XF::visitor()->user_id)
    {
        $log->ip_address = Ip::stringToBinary(\XF::app()->request()->getIp());
    }
}

By default stringToBinary will throw if passed an invalid IP, but ModeratorLog will accept an empty ip address for example if this code gets invoked from the CLI where no IP address for the request exists.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.11).

Change log:
Skip moderator log IP capture when no request IP is available, so CLI-triggered moderator actions no longer crash with Invalid string IP.
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom