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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:30 2024 UTC