Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Serialization Will not work correctly
    primarykey
    data
    text
    <p>I am developing and doing all the testing on a local machine using PHP Version 5.3.3-1ubuntu9.1 version. The host machine is PHP Version 5.2.15.</p> <p>All the seriliaze arguments are identical.</p> <p>The problems is when i try to login the user on my test local machine I do the following:</p> <pre><code>$user-&gt;getByUserId($results['id'], $db); $_SESSION['user'] = serialize($user); </code></pre> <p>which retrieved and serialize the user and I just load it back whenever I detect that a session exists:</p> <pre><code>$user-&gt;LoadFromObject(unserialize($_SESSION['user'])); </code></pre> <p>This works perfectly on my test machine. Just transfered the files on the host to see if I can get a beta version out but I keep on getting :</p> <blockquote> <p>Warning: unserialize() expects parameter 1 to be string, object given in /home/gamerent/public_html/beta/includes/header.php on line 19</p> </blockquote> <p>i have noticed that if i echo the <code>$_SESSION['user']</code> in both system the test will indeed display me the serialized one but the main one will just show me the object and will not serialize the <code>$user</code>.</p> <p>UPDATE : </p> <p>OK after some testing ..... i have seen that if i dump the session before initializing the user as</p> <pre><code>var_dump($_SESSION['user']); $user = new User(); var_dump($_SESSION['user']); </code></pre> <p>it will display the session serialized correctly. Exactly after that it will display the String of the sessions</p> <p>My User doesnt do anything excpet init with default values</p> <pre><code>function User() { $this-&gt;userId = 0; $this-&gt;firstname = "Guest"; $this-&gt;password = ""; include_once('includes/generalUtils.php'); $this-&gt;generalUtils = new generalUtils(); include_once('includes/utils.php'); $this-&gt;utils = new utils(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload