Fixed ErrorException: [E_WARNING] mt_rand(): max(20) is smaller than min(30)

Affected version


Hello, i have this error on xenforo 2.1

[*]ErrorException: [E_WARNING] mt_rand(): max(20) is smaller than min(30)
[*]Generiert durch: 
[*]5. Februar 2019 um 09:52 Uhr
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] mt_...', '/www/htdocs/w01...', 411, Array)
#1 src/XF/Pub/Controller/AbstractController.php(411): mt_rand('30', '20')
#2 src/XF/Pub/Controller/AbstractController.php(27): XF\Pub\Controller\AbstractController->discourage('KeepAlive')
#3 src/XF/Mvc/Controller.php(123): XF\Pub\Controller\AbstractController->preDispatchType('KeepAlive', Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(320): XF\Mvc\Controller->preDispatch('KeepAlive', Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(244): XF\Mvc\Dispatcher->dispatchClass('XF:Login', 'KeepAlive', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Login), NULL)
#6 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Login), NULL)
#7 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#9 src/XF.php(390): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}
Benötigter Status
array(4) {
  ["url"] => string(17) "/login/keep-alive"
  ["referrer"] => string(30) ""
  ["_GET"] => array(0) {
  ["_POST"] => array(2) {
    ["_xfResponseType"] => string(4) "json"
    ["_xfToken"] => string(8) "********"

Chris D

XenForo developer
Staff member
That suggests you have a larger number in the min field than you do in the max field of the discouragement loading delay options:


We'll try and coerce some valid values for a future release though.

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
For min-max options, add validation to ensure that the max is never less than the min.
Any changes made as a result of this issue being resolved may not be rolled out here until later.