File: 022b.phpt

package info (click to toggle)
php-memcache 8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 784 kB
  • sloc: ansic: 5,074; xml: 830; php: 775; pascal: 53; sh: 24; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,355 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
memcache_get_extended_stats()
--SKIPIF--
<?php
if (PHP_VERSION_ID >= 80000)
    die('skip php prior to 8 only');
include 'connect.inc'; if (!isset($host2)) die('skip $host2 not set'); if (ini_get('memcache.protocol') == 'binary') die('skip binary protocol does not support stats');
--FILE--
<?php

include 'connect.inc';

$memcache = new Memcache();
memcache_add_server($memcache, $nonExistingHost, $nonExistingPort);
memcache_add_server($memcache, $host, $port);
memcache_add_server($memcache, $host2, $port2);

$result1 = @memcache_get_stats($memcache);
$result2 = @memcache_get_extended_stats($memcache);
try {
    var_dump(memcache_get_extended_stats(array()));
} catch (TypeError $e) {
     echo "{$e->getMessage()}\n";
}
try {
    var_dump(memcache_get_extended_stats(new stdClass));
} catch (TypeError $e) {
    echo "{$e->getMessage()}\n";
}

var_dump($result1['pid']);

var_dump(count($result2));
var_dump($result2["$host:$port"]['pid']);
var_dump($result2["$host2:$port2"]['pid']);
var_dump($result2["$nonExistingHost:$nonExistingPort"]);

?>
--EXPECTF--
Argument 1 passed to memcache_get_extended_stats() must be an instance of MemcachePool, array given
Argument 1 passed to memcache_get_extended_stats() must be an instance of MemcachePool, instance of stdClass given
string(%d) "%d"
int(3)
string(%d) "%d"
string(%d) "%d"
bool(false)