没有设置会话ID,但会话有数据

I am working on a website and we have an id which we get from the GET or SESSION. Issue is the id is not being set, we know the GET has no info and the SESSION does but the id is still never set.

We tried isset and empty for the get

$id;
if(isset($_GET['user_id']))
    $id = intval($_GET['user_id']);
 else $id = intval($_SESSION['user_id']);
 if(!validUser($id)){ 
     if(isset($_SESSION['user_id'])) { 
        header('Location: user.php'); 
     } else { 
        header('Location: login.php'); 

    } 
}

The GET var dump: array(0) { }
The SESSION var dump: array(2) { 'token' => string(64) "PFM00Y1V17FBNFF864R68W0OE5H59CGYR3ZS11O383FVJU4PZWV7SWV62DBBPRAH" 'user_id' => string(1) "2" }

the user_id is there but does not get set.

Thank you in advance.