#42916 [Opn->Fbk]: FETCH_SERIALIZE doesn't work
| From: | iliaa@php.net | Date: | Thu, 11 Oct 2007 21:48:37 +0000 |
| Subject: | #42916 [Opn->Fbk]: FETCH_SERIALIZE doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118433@lists.php.net to get a copy of this message | ||
ID: 42916
Updated by: iliaa@php.net
Reported By: remi dot lanvin at bsocom dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Linux 2.6.17.8
PHP Version: 5.2.4
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
Works in CVS.
Previous Comments:
------------------------------------------------------------------------
[2007-10-10 13:51:00] remi dot lanvin at bsocom dot com
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));
------------------------------------------------------------------------
[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