CodeIgniter Forums
session error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: session error (/showthread.php?tid=86984)



session error - zahid waseem - 03-02-2023

Please help how to solve

An uncaught Exception was encountered
Type: TypeError
Message: array_key_exists(): Argument #2 ($array) must be of type array, stdClass given


RE: session error - digitalarts - 03-07-2023

(03-02-2023, 10:15 PM)zahid waseem Wrote: Please help how to solve

An uncaught Exception was encountered
Type: TypeError
Message: array_key_exists(): Argument #2 ($array) must be of type array, stdClass given

It looks like you're trying to test for the existence of an array key on an object. You'll want to use property_exists( $object, 'property' ), or isset($object->property). Note that property_exists() will return true even if the value of the property is null, while isset() will return false if the value is null. Note also that the order of arguments for property_exists() is reversed from array_key_exists() [gets me every other time].