php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36923 PDO::query fails when query contains special charactes
Submitted: 2006-03-30 13:27 UTC Modified: 2006-04-07 01:00 UTC
Votes:14
Avg. Score:4.6 ± 0.7
Reproduced:12 of 12 (100.0%)
Same Version:4 (33.3%)
Same OS:3 (25.0%)
From: farin at refresh dot cz Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.1.2 OS: Gentoo
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: farin at refresh dot cz
New email:
PHP Version: OS:

 

 [2006-03-30 13:27 UTC] farin at refresh dot cz
Description:
------------
When $query parameter for PDO::query contains 
' :A and ? (as part of data) query fails with error
Invalid parameter number: mixed named and positional parameters. This behavior is appear with PDO mysql driver. In  PHP 5.1.1 is not this bug present.

Reproduce code:
---------------
$pdo->query("insert into foo (bar) values ('\\ ? :A')");

Expected result:
----------------
SQL syntax is Ok so query should be proccessed without error.

Actual result:
--------------
Warning: PDO::query() [function.query]: SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters in ...
And query fails.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-30 13:29 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-04-07 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-08-09 22:36 UTC] apike at sfu dot ca
This is still happening for me with PHP 5.2.0.
 [2007-10-04 11:24 UTC] gizmo dot rafal at poczta dot fm
I have same issue on my PHP Version 5.2.3-0.dotdeb.1 with PDO Driver for MySQL, client library version 5.0.41.
 [2008-01-14 17:26 UTC] stoto98 at yahoo dot fr
Same error for me with PHP 5.2.0-8+etch9 (debian) with client library version	5.0.32 (MySQL)
 [2008-09-24 16:10 UTC] chmbox dot spammenot at thecompsmith dot com
It is my understanding that ->query is for select statements and ->exec is for insert/delete/update etc (more data intensive).

This works fine with exec.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC