ID:               46803
 Comment by:       nasubi at pako dot ne dot jp
 Reported By:      scaligo at pt dot lu
 Status:           Open
 Bug Type:         PDO related
 Operating System: Linux x86_64
 PHP Version:      5.2.7
 New Comment:

pdo_mysql has same problem on php-5.2.8 (x86_64)


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to