From:             scaligo at pt dot lu
Operating system: Linux x86_64
PHP version:      5.2.7
PHP Bug Type:     PDO related
Bug description:  Sqlite-PDO prepared statement doesn't return any rows when 
used with bind vars

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 bug report at http://bugs.php.net/?id=46803&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46803&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46803&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46803&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46803&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46803&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46803&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46803&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46803&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46803&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46803&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46803&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46803&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46803&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46803&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46803&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46803&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46803&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46803&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46803&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46803&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46803&r=mysqlcfg

Reply via email to