djgxp
Member
- Affected version
- 2.1.1
By default, last_days is defined in Xenforo and if you are not adding any filter parameter to /api/threads/ you are getting something like last_post_date > 11111111 (where 11111111 here is the timestamp of the current date minus 1 month).
if I set /api/threads/?last_days=0 in order to get all topics from any date, I have a bug because the last_days is not in filters and there is a type conversion that have failed.
So here is the fix on line 37 of src/XF/Api/ControllerPlugin/Threads.php (currently we have $lastDays['last_days']):
if I set /api/threads/?last_days=0 in order to get all topics from any date, I have a bug because the last_days is not in filters and there is a type conversion that have failed.
So here is the fix on line 37 of src/XF/Api/ControllerPlugin/Threads.php (currently we have $lastDays['last_days']):
PHP:
$lastDays = $this->filter('last_days', '?uint');
if (is_int($lastDays))
{
if ($lastDays)
{
$threadFinder->where('last_post_date', '>=', \XF::$time - ($lastDays * 86400));
}
// 0 means no limit here -- bypass the forum default limit if there is one
$filters['last_days'] = $lastDays;
}