php.net |  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: -
Votes:1
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: Open Package: memcached (PECL)
PHP Version: 7.2.16 OS: macOS Mojave
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fgm at osinet dot fr
New email:
PHP Version: OS:

 

 [2019-03-27 15:00 UTC] fgm at osinet dot fr
Description:
------------
---
From manual page: https://php.net/memcached.getstats 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('127.0.0.1', '11239'); // Assuming an unavailable instance.
$stats = $mc->getStats();
echo ($stats === false) ? "KO" : "OK";


Expected result:
----------------
OK

Actual result:
--------------
KO

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 10:01:26 2019 UTC