|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-10-25 04:01 UTC] laruence@php.net
[2012-10-25 04:02 UTC] laruence@php.net
-Assigned To:
+Assigned To: wez
[2012-10-25 10:08 UTC] uw@php.net
[2012-10-25 10:15 UTC] naquad at gmail dot com
[2012-10-26 03:35 UTC] wez@php.net
-Status: Assigned
+Status: Not a bug
[2012-10-26 03:35 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
Description: ------------ PDO::ATTR_EMULATE_PREPARES changes behavior of parameter processing. When it is enabled multiple occurrences of named parameter work as expected, but when it is disabled I get "Invalid parameter number" error. Test script: --------------- <?php $pdo = new PDO('mysql:host=localhost;dbname=test', 'root', ''); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); /// remove this line and scirpt works as expected $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $query = $pdo->prepare('select :x = :x'); $query->bindValue(':x', 1); $query->execute(); $t = $query->fetch(); var_dump($t); $query->closeCursor(); Expected result: ---------------- array(2) { '\'1\' = \'1\'' => string(1) "1" [0] => string(1) "1" } Actual result: -------------- PDOException: SQLSTATE[HY093]: Invalid parameter number in /srv/http/fucktube/app/test.php on line 7 Call Stack: 0.0002 230552 1. {main}() /srv/http/fucktube/app/test.php:0 0.0739 246416 2. PDOStatement->execute() /srv/http/fucktube/app/test.php:7