Commit 5fbcc180 authored by Alex Ne's avatar Alex Ne

поправка обработки сессии

parent 7be04c17
...@@ -63,11 +63,13 @@ class Session extends \X\Security\Crypto\IDEA { ...@@ -63,11 +63,13 @@ class Session extends \X\Security\Crypto\IDEA {
$this->session = $In->CookieValue($this->session_name, false) ?: $In->Request($this->session_name, "")->string(); $this->session = $In->CookieValue($this->session_name, false) ?: $In->Request($this->session_name, "")->string();
if (strlen($this->session) > 0) { if (strlen($this->session) > 0) {
if (is_array($session_data = $this->explode(gzuncompress($this->decrypt_b64($this->session))))) { if (is_array($session_data = $this->explode(gzuncompress($this->decrypt_b64($this->session))))) {
if (isset($session_data["cs"]) && $session_data["cs"] == $this->crypto_checksum($session_data)) { if (isset($session_data["cs"])) {
$this->session_data = $session_data; if ($session_data["cs"] == $this->crypto_checksum($session_data)) {
return true; $this->session_data = $session_data;
} else { return true;
throw new SessionChecksumError("Checksum Error", [get_defined_vars(), $this]); } else {
throw new SessionChecksumError("Checksum Error", [get_defined_vars(), $this]);
}
} }
} }
} }
......
...@@ -4,8 +4,7 @@ namespace X\ETrace; ...@@ -4,8 +4,7 @@ namespace X\ETrace;
/** /**
* *
*/ */
class EItem extends \Exception class EItem extends \Exception {
{
/** /**
* @var int * @var int
*/ */
...@@ -31,16 +30,13 @@ class EItem extends \Exception ...@@ -31,16 +30,13 @@ class EItem extends \Exception
/** /**
* @return mixed * @return mixed
*/ */
public function __construct($type, $message, $code = 0, $file = false, $line = false, $context = []) public function __construct($type, $message, $code = 0, $file = false, $line = false, $context = []) {
{
parent::__construct($message, $code); parent::__construct($message, $code);
if ( ! ($file === false)) if ( ! ($file === false)) {
{
$this->file = $file; $this->file = $file;
} }
if ( ! ($line === false)) if ( ! ($line === false)) {
{
$this->line = $line; $this->line = $line;
} }
...@@ -48,29 +44,35 @@ class EItem extends \Exception ...@@ -48,29 +44,35 @@ class EItem extends \Exception
$this->hash = $this->calcHash(); $this->hash = $this->calcHash();
} }
public function __debugInfo() /**
{ * @return mixed
*/
public function __debugInfo() {
return $this->Model(); return $this->Model();
} }
/** /**
* @return mixed * @return mixed
*/ */
public function Trace() public function Trace() {
{
return $this->getTrace(); return $this->getTrace();
} }
/** /**
* @return mixed * @return mixed
*/ */
public function Serialize() public function getContext() {
{ return $this->context;
}
/**
* @return mixed
*/
public function Serialize() {
return serialize($this->Model()); return serialize($this->Model());
} }
public function Model() public function Model() {
{
return return
[ [
"hash" => $this->hash, "hash" => $this->hash,
...@@ -85,21 +87,18 @@ class EItem extends \Exception ...@@ -85,21 +87,18 @@ class EItem extends \Exception
]; ];
} }
public function increment() public function increment() {
{
$this->count++; $this->count++;
} }
/** /**
* @return hex * @return hex
*/ */
public function getHash() public function getHash() {
{
return $this->hash; return $this->hash;
} }
private function calcHash() private function calcHash() {
{
return md5(serialize([$this->message, $this->code, $this->file, $this->line, $this->Trace()])); return md5(serialize([$this->message, $this->code, $this->file, $this->line, $this->Trace()]));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment