if ($fp = @fopen($file, 'w')) {
// ok, great we can create a file with a DSN in it
- fwrite($fp, $dsn);
+ @fwrite($fp, $dsn);
fclose($fp);
clearstatcache();
assert(file_exists($file));
}
if ($fp = @fopen($file, 'w')) {
- fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s',
+ @fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s',
chr(0), $dsn));
fclose($fp);
clearstatcache();
try {
- fetch(2, &$db, 'SELECT 1', array(0 => '1', '1' => '1'));
+ fetch(2, $db, 'SELECT 1', array(0 => '1', '1' => '1'));
} catch (PDOException $e) {
printf("[001] %s [%s] %s\n",
Unserializing the previously serialized object...
myclass::unserialize('Data from serialize')
object(myclass)#4 (1) {
- ["myprotected":protected]=>
- string(19) "a protected propery"
+ [u"myprotected":protected]=>
+ unicode(19) "a protected propery"
}
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::__construct(PDO shall not call __construct())
object(myclass)#%d (2) {
- ["myprotected":protected]=>
- string(19) "a protected propery"
- ["myobj"]=>
- string(38) "C:7:"myclass":19:{Data from serialize}"
+ [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...
myclass::__set(myobj, 'C:7:"myclass":19:{Data from serialize}')
myclass::__construct(PDO shall call __construct())
object(myclass)#%d (2) {
- ["myprotected":protected]=>
- string(19) "a protected propery"
- ["myobj"]=>
- string(38) "C:7:"myclass":19:{Data from serialize}"
+ [u"myprotected":protected]=>
+ unicode(19) "a protected propery"
+ [u"myobj"]=>
+ unicode(38) "C:7:"myclass":19:{Data from serialize}"
}
done!
\ No newline at end of file