PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #9754

Backslash added to string with double quotes in prepare/execute

Details

Submitted2007-01-06 10:03 UTC
Fromstreamlake at tiscali dot it
Assignedquipo
StatusBogus
PackageMDB2
PHP Version5.1.4
OSFedora Core 6
Roadmaps(Not assigned)

Comments

[2007-01-06 10:03 UTC] streamlake at tiscali dot it

Description:
------------
I'm trying to execute a prepare/execute statement to insert a record in a MySQL (InnoDB) table that has a varchar column.
If the string I provide for the column contains a double quote ("), every double quote is prepended by a backslash (\).

Looking at the table record after insertion it is:
cod -> 1
descr -> \"Test double quotes \"

Looking at mysql log, the execute line for descr field is:
SET @1='\\\"Test double quotes\\\"'

This happens ONLY with a Fedora Core 6 apache 2.0.x server, MySQL 5.0.x, I tested on a win machine and on an Ubuntu 6.10 machine and the error doesn't happen.
Unfortunately these are the only input I can give.

Test script:
---------------
//table is: cod INT, descr VARCHAR(100)

$sth = $db->prepare("INSERT INTO table (cod, descr) VALUES (?, ?)");
$str = '"Test double quotes"'; //this comes usually from user input in an <input> html tag
$data = array(1, $str);
$res = $sth->execute($data);

[2007-01-09 10:03 UTC] streamlake at tiscali dot it

Thanks!
I didn't notice magic quotes where enabled by default in php.ini-dist.
Sorry for this post, it was notg a bug but only my fault.
Thanks again!