#35368 [Asn->Fbk]: PDO query does not work properly with serialize

From: Date: Thu, 24 Nov 2005 19:12:07 +0000
Subject: #35368 [Asn->Fbk]: PDO query does not work properly with serialize
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88873@lists.php.net to get a copy of this message
 ID:               35368
 Updated by:       wez@php.net
 Reported By:      lists at cyberlot dot net
-Status:           Assigned
+Status:           Feedback
 Bug Type:         PDO related
 Operating System: Centos 4.1
 PHP Version:      6CVS-2005-11-24 (snap)
 Assigned To:      wez
 New Comment:

Don't use HEAD, use PHP 5.1.
Which version of mysql are you using?

The following script works fine for me:

$db = new PDO('mysql:dbname=test;host=localhost', 'root', '');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$var =
'a:1:{s:4:"test";a:2:{s:5:"test2";s:4:"1234";s:5:"test3";s:6:"555353";}}';

$qvar = $db->quote($var);

$query = "INSERT INTO sessions SET value = $qvar";

//$q = $db->prepare($query);
//$q->execute();

$q = $db->query($query);
$q->debugDumpParams();



Previous Comments:
------------------------------------------------------------------------

[2005-11-24 17:12:04] lists at cyberlot dot net

pdo->quote does not solve the problem either

------------------------------------------------------------------------

[2005-11-24 17:02:43] lists at cyberlot dot net

Also tried with sqlite, did not get the same issue.

------------------------------------------------------------------------

[2005-11-24 16:46:13] lists at cyberlot dot net

Recompiled from
--with-pdo --with-mysql
to
--with-pdo --with-mysqli

Still the same issue so its within pdo itself and not some weird
interaction between pdo and mysql library

------------------------------------------------------------------------

[2005-11-24 16:29:41] lists at cyberlot dot net

I tried the same thing using prepare/bind/execute and it does insert
the serialized/escaped string properly with the slashes as expected so
this is limited to a issue with the pdo->query

------------------------------------------------------------------------

[2005-11-24 16:19:25] tony2001@php.net

Assigned to the maintainer.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/35368

-- 
Edit this bug report at http://bugs.php.net/?id=35368&edit=1


Thread (42 messages)

« previous php.bugs (#88873) next »