Question mark and an escaped singel quote lead to an exception
| Bug #44251 | Question mark and an escaped singel quote lead to an exception | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2008-02-26 11:11 UTC | Modified: | 2008-10-10 12:18 UTC |
|
||||||||||
| From: | om at viazenetti dot de | Assigned: | felipe (profile) | |||||||||||
| Status: | Closed | Package: | PDO related | |||||||||||
| PHP Version: | 5.2.5 | OS: | Linux | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2008-02-26 11:11 UTC] om at viazenetti dot de
Description:
------------
If a question mark and an escaped singel quote appear in a where statement as value, the PDO method prepare tries to bind a value to the question mark.
Because no values are passed, pdo throws an exception (Only tested with where statements):
PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in
Reproduce code:
---------------
<?php
$db = new PDO('mysql:host=localhost;dbname=DATABASE', 'USER', 'PASSWORD');
$sth = $db->prepare("SELECT * FROM `TABLE` WHERE (login = '?\'')");
$sth->execute();
var_dump($sth->fetch());
Expected result:
----------------
Array or false
Actual result:
--------------
Exception: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2008-09-05 17:59 UTC] tsteiner at nerdclub dot net
[2008-09-09 14:38 UTC] om at viazenetti dot de
[2008-10-01 17:26 UTC] tsteiner at nerdclub dot net
[2008-10-10 12:18 UTC] felipe@php.net