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([], 1.5);
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
39var_dump(unserialize('O:19:"ReflectionReference":0:{}'));
40
41?>
42--EXPECTF--
43Call to private ReflectionReference::__construct() from invalid context
44ReflectionReference::fromArrayElement() expects parameter 1 to be array, object given
45Key must be array or string
46Array key not found
47Serialization of 'ReflectionReference' is not allowed
48
49Warning: Erroneous data format for unserializing 'ReflectionReference' in %s on line %d
50
51Notice: unserialize(): Error at offset 30 of 31 bytes in %s on line %d
52bool(false)
53