tpipjo
July 23, 2019, 8:40pm
1
I’ve got an issue that I would really like to fix it instead of having to reinstall again as i have now set up quite a bit.
The problem is that whenever I try to access the CMS I get “Unexpected Error, please contact support.” This is before logon and means I have no way to get to the logs through the CMS.
Is there anything I can do to bring back more detailed messages or view the logs outside of the CMS?
Thanks
Trev
tpipjo
July 24, 2019, 12:02pm
2
@Dan replied to a previous occurrence of this issue for a different user back in May. His advice at the time was:
I am running 2.0.3 with MySQL 5.7.26
My other versions are:
PHP 7.2.18
Apache 2.4.39
I hope that this helps.
Trev
Try looking in the log table in the cms database to see if its logging anything.
tpipjo
July 25, 2019, 4:19pm
4
I’ve had a look in the Log table and recorded what happens during a refresh. These results are in the linked csv data.
I looks like a data issue as the error that keeps coming up is:
rand() expects parameter 2 to be integer, float given#0 [internal function]: Slim\Slim::handleErrors(2, 'rand() expects ...', 'C:\\wamp\\xibo-cm...', 76, Array)
#1 C:\wamp\xibo-cms-2.0.3\lib\Middleware\CsrfGuard.php(76): rand(0, 4294967295)
#2 [internal function]: Xibo\Middleware\CsrfGuard->check()
#3 C:\wamp\xibo-cms-2.0.3\vendor\slim\slim\Slim\Slim.php(1208): call_user_func_array(Array, Array)
#4 C:\wamp\xibo-cms-2.0.3\vendor\slim\slim\Slim\Slim.php(1354): Slim\Slim->applyHook('slim.before.dis...')
#5 C:\wamp\xibo-cms-2.0.3\vendor\slim\slim\Slim\Middleware\Flash.php(85): Slim\Slim->call()
#6 C:\wamp\xibo-cms-2.0.3\vendor\slim\slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash->call()
#7 C:\wamp\xibo-cms-2.0.3\lib\Middleware\Actions.php(150): Slim\Middleware\MethodOverride->call()
#8 C:\wamp\xibo-cms-2.0.3\lib\Middleware\Theme.php(36): Xibo\Middleware\Actions->call()
#9 C:\wamp\xibo-cms-2.0.3\lib\Middleware\WebAuthentication.php(131): Xibo\Middleware\Theme->call()
#10 C:\wamp\xibo-cms-2.0.3\lib\Middleware\CsrfGuard.php(63): Xibo\Middleware\WebAuthentication->call()
#11 C:\wamp\xibo-cms-2.0.3\lib\Middleware\State.php(119): Xibo\Middleware\CsrfGuard->call()
#12 C:\wamp\xibo-cms-2.0.3\lib\Middleware\Storage.php(47): Xibo\Middleware\State->call()
#13 C:\wamp\xibo-cms-2.0.3\lib\Middleware\Xmr.php(37): Xibo\Middleware\Storage->call()
#14 C:\wamp\xibo-cms-2.0.3\vendor\slim\slim\Slim\Slim.php(1300): Xibo\Middleware\Xmr->call()
#15 C:\wamp\xibo-cms-2.0.3\web\index.php(127): Slim\Slim->run()
#16 {main}
Export of the log file in csv format is here
If any one has any ideas I would really appreciate the help.
Trev
Peter
July 26, 2019, 8:56am
5
This is the line that is throwing the error:
/**
* Check CSRF token is valid.
* @throws TokenExpiredException
*/
public function check()
{
$session = $this->app->session;
/* @var \Xibo\Helper\Session $session */
if (!$session->get($this->key)) {
$session->set($this->key, sha1(serialize($_SERVER) . rand(0, 0xffffffff)));
}
$token = $session->get($this->key);
// Validate the CSRF token.
if (in_array($this->app->request()->getMethod(), array('POST', 'PUT', 'DELETE'))) {
// Validate the token unless we are on an excluded route
$route = $this->app->router()->getCurrentRoute()->getPattern();
$excludedRoutes = $this->app->excludedCsrfRoutes;
Could you try chainging this line to:
$session->set($this->key, bin2hex(random_bytes(20)));
Let us know if that solves the problem for you.
I will also log this issue in GitHub.
1 Like
tpipjo
July 26, 2019, 9:08am
6
Thanks for your help Peter, that has worked perfectly.
1 Like