note 108060 modified in function.unserialize by danbrown

From: Date: Tue, 27 Mar 2012 16:08:47 +0000
Subject: note 108060 modified in function.unserialize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186870@lists.php.net to get a copy of this message
I used Google-Oauth for authentication, got a "Person-Object" back and saved this in the database (serialized). After unserializing, i got the PHP_INCOMPLETE-Class, because the Person-Class was not included. To avoid this i converted the original-class to a PHP stdClass via Json: <?php // Before: $me_data == Person() $me_data = json_encode($me_data); $me_data = json_decode($me_data); // After: $me_data == stdClass() ?> --was-- I used Google-Oauth for authentication, got a "Person-Object" back and saved this in the database (serialized). After unserializing, i got the PHP_INCOMPLETE-Class, because the Person-Class was not included. To avoid this i converted the original-class to a PHP stdClass via Json: <?php // Before: $me_data == Person() $me_data = json_encode($me_data); $me_data = json_decode($me_data); // After: $me_data == stdClass() ?> http://php.net/manual/en/function.unserialize.php

« previous php.notes (#186870) next »