The session_encode and session_decode functions are incomplete.
Because there is no option to collect the output values for session_decode or input an array in session_encode.
I faced this issue while trying to implement custom session using session_set_save_handler.
It led me to limit the functionality to particular serialize_handler and had to hardcode the encode and decode functions like serialize and unserialize for option ['serialize_handler' => 'php_serialize'] instead of session_encode and session_decode once i am done with defining the encoding algo.