ID: 46803 Comment by: scaligo at pt dot lu Reported By: scaligo at pt dot lu Status: Feedback Bug Type: PDO related Operating System: Linux x86_64 PHP Version: 5.2.7 New Comment:
I re-ran some tests: It indeed works in 5.3.0 alpha3 if I bind :LEN1 and :LEN2 as PDO::PARAM_INT, but not as PDO::PARAM_STR. Using :LEN twice actually works too. Is it possible to back-port the 5.3.0 changes to 5.2.x? Previous Comments: ------------------------------------------------------------------------ [2008-12-11 11:26:21] [EMAIL PROTECTED] I can't reproduce this on 5.3.0 alpha 3, works fine both times. It does however happen in 5.2. I was using regular x86 though. Are you sure this happened with 5.3? ------------------------------------------------------------------------ [2008-12-11 09:59:53] nasubi at pako dot ne dot jp pdo_mysql has same problem on php-5.2.8 (x86_64) ------------------------------------------------------------------------ [2008-12-08 20:45:04] scaligo at pt dot lu Description: ------------ A PDO prepared statement doesn't return any results for a given query performed with bind variables, but works fine when used without. A same value is used twice and the workaround for WONTFIX #33886 has been applied. The initial query (with bind variables) returns the expected results in another environment (Ruby/SQLite3). Reproduced on vanilla 5.2.7 and 5.3.0 alpha 3, x86_64. Compile flags (5.2.7): ./configure \ --enable-debug \ --enable-cli \ --disable-cgi \ --disable-all \ --enable-pdo \ --with-pdo-sqlite \ --enable-sqlite-utf8 Reproduce code: --------------- Test case: http://nopaste.ch/855d0d151ef8216.html Query: SELECT u.login, c.code FROM codes c, users u WHERE u.id = c.user_id AND substr(c.code, 1, min(length(c.code), :LEN1)) = substr(:CODE, 1, min(length(c.code), :LEN2)) Binds: $statement->bindValue(':CODE', '111-222-', PDO::PARAM_STR); $statement->bindValue(':LEN1', 8, PDO::PARAM_INT); $statement->bindValue(':LEN2', 8, PDO::PARAM_INT); Expected result: ---------------- The query should find the same rows with and without using bind variables. Actual result: -------------- The query returns no rows when used with bind variables and two rows without. No errors are reported by errorInfo(). The query behaved correctly when only binding :CODE and replacing :LEN1 and :LEN2 by their actual value. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46803&edit=1
