#42916 [Opn]: FETCH_SERIALIZE doesn't work

From: Date: Wed, 10 Oct 2007 13:51:00 +0000
Subject: #42916 [Opn]: FETCH_SERIALIZE doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118363@lists.php.net to get a copy of this message
ID: 42916 User updated by: remi dot lanvin at bsocom dot com Reported By: remi dot lanvin at bsocom dot com Status: Open Bug Type: PDO related Operating System: Linux 2.6.17.8 PHP Version: 5.2.4 New Comment: If I repeat the fetch mode as an argument to fetchAll(), I get the following error : SQLSTATE[HY000]: General error: cannot unserialize class Reproduce code : $results->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_SERIALIZE, 'MyClass'); print_r($results->fetchAll(PDO::FETCH_CLASS | PDO::FETCH_SERIALIZE)); Previous Comments: ------------------------------------------------------------------------ [2007-10-10 13:03:54] remi dot lanvin at bsocom dot com Description: ------------ PDO::FETCH_SERIALIZE doesn't provide a serialized string. Reproduce code: --------------- class MyClass { } $dbh = new PDO($dsn, $user, $password); $results = $dbh->query($sql); $results->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_SERIALIZE, 'MyClass'); print_r($results->fetchAll()); Expected result: ---------------- An array of serialized strings. Actual result: -------------- An array of unserialized MyClass objects (similar as with FETH_CLASS alone). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42916&edit=1

« previous php.bugs (#118363) next »