adam42 could you share your
php flarum info output?
The problem seems to be with FoF Subscribed extension and the "new user" notification.
I see what part of the code needs a change, but I'm not sure why the error happens here and not to every user. Maybe it's specific to your PHP version, maybe you have some special PHP module like xdebug enabled, or it's a conflict with another extension.
I have created an issue to track this here FriendsOfFlarum/subscribed#25