|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-01-20 23:43 UTC] shakaran at gmail dot com
Description: ------------ I am using a Centos 5.9 server with cPanel and Php 5.3.15 with MySQL 5.5.28. When I try to get the current mysql version from mysqli using procedural or object oriented style I get slightly different version. With object style, I get 50524 as integer, according to http://php.net/manual/en/mysqli.get-client-version.php that is 5.5.24 (wrong version). But with procedural style I get 50528 as integer, that is 5.5.28 (the real version). This could be tested with the commands attached in test script section, but it is not always reproducible (maybe for slighly differences in system configuration). I think that both methods should read the data from the same location and reports the exact and same version, it is weird that different values appears. This could be a different config in MySQL for version headers or it is getting older version headers from some path, but php always should get the same version from both methods. I only can reproduce in one system (three tested), so I am thinking that's a false positive from some mysql config. Also, (I am lazy for fill another documentation bug) I detect at http://php.net/manual/en/mysqli.get-client-version.php that it says "Returns the MySQL client version as a string" and below says in description section "Returns client version number as an integer.". Since it return always a integer, the docs are wrong and should be changed to "Returns the MySQL client version as an integer". Test script: --------------- # php -r '$mysqli = new mysqli(); var_dump($mysqli->client_version); var_dump(mysqli_get_client_version());' ; mysql --version; php --version int(50524) int(50528) mysql Ver 14.14 Distrib 5.5.28, for Linux (x86_64) using readline 5.1 PHP 5.3.15 (cli) (built: Aug 9 2012 07:10:41) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH Mysql modules present: # php -m | grep mysql mysql mysqli pdo_mysql In another system with Centos 6.3, cPanel and PHP 5.3.20 and MySQL 5.5.28 it works nice: php -r '$mysqli = new mysqli(); var_dump($mysqli->client_version); var_dump(mysqli_get_client_version());' ; mysql --version; php --version int(50528) int(50528) mysql Ver 14.14 Distrib 5.5.28, for Linux (x86_64) using readline 5.1 PHP 5.3.20 (cli) (built: Jan 21 2013 00:24:03) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH Expected result: ---------------- Same mysql version using both methods Actual result: -------------- Different versions using both methods PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 03:00:01 2025 UTC |
Additionally using mysqli_init() has the same behaviour. # php -r '$mysqli = mysqli_init(); var_dump($mysqli->client_version); var_dump(mysqli_get_client_version());' ; mysql --version; php --version int(50524) int(50528) mysql Ver 14.14 Distrib 5.5.28, for Linux (x86_64) using readline 5.1 PHP 5.3.15 (cli) (built: Aug 9 2012 07:10:41) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH