Bug #63347 [Opn]: Different behavior of parameters processing
| From: | laruence@php.net | Date: | Thu, 25 Oct 2012 04:01:44 +0000 |
| Subject: | Bug #63347 [Opn]: Different behavior of parameters processing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174280@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63347&edit=1
ID: 63347
Updated by: laruence@php.net
Reported by: naquad at gmail dot com
Summary: Different behavior of parameters processing
Status: Open
Type: Bug
Package: PDO related
Operating System: Linux
PHP Version: 5.4.8
Block user comment: N
Private report: N
New Comment:
seems native prepare supporting doesn't supports multi-same-name params, it will
faild in the params number checking
Previous Comments:
------------------------------------------------------------------------
[2012-10-24 14:06:31] naquad at gmail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63347&edit=1