From: Operating system: Ubuntu 10.04 32 bit PHP version: 5.3.5 Package: PDO related Bug Type: Bug Bug description:Unable to insert serialized objects with private variables in pgsql
Description: ------------ Using php 5.3.5 with pdo_pgsql and pgsql 9.0.2 when inserting serialized objects that contain private variables the serialized string is truncate as soon as it hits the private variable. Objects that do not contain private variables work fine. When using the pdo_mysql driver it also works fine. Test script: --------------- <?php class foo{ private $_var; } $foo=serialize(new foo()); $q=new PDO("pgsql:host=localhost;dbname=testdb","root",""); $q->exec('CREATE TABLE test (data TEXT)'); $s=$q->prepare("INSERT INTO test VALUES(?)"); $s->bindValue(1,$foo); $s->execute(); $s=$q->query("SELECT * FROM test"); var_dump($s->fetchAll(PDO::FETCH_ASSOC),$foo); Expected result: ---------------- array(1) { [0]=> array(1) { ["data"]=> string(32) "O:3:"foo":1:{s:9:"foo_var";N;}" } } string(32) "O:3:"foo":1:{s:9:"foo_var";N;}" Actual result: -------------- array(1) { [0]=> array(1) { ["data"]=> string(18) "O:3:"foo":1:{s:9:"" } } string(32) "O:3:"foo":1:{s:9:"foo_var";N;}" -- Edit bug report at http://bugs.php.net/bug.php?id=53756&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53756&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53756&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53756&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53756&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53756&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53756&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53756&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53756&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53756&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53756&r=support Expected behavior: http://bugs.php.net/fix.php?id=53756&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53756&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53756&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53756&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53756&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53756&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53756&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53756&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53756&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53756&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53756&r=mysqlcfg