I’m running a switch statement to detect which page to throw a user on based on a $_SESSION var, but I keep getting this intermittent error. The strange thing about it is that it will work sometimes (generally on first go), then it throws this error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« `` is not numeric and may not be passed to makeUrl() »
Parser timing
MySQL: 0.0066 s (2 Requests)
PHP: 0.0606 s
Total: 0.0673 s
I notice that mysql is making 2 Requests... not sure why (I guess it has to do with the Event architecture, which I don’t really understand).
If I clear the cache it works the first time, then not..
Here is my code btw:
if (isset($_SESSION[accessType])) {
switch($_SESSION[accessType]) {
case 'Di':
$login_page=21;
break;
case 'Ca':
$login_page=20;
break;
case 'Do':
$login_page=22;
break;
case 'Pa':
$login_page=8;
break;
}
$url = $modx->makeUrl( (int)$login_page );
header('Location: '.$url);
}
I’ve even tried casting the $login_page variable as an integer with no luck.
Hope somebody can shed some light on this
Thanks,