Bug #71023 [NEW]: mysqlnd statistic wrap
| From: | damian dot poole at netregistry dot com dot au | Date: | Fri, 04 Dec 2015 05:41:16 +0000 |
| Subject: | Bug #71023 [NEW]: mysqlnd statistic wrap | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197580@lists.php.net to get a copy of this message | ||
From: damian dot poole at netregistry dot com dot au
Operating system: Debian x86_64
PHP version: 7.0.0
Package: MySQL related
Bug Type: Bug
Bug description:mysqlnd statistic wrap
Description:
------------
Some of the connection statistics for the MySQL native driver (namely
active_connections/ active persistent connections) can decrement past
zero causing the statistic to wrap around to the max value of the type.
The attached patch fixes it for us as it stops the macros which
increment/decrement from wrapping around.
Test script:
---------------
<?php
$mysqli = mysqli_init();
$mysqli->real_connect('1.2.3.4'); //non existant server
$stats = mysqli_get_client_stats();
var_dump($stats['active_connections']);
Expected result:
----------------
Warning: mysqli::real_connect(): (HY000/2002): Connection refused in
/websites/ph/php70.damo.id.au/mysql.php on line 3
string(2) "0"
--- next run ---
Warning: mysqli::real_connect(): (HY000/2002): Connection refused in
/websites/ph/php70.damo.id.au/mysql.php on line 3
string(2) "0"
Actual result:
--------------
Warning: mysqli::real_connect(): (HY000/2002): Connection refused in
/websites/ph/php70.damo.id.au/mysql.php on line 3
string(20) "18446744073709551615"
--- next run ---
Warning: mysqli::real_connect(): (HY000/2002): Connection refused in
/websites/ph/php70.damo.id.au/mysql.php on line 3
string(20) "18446744073709551614"
--
Edit bug report at https://bugs.php.net/bug.php?id=71023&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71023&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71023&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71023&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71023&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71023&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71023&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71023&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71023&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71023&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71023&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71023&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71023&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71023&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71023&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71023&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71023&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71023&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71023&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71023&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71023&r=mysqlcfg