Skip to content

Commit 8758dbe

Browse files
authored
when $_SESSION is null
newest version. CRITICAL - 2019-12-10 19:17:06 --> Argument 2 passed to dot_array_search() must be of the type array, null given, called in /home/zdamy/site/system/Session/Session.php on line 500 #0 /home/zdamy/site/system/Session/Session.php(500): dot_array_search('ausItem', NULL) #1 /home/zdamy/site/system/Common.php(347): CodeIgniter\Session\Session->get('ausItem') #2 /home/zdamy/site/app/Models/AdminUserModel.php(87): session('ausItem') BTW/ I am not sure if that method should not look like: ``` public function get(string $key = null) { if (! empty($key)) { if(! is_null($value = dot_array_search($key, $_SESSION??[]))) { return $value; } return null; } elseif (empty($_SESSION)) { return []; } $userdata = []; $_exclude = array_merge( ['__ci_vars'], $this->getFlashKeys(), $this->getTempKeys() ); $keys = array_keys($_SESSION); foreach ($keys as $key) { if (! in_array($key, $_exclude, true)) { $userdata[$key] = $_SESSION[$key]; } } return $userdata; } ```
1 parent dbf36b8 commit 8758dbe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

system/Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ public function set($data, $value = null)
497497
*/
498498
public function get(string $key = null)
499499
{
500-
if (! empty($key) && ! is_null($value = dot_array_search($key, $_SESSION)))
500+
if (! empty($key) && ! is_null($value = dot_array_search($key, $_SESSION??[])))
501501
{
502502
return $value;
503503
}

0 commit comments

Comments
 (0)