#35368 [Opn]: PDO query does not work properly with serialize

From: Date: Fri, 25 Nov 2005 14:11:23 +0000
Subject: #35368 [Opn]: PDO query does not work properly with serialize
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88969@lists.php.net to get a copy of this message
ID: 35368 User updated by: lists at cyberlot dot net Reported By: lists at cyberlot dot net Status: Open Bug Type: PDO related Operating System: Centos 4.1 PHP Version: 6CVS-2005-11-24 (snap) Assigned To: wez New Comment: Run this on another box, MySQL 4.1.12 and php 5.1.0RC4 same results Previous Comments: ------------------------------------------------------------------------ [2005-11-25 15:00:01] lists at cyberlot dot net Mysql 5.0.15 I have a few other systems I can see if I can try to replicate on ------------------------------------------------------------------------ [2005-11-25 05:07:42] wez@php.net I can't reproduce this at all, even disabling native prepared statement support in mysql doesn't give me those results. Which version of mysql are you using? ------------------------------------------------------------------------ [2005-11-25 01:03:16] lists at cyberlot dot net Debug output SQL: [116] INSERT INTO sessions SET value = 'a:1:{s:4:\"test\";a:2:{s:5:\"test2\";s:4:\"1234\";s:5:\"test3\";s:6:\"555353\";}}' Params: 0 Value in mysql after this a?:{s?:"test";a?:{s?:"test2";s?:"1234";s?:"test3";s?:"555353";}} I downloaded the release version of php 5.1 and reran same results ------------------------------------------------------------------------ [2005-11-24 23:28:31] wez@php.net I still want to see the debugDumpParams() output in the case where it breaks. ------------------------------------------------------------------------ [2005-11-24 23:24:34] lists at cyberlot dot net Ok I narrowed down the exact issue, It has to do with use of ' vs the use of " SET value = 'serializedandescapedstring' -- BAD converts string as mentioned SET value = "serializedandescapedstring" -- Works pdo->quote quotes the string for you by putting "" around it so it works, If you try to quote yourself with '' you get my weird results. Now that I know exactly whats going on its pretty easy to work around, but could catch people off guard. ------------------------------------------------------------------------ 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

« previous php.bugs (#88969) next »