object in session: Fatal error: Exception thrown without a stack frame in Unknown on line 0
session_start();
$_SESSION['dbo'] = NEW PDO('sqlite:database.db3');
gives:
Fatal error: Exception thrown without a stack frame in Unknown on line 0
but putting it to ordinary variable gives no error. All I try to do is to put object into session 开发者_开发问答so it is initialized once.
Some objects cannot be serialized and stored in $_SESSION
.
If your intent was to store a database connection in session for reuse, don't follow that undertaking: it doesn't work.
From PHP reference on serialize:
[...] serialize() handles all types, except the resource-type. You can even serialize() arrays that contain references to itself. Circular references inside the array/object you are serializing will also be stored. Any other reference will be lost.
精彩评论