Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Don't try to use shared session for locahost

givanz238905a6ddc5
diff --git a/system/session.php b/system/session.php
index 6c8d8ac..b684d4d 100755
--- a/system/session.php
+++ b/system/session.php
@@ -30,7 +30,10 @@ class Session {
if ($inst === null) {
$driver = \Vvveb\config(APP . '.session.driver', 'php');
- $inst = new Session($driver);
+
+ if ($driver) {
+ $inst = new Session($driver);
+ }
}
return $inst;
@@ -50,22 +53,22 @@ class Session {
}
public function get($key) {
- return $this->driver->get($key);
+ return $this->driver ? $this->driver->get($key) : null;
}
public function set($key, $value) {
- return $this->driver->set($key, $value);
+ return $this->driver ? $this->driver->set($key, $value) : null;
}
public function delete($key) {
- return $this->driver->delete($key);
+ return $this->driver ? $this->driver->delete($key) : null;
}
public function close() {
- return $this->driver->close();
+ return $this->driver ? $this->driver->close() : null;
}
public function sessionId($id = null) {
- return $this->driver->sessionId($id);
+ return $this->driver ? $this->driver->sessionId($id) : null;
}
}
diff --git a/system/session/php.php b/system/session/php.php
index 92b4947..9748e08 100755
--- a/system/session/php.php
+++ b/system/session/php.php
@@ -57,7 +57,7 @@ class Php {
$domain = preg_replace('/^[^\.]*\./', '', $host);
$name = str_replace('.', '', $domain);
// skip if ip number
- if (! is_numeric($name)) {
+ if ((! is_numeric($name)) && ($name != 'localhost')) {
@ini_set('session.cookie_domain', ".$domain");
session_set_cookie_params(0, '/', ".$domain");
$sessionName = session_name($name);