function返回数组返回null

i got a php function in Wordpress that get serialized user meta : like this

    function get_allowwed_tournees_ids(){
    $tournees = get_user_meta($this->ID, 'tournees',true);
    $tournees = unserialize($tournees);

    $tournees_ids = array();

    foreach ($tournees as $key => $value) {
        array_push($tournees_ids, $key);
    }

    var_dump($tournees_ids);
    return $tournee_ids;
}

get_allowwed_tournees_ids() is in a class that extends WP_User and when i want to call it :

$id_tournees = $current_user->get_allowwed_tournees_ids();
var_dump($id_tournees);

the var_dump inside the function returns me the unserialised array, and the second var_dump outside the function returns null.

Any idea ?? Thanks !

Because you are returning $tournee_ids which is never defined. I think you should

return $tournees_ids;