Regression: Smart group rebuild in default config crashes cron
When you run cron (job.execute
), it crashes because of a recent refactoring that enforces type checking.
Steps to Replicate (can use dmaster.demo.c.o)
- Go to Administer » System Settings » Scheduled Jobs.
- Next to Rebuild Smart Group Cache, click Execute Now.
Expected Result
Job completes successfully.
Actual Result
TypeError: Argument 2 passed to CRM_Contact_BAO_GroupContactCache::getGroupsNeedingRefreshing() must be of the type int, string given, called in /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php on line 132 in CRM_Contact_BAO_GroupContactCache::getGroupsNeedingRefreshing() (line 715 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php).
In Scheduled Jobs, the default parameters for this job read:
limit=Number optional-Limit the number of smart groups rebuild
So limit
is a string, but the new type checking enforces it being an integer.
This new function is only called in two places, and only one specifies a value, so I'm casting to int
there.