Bug #64032 [PATCH]: mysqli reports different client_version with procedural and object style

From: Date: Wed, 26 Feb 2020 17:44:24 +0000
Subject: Bug #64032 [PATCH]: mysqli reports different client_version with procedural and object style
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225736@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64032&edit=1

 ID:                 64032
 Patch added by:     cmb@php.net
 Reported by:        shakaran at gmail dot com
 Summary:            mysqli reports different client_version with
                     procedural and object style
 Status:             Verified
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Centos 5.9
 PHP Version:        5.3.21
 Block user comment: N
 Private report:     N

 New Comment:

The following pull request has been associated:

Patch Name: Fix #64032: mysqli reports different client_version
On GitHub:  https://github.com/php/php-src/pull/5213
Patch:      https://github.com/php/php-src/pull/5213.patch


Previous Comments:
------------------------------------------------------------------------
[2020-02-26 17:43:12] cmb@php.net

To clarify, this has nothing to do with the server (version); it's
rather about the difference of the version PHP (or the respective
extension) has been built against vs. which version is availble
during runtime.

------------------------------------------------------------------------
[2013-03-13 16:24:36] shakaran at gmail dot com

ext/mysqli/php_mysqli_structs.h:91:#define MYSQLI_VERSION_ID		101009
ext/mysqlnd/mysqlnd.h:26:#define MYSQLND_VERSION_ID 50011
ext/mysqlnd/mysqlnd_libmysql_compat.h:36:#define MYSQL_VERSION_ID		
MYSQLND_VERSION_ID

------------------------------------------------------------------------
[2013-03-13 13:07:05] uw@php.net

s/MYSQLI_VERSION/MYSQL_VERSION_ID

------------------------------------------------------------------------
[2013-03-13 13:06:25] uw@php.net

Good find, must be a bug dating back years:

 OO interfaces uses compile time MYSQLI_VERSION
 Procedural interfaces uses run time C API function call

However, its slightly in the grey area. Client library version and server version are expected to
match in general. AFAIK, in the past, only very conservative statements have been made about using
library versions that differ from server version, particularily if using old library to connect to
new server - which seems to be your case.

------------------------------------------------------------------------
[2013-01-31 21:06:35] shakaran at gmail dot com

From Pierre Joye's twitter suggestion I add this info. I am using libmysql (no 
mysqlnd). It is the default shipped with cPanel in CentOs with easyapache 
script.

Some additional info:

# php -i | grep mysql

Configure Command =>  './configure'  '--enable-bcmath'
'--enable-calendar' '--
enable-exif' '--enable-ftp' '--enable-gd-native-ttf'
'--enable-intl' '--enable-
libxml' '--enable-magic-quotes' '--enable-mbstring'
'--enable-pdo=shared' '--
enable-safe-mode' '--enable-soap' '--enable-sockets'
'--enable-wddx' '--enable-
zend-multibyte' '--enable-zip' '--prefix=/usr/local' '--with-
apxs2=/usr/local/apache/bin/apxs' '--with-bz2' '--with-config-file-
path=/usr/local/lib' '--with-config-file-scan-dir=/usr/local/lib/php.ini.d' '--
with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-enchant=/usr'
'--with-
freetype-dir=/usr' '--with-gd' '--with-gettext'
'--with-icu-dir=/usr' '--with-
imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr'
'--with-jpeg-dir=/usr' 
'--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr'
'--with-
libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-
mcrypt=/opt/libmcrypt/' '--with-mm=/opt/mm/' '--with-mysql=/usr'
'--with-mysql-
sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-
openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre'
'--with-
pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic'
'--with-png-dir=/usr' 
'--with-pspell' '--with-sqlite=shared' '--with-tidy=/opt/tidy/'
'--with-xmlrpc' 
'--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib'
'--with-zlib-
dir=/usr'
mysql
MYSQL_SOCKET => /var/lib/mysql/mysql.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib64 -lmysqlclient 
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MYSQLI_SOCKET => /var/lib/mysql/mysql.sock
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
PDO drivers => sqlite, sqlite2, mysql
pdo_mysql
pdo_mysql.default_socket => /var/lib/mysql/mysql.sock => 
/var/lib/mysql/mysql.sock

# ldd /usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so
	linux-vdso.so.1 =>  (0x00007fffb9d03000)
	libmysqlclient.so.18 => /usr/lib64/libmysqlclient.so.18 
(0x00002ac356f05000)
	libm.so.6 => /lib64/libm.so.6 (0x00002ac357469000)
	librt.so.1 => /lib64/librt.so.1 (0x00002ac3576ed000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00002ac3578f6000)
	libc.so.6 => /lib64/libc.so.6 (0x00002ac357afa000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00002ac357e54000)
	/lib64/ld-linux-x86-64.so.2 (0x00000030ed200000)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=64032


--
Edit this bug report at https://bugs.php.net/bug.php?id=64032&edit=1


Thread (1 message)

  • cmb@php.net
  • Unknown Message
    • cmb@php.net
« previous php.bugs (#225736) next »