From:             php at pjberkel dot com
Operating system: RHEL 4
PHP version:      5CVS-2005-12-02 (snap)
PHP Bug Type:     MySQLi related
Bug description:  mysqli_stmt_fetch() incorrectly returning NULL

Description:
------------
This bug report is a follow-up to a previous bug:
http://bugs.php.net/bug.php?id=35103

I tested the original reproduce code using the lastest stable snapshot
available (php5.1-200512020130) and there appears to be another bug (or
feature) introduced as a result of the fix to bug #35103.

It appears as though $stmt->fetch() is returning NULL despite the fact
that the result has been correcly bound to the variable (and this only
seems to occur when the data is an unsigned int >= MAX_SIGNED_INT (as in
bug #35103).  I notice in the manual page that mysqli_stmt_fetch() returns
NULL when "No more rows/data exists or data truncation occurred" so it
would appear this is a bug.

Can anybody confirm? (I'm using php5.1-200512020130 + mysql-5.0.16 on RHEL
4). 


Reproduce code:
---------------
<?php

$mysqli = new mysqli("host", "user", "pass", "db");
$mysqli->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
$mysqli->query("INSERT INTO temp (id) VALUES
(3000000897),(3800001532),(3900002281),(3100059612)");

/* BEGIN EXAMPLE OF BUG */
$stmt = $mysqli->prepare("SELECT id FROM temp");
$stmt->execute();
$stmt->bind_result($id);
while ($stmt->fetch()) {
        var_dump($id);
}
$stmt->close();
/* END EXAMPLE OF BUG */

$mysqli->query("DROP TABLE temp");
$mysqli->close();

?>


Expected result:
----------------
string(10) "3000000897"
string(10) "3800001532"
string(10) "3900002281"
string(10) "3100059612"


Actual result:
--------------
[no output, while loop terminates immediately because $stmt->fetch()
returns NULL]


-- 
Edit bug report at http://bugs.php.net/?id=35517&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35517&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35517&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35517&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35517&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35517&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35517&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35517&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35517&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35517&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35517&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35517&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35517&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35517&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35517&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35517&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35517&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35517&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35517&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35517&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35517&r=mysqlcfg

Reply via email to