php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76012 "Invalid parameter number" error for simple query without placeholder
Submitted: 2018-02-26 16:23 UTC Modified: 2021-10-10 04:22 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: young dot inbox at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: PDO PgSQL
PHP Version: 7.2.2 OS: Ubuntu 14 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: young dot inbox at gmail dot com
New email:
PHP Version: OS:

 

 [2018-02-26 16:23 UTC] young dot inbox at gmail dot com
Description:
------------
The simple query like

SELECT attribute7
FROM spot2d.client_tt
WHERE
attribute7 IN (list of values)

which doesn't not contain any placeholders give error 

PDO::query(): SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters

While PostgreSQL run this query without any errors


root@spot2dtest:/home/young# psql -h pgdev.spot2d.com -U dev ddc_scj < 2.sql 
Password for user dev: 
 attribute7 
------------
(0 rows)


If you will remove 10-20 values from any place of the list or some symbols (like ? in the middle of string) - it works

all strings quoted with PDO::quote

table content doesn't matter and it can even no exist

Here is the 2.sql file:
https://www.dropbox.com/s/v9lqzk8ht2de5x5/2.sql?dl=0

i wasn't able to reduce size of the file - if you remove 10+ values from beginning or end of list it works

Test script:
---------------
<?php

$dbh = new PDO('pgsql:host=pgdev.spot2d.com;dbname=ddc_scj', 'login_here', 'pass_here');

$sql = file_get_contents("2.sql");
$dbh->query($sql);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-28 10:49 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-09-28 10:49 UTC] cmb@php.net
If this is still an issue with any of the actively supported PHP
versions[1], could you please make 2.sql available for download
again?

[1] <https://www.php.net/supported-versions.php>
 [2021-10-10 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 16:01:33 2024 UTC