php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81050 Parameter binding with functions in WHERE condition does not work
Submitted: 2021-05-19 13:16 UTC Modified: -
From: madis at creditinfo dot ee Assigned:
Status: Open Package: PDO_INFORMIX (PECL)
PHP Version: 8.0.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: madis at creditinfo dot ee
New email:
PHP Version: OS:

 

 [2021-05-19 13:16 UTC] madis at creditinfo dot ee
Description:
------------
Parameter binding in WHERE condition does not work if a function is used. Seems like a old bug so OS, PHP and PDO_INFORMIX versions should not matter too much. Did the latest test with php:8.0.6-fpm Docker image and PDO_INFORMIX version 1.3.4.

Brought it up on SO initially: https://stackoverflow.com/questions/66867226/php-pdo-parameter-binding-with-upper-and-lower-functions-in-informix-sql-where-c

Test script:
---------------
$pdo = new PDO();
$string = 'TEST';
$search_string = $string . '%';
$sql = 'SELECT * FROM companies WHERE UPPER(name) LIKE ? LIMIT 1';
$query = $pdo->prepare($sql);
$query->execute([$search_string]);
$result = $query->fetchAll(PDO::FETCH_ASSOC);
print_r($result);

Expected result:
----------------
No errors

Actual result:
--------------
Fatal error: Uncaught PDOException: SQLSTATE[HY004]: Invalid SQL data type: -11064 [Informix][Informix ODBC Driver]SQL data type out of range.

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 15:03:34 2021 UTC