Bug #60695 [NEW]: bind_param 'd' appends a 0
From:
Operating system: FreeBSD
PHP version: 5.3.8
Package: MySQLi related
Bug Type: Bug
Bug description:bind_param 'd' appends a 0
Description:
------------
---
From manual page:
http://www.php.net/mysqli-stmt.bind-param#refsect1-mysqli-
stmt.bind-param-parameters
---
When inserting a 'double' using prepared statements
d corresponding variable has type double
if the number is on the format n.y example:1.3, or 99.3, an '0' is
appended to
the number, storing something like 1.30, or 99.30 instead of just 1.3 or
99.3
Test script:
---------------
$mysqli = new mysqli('localhost','dalmp','test','test');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$name = 99.3;
if ($stmt = $mysqli->prepare('INSERT INTO test set name=?')) {
$stmt->bind_param('d',$name);
$stmt->execute();
$stmt->close();
}
$mysqli->close();
#this will store 99.30 instead of just 99.3
Expected result:
----------------
do not alter/append the input with a 0 when selecting 'd' as the
bind_parameter
--
Edit bug report at https://bugs.php.net/bug.php?id=60695&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60695&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60695&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60695&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=60695&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60695&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=60695&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=60695&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=60695&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=60695&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=60695&r=support
Expected behavior: https://bugs.php.net/fix.php?id=60695&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=60695&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=60695&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=60695&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60695&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60695&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=60695&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=60695&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=60695&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=60695&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=60695&r=mysqlcfg
Thread (7 messages)
- nbari at dalmp dot com