ID: 35368
User updated by: lists at cyberlot dot net
Reported By: lists at cyberlot dot net
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Centos 4.1
PHP Version: 6CVS-2005-11-24 (snap)
Assigned To: wez
New Comment:
Mysql 5.0.15
I have a few other systems I can see if I can try to replicate on
Previous Comments:
------------------------------------------------------------------------
[2005-11-25 05:07:42] [EMAIL PROTECTED]
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] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
[2005-11-24 20:12:05] [EMAIL PROTECTED]
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();
------------------------------------------------------------------------
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