#35518 [Opn->Fbk]: mysqli bind_param() incorrectly handles unsigned int
| From: | tony2001@php.net | Date: | Fri, 02 Dec 2005 10:12:14 +0000 |
| Subject: | #35518 [Opn->Fbk]: mysqli bind_param() incorrectly handles unsigned int | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89631@lists.php.net to get a copy of this message | ||
ID: 35518
Updated by: tony2001@php.net
Reported By: php at pjberkel dot com
-Status: Open
+Status: Feedback
Bug Type: MySQLi related
Operating System: RHEL 4
PHP Version: 6CVS-2005-12-02 (snap)
New Comment:
>If the bind type in $stmt->bind_param() is
>changed to "d" then the reproduce code works as expected.
Because you are binding a FLOAT?
I can hardly imagine a way to fit a float value in an integer var.
Doesn't look like a bug to me.
Previous Comments:
------------------------------------------------------------------------
[2005-12-02 10:51:44] php at pjberkel dot com
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 this bug report at http://bugs.php.net/?id=35518&edit=1