| Bug #22670 | mysqli_stmt_bind_param incorrect values | ||
|---|---|---|---|
| Submitted: | 25 Sep 2006 15:33 | Modified: | 28 Feb 2007 12:04 |
| Reporter: | Антон Нехороших | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) |
| Version: | 4.1.x and 5.0.x | OS: | Linux (Linux) |
| Assigned to: | CPU Architecture: | Any | |
[25 Sep 2006 15:57]
Georg Richter
Could you please provide the values of mysqli section from phpinfo() output?
[25 Sep 2006 16:03]
Антон Нехороших
You can have a look it here: http://c5test.ht-systems.ru/
[26 Sep 2006 6:43]
Valeriy Kravchuk
Please, send the SHOW CREATE TABLE assort\G SHOW TABLE STATUS like 'assort'; results.
[26 Sep 2006 9:49]
Антон Нехороших
mysql> SHOW CREATE TABLE assort\G
*************************** 1. row ***************************
Table: assort
Create Table: CREATE TABLE `assort` (
`id` int(11) NOT NULL default '0',
`articul` varchar(255) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
1 row in set (0.00 sec)
mysql>
mysql> SHOW TABLE STATUS like 'assort';
+------+--------+---------+------------+------+----------------+-------------+-----------------+----
----------+-----------+----------------+---------------------+---------------------+------------+---
----------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Ind
ex_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Co
llation | Checksum | Create_options | Comment |
+------+--------+---------+------------+------+----------------+-------------+-----------------+----
----------+-----------+----------------+---------------------+---------------------+------------+---
----------------+----------+----------------+---------+
| assort | MyISAM | 9 | Dynamic | 1 | 264 | 264 | 4294967295 |
1024 | 0 | NULL | 2006-09-25 18:44:32 | 2006-09-25 18:44:37 | NULL | cp
1251_general_ci | NULL | | |
+------+--------+---------+------------+------+----------------+-------------+-----------------+----
----------+-----------+----------------+---------------------+---------------------+------------+---
----------------+----------+----------------+---------+
1 row in set (0.00 sec)
mysql>
[root@db3 ~]# mysqladmin version
mysqladmin Ver 8.41 Distrib 4.1.21, for unknown-linux-gnu on x86_64
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.1.21-Max-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 12 days 9 hours 19 min 38 sec
Threads: 49 Questions: 741621974 Slow queries: 29497 Opens: 2223745 Flush tables: 1 Open tables
: 2785 Queries per second avg: 692.860
[root@db3 ~]# uname -a
Linux db3.ht-systems.ru 2.6.17-prep #1 SMP Thu Sep 7 21:30:57 MSD 2006 x86_64 x86_64 x86_64 GNU/Linu
x
[root@db3 ~]#
[26 Sep 2006 15:55]
Valeriy Kravchuk
Please, send the results of SHOW VARIABLES LIKE 'char%'; from both 32-bit server that works properly and 64-bit one that give you the results described.
[26 Sep 2006 16:57]
Valeriy Kravchuk
Please, also try to run the following test case: mysql> prepare stmt from 'INSERT INTO assort (id, articul) VALUES (?, ?)'; Query OK, 0 rows affected (0.10 sec) Statement prepared mysql> set @a=19; Query OK, 0 rows affected (0.08 sec) mysql> set @b="RRRRRRRRR"; Query OK, 0 rows affected (0.06 sec) mysql> execute stmt using @a, @b; Query OK, 1 row affected (0.06 sec) mysql> select * from assort; +----+-----------+ | id | articul | +----+-----------+ | 19 | RRRRRRRRR | +----+-----------+ 1 row in set (0.07 sec) from mysql command line client on your 32-bit Linux, connected to a problematic 64-bit Linux server. Send your results. Sorry, but I can not repeat the behaviour you describned, hence the additional questions.
[26 Sep 2006 19:23]
Антон Нехороших
64-bit db server +--------------------------+-----------------------------------------------+ | Variable_name | Value | +--------------------------+-----------------------------------------------+ | character_set_client | cp1251 | | character_set_connection | cp1251 | | character_set_database | cp1251 | | character_set_results | cp1251 | | character_set_server | cp1251 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql-4.1.21/share/mysql/charsets/ | +--------------------------+-----------------------------------------------+ 32-bit db server +--------------------------+-----------------------------------------------+ | Variable_name | Value | +--------------------------+-----------------------------------------------+ | character_set_client | cp1251 | | character_set_connection | cp1251 | | character_set_database | cp1251 | | character_set_results | cp1251 | | character_set_server | cp1251 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql-4.1.21/share/mysql/charsets/ | +--------------------------+-----------------------------------------------+
[26 Sep 2006 19:34]
Антон Нехороших
from command line mysql all work fine, but in php not work. I still last time have told, that I can give test access and will study as is. Simply in php have told, that a problem in mysql. Though I now doubt already, that a problem in mysql if from a command line all works leaves you here not and. http://bugs.php.net/bug.php?id=38231 Может по русски все писать?
[5 Oct 2006 13:23]
Антон Нехороших
There are news?
[23 Nov 2006 15:52]
Valeriy Kravchuk
Sorry for a delay with this report. We should better use only English to give more people a chance to follow the discussion. Please, send the results of: ldd php (with php substituted with full pathname). Are you sure mysqli uses correct version of libmysqlclient.so.*? If you built PHP from sources, please, send all the commands used.
[23 Nov 2006 16:00]
Антон Нехороших
# ldd /pub/usr/local/bin/php
libcrypt.so.1 => /lib/libcrypt.so.1 (0x005a0000)
libc-client.so.0 => /pub/usr/lib/libc-client.so.0 (0x006b8000)
libzzip-0.so.10 => /pub/usr/local/lib/libzzip-0.so.10 (0x003a4000)
libz.so.1 => /pub/usr/lib/libz.so.1 (0x00f14000)
libexslt.so.0 => /pub/usr/local/lib/libexslt.so.0 (0x00111000)
libdl.so.2 => /lib/libdl.so.2 (0x0016a000)
libm.so.6 => /lib/tls/i686/libm.so.6 (0x00b3a000)
libiconv.so.2 => /pub/usr/lib/libiconv.so.2 (0x00c96000)
libtidy-0.99.so.0 => /pub/usr/local/lib/libtidy-0.99.so.0 (0x00410000)
libpq.so.4 => /pub/usr/local/pgsql/lib/libpq.so.4 (0x002ef000)
libsybdb.so.5 => /pub/usr/local/lib/libsybdb.so.5 (0x004b7000)
libmhash.so.2 => /pub/usr/local/lib/libmhash.so.2 (0x00123000)
libmcrypt.4 => /pub/usr/local/lib/libmcrypt.4 (0x003df000)
libltdl.so.3 => /pub/usr/lib/libltdl.so.3 (0x0022f000)
libpam.so.0 => /lib/libpam.so.0 (0x00524000)
libgd.so.2 => /pub/usr/local/lib/libgd.so.2 (0x0016e000)
libfontconfig.so.1 => /pub/usr/local/lib/libfontconfig.so.1 (0x001d8000)
libexpat.so.0 => /pub/usr/local/lib/libexpat.so.0 (0x00236000)
libt1.so.5 => /pub/usr/local/lib/libt1.so.5 (0x0025e000)
libfreetype.so.6 => /pub/usr/local/lib/libfreetype.so.6 (0x007ab000)
libpng12.so.0 => /pub/usr/local/lib/libpng12.so.0 (0x002aa000)
libdb-4.3.so => /pub/usr/local/lib/libdb-4.3.so (0x00827000)
libresolv.so.2 => /lib/libresolv.so.2 (0x0020b000)
libnsl.so.1 => /lib/libnsl.so.1 (0x002d6000)
libstdc++.so.6 => /pub/usr/lib/libstdc++.so.6 (0x005cd000)
libcurl.so.3 => /pub/usr/local/lib/libcurl.so.3 (0x00306000)
libssl.so.4 => /lib/libssl.so.4 (0x00559000)
libcrypto.so.4 => /lib/libcrypto.so.4 (0x0094c000)
libgssapi_krb5.so.2 => /pub/usr/lib/libgssapi_krb5.so.2 (0x003ac000)
libkrb5.so.3 => /pub/usr/lib/libkrb5.so.3 (0x00a3a000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00161000)
libk5crypto.so.3 => /pub/usr/lib/libk5crypto.so.3 (0x0033e000)
libidn.so.11 => /pub/usr/lib/libidn.so.11 (0x00360000)
libmnogosearch-3.2.so => /pub/usr/local/mnogosearch/lib/libmnogosearch-3.2.so (0x00aa2000)
libmnogocharset-3.2.so => /pub/usr/local/mnogosearch/lib/libmnogocharset-3.2.so (0x00454000)
librt.so.1 => /lib/tls/i686/librt.so.1 (0x00390000)
libmysqlclient.so.15 => /usr/local/mysql-5.0.24a/lib/mysql/libmysqlclient.so.15 (0x00d74000)
libclntsh.so.10.1 => /usr/lib/oracle/10.2.0.1/client/lib/libclntsh.so.10.1 (0x02000000)
libxslt.so.1 => /pub/usr/local/lib/libxslt.so.1 (0x00476000)
libxml2.so.2 => /pub/usr/local/lib/libxml2.so.2 (0x00f26000)
libc.so.6 => /lib/tls/i686/libc.so.6 (0x00b5d000)
/lib/ld-linux.so.2 (0x00b23000)
libpthread.so.0 => /lib/tls/i686/libpthread.so.0 (0x0021d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x003c1000)
libnnz10.so => /usr/lib/oracle/10.2.0.1/client/lib/libnnz10.so (0x01069000)
for test php code:
<?
$link = mysqli_connect('xxxx', 'xxxx', 'xxxx','xxxx');
$qu_insert = "INSERT INTO test (id, articul) VALUES (?,?)";
$stmt = mysqli_prepare($link, $qu_insert);
mysqli_stmt_bind_param($stmt, "is", $ind, $articul);
$ind = 19;
$articul = "JJJJJ";
/* execute prepared statement */
mysqli_stmt_execute($stmt);
printf("%d Row inserted.\n", mysqli_stmt_affected_rows($stmt));
/* close statement and connection */
mysqli_stmt_close($stmt);
?>
you can see phpinfo:
http://c5test.ht-systems.ru/
i sure mysqli uses correct version of libmysqlclient.so.*
[28 Jan 2007 12:04]
Valeriy Kravchuk
Sorry for a delay with this bug report. So, you linked with: /usr/local/mysql-5.0.24a/lib/mysql/libmysqlclient.so.15 Can you, please, try to relink PHP with libmysqlclient from version 5.0.27 and check if this problem is solved already?
[1 Mar 2007 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".

Description: web server placed on 32bit linux server with php 5.1.4 and mysql 4.1.18 client. If i using database on 32bit linux server all work correctly, but if using 64bit lunix server after execute statement in database placed incorrect values. in database i see: instead of 19 I see 196864 instead of "RRRRRRRRR" I see "RRRRRRRRRюЂdef??юЂюb7_optЂµa «*?µa «*ђµa «*?µa " How to repeat: $mys = new mysqli($mysql_['host'], $mysql_['username'], $mysql_['password'], $mysql_['database']); $qu_insert = "INSERT INTO assort (ind, articul) VALUES (?, ?)"; $stmt = $mys->prepare($qu_insert); $ind = 19; $articul = "RRRRRRRRR"; $stmt->bind_param("is", $ind, $articul); $stmt->execute(); $stmt->close();