Community Store exception when adding new user to store group

Has anyone got the following error after placing a successful order:

Failed to start the session because headers have already been sent by “…/public_html/concrete/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php” at line 82

I’ve pinned the place after which it occurs. It’s in completePostPaymentProcesses() of Order.php at line 981 of v2.4.3. If I replace (simply for the sake of testing)

$user->getUserObject()->enterGroup($group);

for

$user->enterGroup($group);

the exception disappears. It doesn’t solve the problem that the new user doesn’t get added to the group in any case.