com php-src: Fix for Bug #66124 (mysqli under mysqlnd loses precision when bind_param with 'i'): ext/mysqli/tests/bug6 6124.phpt
| From: | Andrey Hristov | Date: | Thu, 21 Nov 2013 19:14:42 +0000 |
| Subject: | com php-src: Fix for Bug #66124 (mysqli under mysqlnd loses precision when bind_param with 'i'): ext/mysqli/tests/bug6 6124.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74019@lists.php.net to get a copy of this message | ||
Commit: 4a1c9be857a6d076ae9192a923b92b56fbb372d9
Author: Andrey Hristov <andrey@php.net> Thu, 21 Nov 2013 21:14:42 +0200
Parents: b902a25cc319e0e824104245e382376a48256803
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4a1c9be857a6d076ae9192a923b92b56fbb372d9
Log:
Fix for Bug #66124 (mysqli under mysqlnd loses precision when bind_param with 'i')
Bugs:
https://bugs.php.net/66124
Changed paths:
A ext/mysqli/tests/bug66124.phpt
Diff:
diff --git a/ext/mysqli/tests/bug66124.phpt b/ext/mysqli/tests/bug66124.phpt
new file mode 100644
index 0000000..8c0027f
--- /dev/null
+++ b/ext/mysqli/tests/bug66124.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Bug #66124 (mysqli under mysqlnd loses precision when bind_param with 'i')
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('connect.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+$table_drop = "DROP TABLE IF EXISTS
bug66124";
+$table_create = "CREATE TABLE bug66124 (
+ id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8";
+
+$table_insert = "INSERT INTO bug66124 SET id=?";
+$table_select = "SELECT * FROM bug66124";
+$table_delete = "DELETE FROM bug66124";
+$id = '1311200011005001566';
+
+
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s,
socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+}
+
+$link->query($table_drop);
+$link->query($table_create);
+
+$stmt = $link->prepare($table_insert);
+if (!$stmt) {
+ printf("Can't prepare\n");
+ exit(1);
+}
+
+echo "Using 'i':\n";
+$stmt->bind_param('i', $id);
+
+if ($stmt->execute()){
+ echo "insert id:{$id}=>{$stmt->insert_id}\n";
+} else {
+ printf("Can't execute\n");
+ exit(1);
+}
+
+
+$result = $link->query($table_select);
+
+if ($result){
+ while ($row = $result->fetch_assoc()) {
+ echo "fetch id:{$row['id']}\n";
+ }
+} else {
+ printf("Can't select\n");
+ exit(1);
+}
+
+$stmt->close();
+
+$link->query($table_drop);
+$link->query($table_create);
+
+
+$stmt = $link->prepare($table_insert);
+$stmt->bind_param('s', $id);
+
+echo "Using 's':\n";
+
+if ($stmt->execute()){
+ echo "insert id:{$id}\n";
+} else{
+ printf("Can't execute\n");
+ exit(1);
+}
+
+$result = $link->query($table_select);
+
+if ($result){
+ while ($row = $result->fetch_assoc()) {
+ echo "fetch id:{$row['id']}\n";
+ }
+} else {
+ printf("Can't select\n");
+ exit(1);
+}
+
+$link->close();
+?>
+done
+--EXPECTF--
+Using 'i':
+insert id:1311200011005001566=>1311200011005001566
+fetch id:1311200011005001566
+Using 's':
+insert id:1311200011005001566
+fetch id:1311200011005001566
+done
\ No newline at end of file