示例#1
0
 /**
  * Create a new session and copy variables from the old one
  *
  * @return  boolean $result true on success
  *
  * @since   11.1
  */
 public function fork()
 {
     if ($this->_state !== 'active') {
         // @TODO :: generated error here
         return false;
     }
     // Save values
     $values = $_SESSION;
     // Keep session config
     $trans = ini_get('session.use_trans_sid');
     if ($trans) {
         ini_set('session.use_trans_sid', 0);
     }
     $cookie = session_get_cookie_params();
     // Create new session id
     $id = $this->_createId();
     // Kill session
     session_destroy();
     // Re-register the session store after a session has been destroyed, to avoid PHP bug
     $this->_store->register();
     // Restore config
     ini_set('session.use_trans_sid', $trans);
     session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure']);
     // Restart session with new id
     session_id($id);
     session_start();
     return true;
 }
示例#2
0
 /**
  * Create a new session and copy variables from the old one
  *
  * @return  boolean $result true on success
  *
  * @since   11.1
  */
 public function fork()
 {
     if ($this->_state !== 'active') {
         return false;
     }
     // Keep the old values
     $values = $_SESSION;
     $trans = ini_get('session.use_trans_sid');
     if ($trans) {
         ini_set('session.use_trans_sid', 0);
     }
     $cookie = session_get_cookie_params();
     // Generate a new ID
     session_regenerate_id(true);
     $id = session_id();
     $data = $this->_store->read($this->getId());
     // Kill the session
     session_destroy();
     // Re-register the session store after a session has been destroyed, to avoid PHP bug
     $this->_store->register();
     // Restore config
     ini_set('session.use_trans_sid', $trans);
     session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure']);
     // Restart session with new id
     session_id($id);
     session_start();
     $_SESSION = $values;
     // Now put the session data back
     $this->_store->write($id, $data);
 }
示例#3
0
	/**
	 * Create a new session and copy variables from the old one
	 *
	 * @return  boolean $result true on success
	 *
	 * @since   11.1
	 */
	public function fork()
	{
		if ($this->_state !== 'active')
		{
			// @TODO :: generated error here
			return false;
		}

		// Save values
		$values = $_SESSION;

		// Keep session config
		$cookie = session_get_cookie_params();

		// Kill session
		session_destroy();

		// Re-register the session store after a session has been destroyed, to avoid PHP bug
		$this->_store->register();

		// Restore config
		session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], true);

		// Restart session with new id
		session_regenerate_id(true);
		session_start();

		return true;
	}
 /**
  * Create a new session and copy variables from the old one
  *
  * @return  boolean $result true on success
  *
  * @since   11.1
  */
 public function fork()
 {
     if ($this->_state !== 'active') {
         // @TODO :: generated error here
         return false;
     }
     // Keep session config
     $cookie = session_get_cookie_params();
     // Re-register the session store after a session has been destroyed, to avoid PHP bug
     $this->_store->register();
     // Restore config
     session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], true);
     // Restart session with new id
     $this->_handler->regenerate(true, null);
     $this->_handler->start();
     return true;
 }