php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71023 mysqlnd statistic wrap
Submitted: 2015-12-04 05:41 UTC Modified: -
Votes:5
Avg. Score:3.8 ± 1.0
Reproduced:4 of 5 (80.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: damian dot poole at netregistry dot com dot au Assigned:
Status: Open Package: MySQL related
PHP Version: 7.0.0 OS: Debian x86_64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-12-04 05:41 UTC] damian dot poole at netregistry dot com dot au
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"

Patches

dpoole-nowrap-for-mysqlnd-uint64-decrement-or-increment (last revision 2015-12-04 05:46 UTC by damian dot poole at netregistry dot com dot au)
dpoole-nowrap-for-mysqlnd-uint64 (last revision 2015-12-04 05:41 UTC by damian dot poole at netregistry dot com dot au)

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 21:01:27 2019 UTC