The only returned value from the query in process_enrolments is the DISTINCT u.id from the user table. In some cases the RIGHT JOIN causes it to return NULL as one of the values. This crashes the cron when enrol_user is called with NULL for the user->id.
Changing RIGHT JOIN to just JOIN fixed the issue on a client's site that encountered this problem.
The only returned value from the query in process_enrolments is the DISTINCT u.id from the user table. In some cases the RIGHT JOIN causes it to return NULL as one of the values. This crashes the cron when enrol_user is called with NULL for the user->id.
Changing RIGHT JOIN to just JOIN fixed the issue on a client's site that encountered this problem.