File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,10 @@ public static function getInstance() {
30
30
31
31
if ($ inst === null ) {
32
32
$ driver = \Vvveb \config (APP . '.session.driver ' , 'php ' );
33
- $ inst = new Session ($ driver );
33
+
34
+ if ($ driver ) {
35
+ $ inst = new Session ($ driver );
36
+ }
34
37
}
35
38
36
39
return $ inst ;
@@ -50,22 +53,22 @@ public function __construct($driver, $expire = 3600) {
50
53
}
51
54
52
55
public function get ($ key ) {
53
- return $ this ->driver -> get ($ key );
56
+ return $ this ->driver ? $ this -> driver -> get ($ key ) : null ;
54
57
}
55
58
56
59
public function set ($ key , $ value ) {
57
- return $ this ->driver -> set ($ key , $ value );
60
+ return $ this ->driver ? $ this -> driver -> set ($ key , $ value ) : null ;
58
61
}
59
62
60
63
public function delete ($ key ) {
61
- return $ this ->driver -> delete ($ key );
64
+ return $ this ->driver ? $ this -> driver -> delete ($ key ) : null ;
62
65
}
63
66
64
67
public function close () {
65
- return $ this ->driver -> close ();
68
+ return $ this ->driver ? $ this -> driver -> close () : null ;
66
69
}
67
70
68
71
public function sessionId ($ id = null ) {
69
- return $ this ->driver -> sessionId ($ id );
72
+ return $ this ->driver ? $ this -> driver -> sessionId ($ id ) : null ;
70
73
}
71
74
}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public function __construct($options) {
57
57
$ domain = preg_replace ('/^[^\.]*\./ ' , '' , $ host );
58
58
$ name = str_replace ('. ' , '' , $ domain );
59
59
// skip if ip number
60
- if (! is_numeric ($ name )) {
60
+ if (( ! is_numeric ($ name)) && ( $ name != ' localhost ' )) {
61
61
@ini_set ('session.cookie_domain ' , ". $ domain " );
62
62
session_set_cookie_params (0 , '/ ' , ". $ domain " );
63
63
$ sessionName = session_name ($ name );
You can’t perform that action at this time.
0 commit comments