|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-12 16:23 UTC] suhachov at gmail dot com
Description:
------------
It seems that PDO sql parser is broken and tries to look for placeholders within string constants.
$dbh = new PDO('mysql:...','...','...');
$sth = $dbh->prepare('SELECT my_udf(\'\0:D\0\'),?');
$sth->execute(array(1));
This code triggers an error:
PDO::prepare(): SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters
And I can't replace string constant with placeholder, because MySQL doesn't allows to use placeholders with UDFs.
Reproduce code:
---------------
see above.
You even don't need any installed UDF.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
I suggest you some patch to fix this problem: pdo_sql_parser.re: (["] (ESCQQ|ANYNOEOF\[\\"])* ["]) { RET(PDO_PARSER_TEXT); } (['] (ESCQ|ANYNOEOF\[\\'])* [']) { RET(PDO_PARSER_TEXT); } replace with: (["] (ESCQQ|[\\]ANYNOEOF|ANYNOEOF\[\\"])* ["]) { RET(PDO_PARSER_TEXT); } (['] (ESCQ|[\\]ANYNOEOF|ANYNOEOF\[\\'])* [']) { RET(PDO_PARSER_TEXT); } (i.e. allow any symbol escaped with backslash). I've regenerated parser and it seems working now...