File: bad_construct_8.phpt

package info (click to toggle)
php-memcached 3.1.5%2B2.2.0-5%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,952 kB
  • sloc: ansic: 9,587; xml: 1,318; php: 385; pascal: 87; sh: 12; makefile: 5
file content (34 lines) | stat: -rw-r--r-- 681 bytes parent folder | download
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
--TEST--
Memcached construct with bad arguments
--SKIPIF--
<?php
include "skipif.inc";
if (PHP_VERSION_ID < 80000) die("skip PHP 8 only");
?>
--FILE--
<?php 

try {
	$m = new Memcached((object)array());
} catch (TypeError $e) {
	echo $e->getMessage() . PHP_EOL;
}

class extended extends Memcached {
	public function __construct () {
	}
}

error_reporting(E_ALL);
$extended = new extended ();
var_dump ($extended->setOption (Memcached::OPT_BINARY_PROTOCOL, true));

echo "OK" . PHP_EOL;

--EXPECTF--
Memcached::__construct(): Argument #1 ($persistent_id) must be of type ?string, stdClass given

Warning: Memcached::setOption(): Memcached constructor was not called in %s
NULL
OK