}
Using PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...
-myclass::__set(myobj, 'C:7:"myclass":19:{Data from serialize}')
+myclass::unserialize('C:7:"myclass":19:{Data from serialize}')
myclass::__construct(PDO shall not call __construct())
-object(myclass)#%d (2) {
+object(myclass)#%d (1) {
[u"myprotected":protected]=>
unicode(19) "a protected propery"
- [u"myobj"]=>
- unicode(38) "C:7:"myclass":19:{Data from serialize}"
}
Using PDO::FETCH_CLASS to fetch the object from DB and unserialize it...
[u"myobj"]=>
unicode(38) "C:7:"myclass":19:{Data from serialize}"
}
-done!
\ No newline at end of file
+done!
}
And now PDO using setFetchMode(PDO::FETCH:CLASS|PDO::FETCH_SERIALIZE) + fetch()...
-myclass::__set('myobj', 'Data fetched from DB to be given to unserialize()')
+myclass::unserialize('Data fetched from DB to be given to unserialize()')
myclass::__construct('Called by PDO') - note that it must not be called when unserializing
-object(myclass)#%d (1) {
- ["myobj"]=>
- string(49) "Data fetched from DB to be given to unserialize()"
+object(myclass)#%d (0) {
}
-done!
\ No newline at end of file
+done!