File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ protected function configure()
305305 );
306306
307307 //if (empty($this->sessionExpiration))
308- if (!isset ($ this ->sessionExpiration ))
308+ if (! isset ($ this ->sessionExpiration ))
309309 {
310310 $ this ->sessionExpiration = (int ) ini_get ('session.gc_maxlifetime ' );
311311 }
@@ -496,7 +496,7 @@ public function set($data, $value = null)
496496 */
497497 public function get (string $ key = null )
498498 {
499- if (! empty ($ key ) && $ value = dot_array_search ($ key , $ _SESSION ))
499+ if (! empty ($ key ) && ! is_null ( $ value = dot_array_search ($ key , $ _SESSION ) ))
500500 {
501501 return $ value ;
502502 }
@@ -634,7 +634,7 @@ public function __get(string $key)
634634 *
635635 * @param string $key Identifier of the session property to remove.
636636 *
637- * @return bool
637+ * @return boolean
638638 */
639639 public function __isset (string $ key ): bool
640640 {
Original file line number Diff line number Diff line change @@ -129,6 +129,18 @@ public function testGetReturnsNullWhenNotFound()
129129 $ this ->assertNull ($ session ->get ('foo ' ));
130130 }
131131
132+ public function testGetReturnsItemValueisZero ()
133+ {
134+ $ _SESSION = [];
135+
136+ $ session = $ this ->getInstance ();
137+ $ session ->start ();
138+
139+ $ session ->set ('foo ' , (int ) 0 );
140+
141+ $ this ->assertSame ((int ) 0 , $ session ->get ('foo ' ));
142+ }
143+
132144 public function testGetReturnsAllWithNoKeys ()
133145 {
134146 $ _SESSION = [
You can’t perform that action at this time.
0 commit comments