protected function composeFields($id, $data)
    {
        $fields = [
            'data' => $data,
        ];
        if ($this->writeCallback !== null) {
            $fields = array_merge(
                $fields,
                call_user_func($this->writeCallback, $this)
            );
            if (!is_string($fields['data'])) {
                $_SESSION = $fields['data'];
                $fields['data'] = session_encode();
            }
        }
        // ensure 'id' and 'expire' are never affected by [[writeCallback]]
        $fields = array_merge($fields, [
            'id' => $id,
            'expire' => time() + $this->getTimeout(),
        ]);
        return $fields;
    }