#35518 [NEW]: mysqli bind_param() incorrectly handles unsigned int
From: php at pjberkel dot com
Operating system: RHEL 4
PHP version: 6CVS-2005-12-02 (snap)
PHP Bug Type: MySQLi related
Bug description: mysqli bind_param() incorrectly handles unsigned int
Description:
------------
This bug report is a follow-up to a previous bug:
http://bugs.php.net/bug.php?id=35103
It appears that mysqli_stmt_bind_param suffers from the same unsigned
integer problem as mysqli_stmt_bind_result (see bug #35103) when the bind
type is set to "i" and the integer value bound is MAX_UNSIGNED_INT < x <
MAX_SIGNED_INT. If the bind type in $stmt->bind_param() is changed to "d"
then the reproduce code works as expected.
(Could possibly be related to bug #35428 but the error in this bug report
is much more reproducible). 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 (3900002281)");
$id_val = 3900002281;
/* BEGIN EXAMPLE OF BUG */
$stmt = $mysqli->prepare("SELECT id FROM temp WHERE id = ?");
$stmt->bind_param("i", $id_val);
$stmt->execute();
$stmt->bind_result($id);
$stmt->fetch();
var_dump($id);
$stmt->close();
/* END EXAMPLE OF BUG */
$mysqli->query("DROP TABLE temp");
$mysqli->close();
?>
Expected result:
----------------
string(10) "3000000897"
Actual result:
--------------
int(0)
--
Edit bug report at http://bugs.php.net/?id=35518&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35518&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35518&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35518&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35518&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35518&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35518&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35518&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35518&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35518&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35518&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35518&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35518&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35518&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35518&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35518&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35518&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35518&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35518&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35518&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35518&r=mysqlcfg
Thread (5 messages)
- php at pjberkel dot com