|
|
@ -112,43 +112,36 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private $_opened = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Starts the session. |
|
|
|
* Starts the session. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function open() |
|
|
|
public function open() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (session_status() == PHP_SESSION_ACTIVE) { |
|
|
|
if (session_status() == PHP_SESSION_ACTIVE) { |
|
|
|
$this->_opened = true; |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!$this->_opened) { |
|
|
|
if ($this->getUseCustomStorage()) { |
|
|
|
if ($this->getUseCustomStorage()) { |
|
|
|
@session_set_save_handler( |
|
|
|
@session_set_save_handler( |
|
|
|
[$this, 'openSession'], |
|
|
|
[$this, 'openSession'], |
|
|
|
[$this, 'closeSession'], |
|
|
|
[$this, 'closeSession'], |
|
|
|
[$this, 'readSession'], |
|
|
|
[$this, 'readSession'], |
|
|
|
[$this, 'writeSession'], |
|
|
|
[$this, 'writeSession'], |
|
|
|
[$this, 'destroySession'], |
|
|
|
[$this, 'destroySession'], |
|
|
|
[$this, 'gcSession'] |
|
|
|
[$this, 'gcSession'] |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->setCookieParamsInternal(); |
|
|
|
$this->setCookieParamsInternal(); |
|
|
|
|
|
|
|
|
|
|
|
@session_start(); |
|
|
|
@session_start(); |
|
|
|
|
|
|
|
|
|
|
|
if (session_id() == '') { |
|
|
|
if (session_id() == '') { |
|
|
|
$this->_opened = false; |
|
|
|
$error = error_get_last(); |
|
|
|
$error = error_get_last(); |
|
|
|
$message = isset($error['message']) ? $error['message'] : 'Failed to start session.'; |
|
|
|
$message = isset($error['message']) ? $error['message'] : 'Failed to start session.'; |
|
|
|
Yii::error($message, __METHOD__); |
|
|
|
Yii::error($message, __METHOD__); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$this->updateFlashCounters(); |
|
|
|
$this->_opened = true; |
|
|
|
|
|
|
|
$this->updateFlashCounters(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -157,7 +150,6 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function close() |
|
|
|
public function close() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->_opened = false; |
|
|
|
|
|
|
|
if (session_id() !== '') { |
|
|
|
if (session_id() !== '') { |
|
|
|
@session_write_close(); |
|
|
|
@session_write_close(); |
|
|
|
} |
|
|
|
} |
|
|
|