1--TEST--
2Various error conditions for ReflectionReference
3--FILE--
4<?php
5
6try {
7    new ReflectionReference();
8} catch (Error $e) {
9    echo $e->getMessage(), "\n";
10}
11
12try {
13    ReflectionReference::fromArrayElement(new stdClass, "test");
14} catch (TypeError $e) {
15    echo $e->getMessage(), "\n";
16}
17
18try {
19    ReflectionReference::fromArrayElement([], []);
20} catch (TypeError $e) {
21    echo $e->getMessage(), "\n";
22}
23
24try {
25    $ary = [0, 1, 2];
26    ReflectionReference::fromArrayElement($ary, 3);
27} catch (ReflectionException $e) {
28    echo $e->getMessage(), "\n";
29}
30
31try {
32    $ary = [&$ary];
33    $ref = ReflectionReference::fromArrayElement($ary, 0);
34    var_dump(serialize($ref));
35} catch (Exception $e) {
36    echo $e->getMessage(), "\n";
37}
38
39try {
40    var_dump(unserialize('O:19:"ReflectionReference":0:{}'));
41} catch (Exception $e) {
42    echo $e->getMessage(), "\n";
43}
44?>
45--EXPECTF--
46Call to private ReflectionReference::__construct() from global scope
47ReflectionReference::fromArrayElement(): Argument #1 ($array) must be of type array, stdClass given
48ReflectionReference::fromArrayElement(): Argument #2 ($key) must be of type string|int, array given
49Array key not found
50Serialization of 'ReflectionReference' is not allowed
51Unserialization of 'ReflectionReference' is not allowed
52