Function not working in contextual filter I have a function in my custom module that return the nids for drafts in array.

function get_all_drafts(){
    $query = db_query("select bid from kom_draft");
    $res = $query-&gt;fetchAll();
    foreach($res as $bid){
        $output[] = $bid-&gt;bid;
    }
    return $output;
}


and following code is used in contextual filter nid ( php code text area )

$nids = get_all_drafts();
return implode('+',$nids);


and checked the multiple value checkbox but its not working, i checked the query and there in not value to compare.

when i use the same code on tpl file i am getting proper output that is + separated nids.
I just get it done by enabling validation criteria, I selected content validation with node content type and its working fine.