public function open($data = null)
    {
        if (!session_start()) {
            throw new \RuntimeException('Could not open session.');
        }
        session_regenerate_id(true);
        $this->isOpen = true;

        if ($data === null) {
            if ($this->data === null) {
                $data =& $_SESSION;
            } else {
                //don't touch the data, only decrement the flash counters
                $this->flashStorage->decrement();
                return;
            }
        }

        foreach (['data', 'flash'] as $key) {
            if (!isset($data[ $key ])) {
                $data[ $key ] = [];
            }
        }

        $this->data         =& $data['data'];
        $this->flashStorage = new FlashVariableStorage($data['flash']);
        $this->flashStorage->decrement();
    }
public function open($data = null)
    {
        if (!session_start()) {
            throw new \RuntimeException('Could not open session.');
        }
        session_regenerate_id(true);
        $this->isOpen = true;

        if ($data === null) {
            if ($this->data === null) {
                $data =& $_SESSION;
            } else {
                //don't touch the data, only decrement the flash counters
                $this->flashStorage->decrement();
                return;
            }
        }

        foreach (['data', 'flash'] as $key) {
            if (!isset($data[ $key ])) {
                $data[ $key ] = [];
            }
        }

        $this->data         =& $data['data'];
        $this->flashStorage = new FlashVariableStorage($data['flash']);
        $this->flashStorage->decrement();
    }
public function open ( $ data = null ) { if ( ! session_start ( ) ) { throw new \ RuntimeException ( 'Could not open session.' ) ; } session_regenerate_id ( true ) ; $ this -> isOpen = true ; if ( $ data === null ) { if ( $ this -> data === null ) { $ data = & $ _SESSION ; } else { //don't touch the data, only decrement the flash counters $ this -> flashStorage -> decrement ( ) ; return ; } } foreach ( [ 'data' , 'flash' ] as $ key ) { if ( ! isset ( $ data [ $ key ] ) ) { $ data [ $ key ] = [ ] ; } } $ this -> data = & $ data [ 'data' ] ; $ this -> flashStorage = new FlashVariableStorage ( $ data [ 'flash' ] ) ; $ this -> flashStorage -> decrement ( ) ; }
Starts the session. Regenerates the session ID each request
for security reasons and updates flash variables.

@param mixed $data The data to use as session data. Pass null to use the previous data, if any.

@throws \RuntimeException When the session can not be opened.
Starts the session . Regenerates the session ID each request for security reasons and updates flash variables .