Doc #77809 [Opn->Ver]: getStats() may return false

From: Date: Wed, 21 Oct 2020 16:09:48 +0000
Subject: Doc #77809 [Opn->Ver]: getStats() may return false
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18020@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77809&edit=1

 ID:                 77809
 Updated by:         cmb@php.net
 Reported by:        fgm at osinet dot fr
 Summary:            getStats() may return false
-Status:             Open
+Status:             Verified
 Type:               Documentation Problem
 Package:            memcached
 Operating System:   macOS Mojave
 PHP Version:        7.2.16
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2019-03-27 15:00:30] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77809&edit=1


Thread (4 messages)

« previous php.doc.bugs (#18020) next »