|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77809 getStats() may return false
Submitted: 2019-03-27 15:00 UTC Modified: 2020-10-21 16:35 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: fgm at osinet dot fr Assigned:
Status: Closed Package: memcached (PECL)
PHP Version: 7.2.16 OS: macOS Mojave
Private report: No CVE-ID: None
 [2019-03-27 15:00 UTC] fgm at osinet dot fr
From manual page: always returns an array


If no server is available, Memcached::getStats() will return false instead of returning an array as documented. The code behavior is actually more logical, and consistent with the behavior of the Memcache extension in that case, so it really is a documentation issue, not a code issue.

Test script:
$mc = new \Memcached('bin');
$mc->addServer('', '11239'); // Assuming an unavailable instance.
$stats = $mc->getStats();
echo ($stats === false) ? "KO" : "OK";

Expected result:

Actual result:


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-21 16:09 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2020-10-21 16:35 UTC]
The following pull request has been associated:

Patch Name: Fix #77809: getStats() may return false
On GitHub:
 [2020-10-21 16:35 UTC]
-Assigned To: cmb +Assigned To:
 [2020-10-29 16:24 UTC]
Automatic comment on behalf of cmb
Log: Fix #77809: getStats() may return false
 [2020-10-29 16:24 UTC]
-Status: Verified +Status: Closed
 [2020-10-30 09:45 UTC]
Automatic comment on behalf of mumumu
Log: Fix #77809: getStats() may return false
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 09:01:23 2020 UTC