1--TEST--
2Bug #46064.2 (Exception when creating ReflectionProperty object on dynamically created property)
3--FILE--
4<?php
5
6#[AllowDynamicProperties]
7class foo {
8}
9
10$x = new foo;
11$x->test = 2000;
12
13
14$p = new ReflectionObject($x);
15var_dump($p->getProperty('test'));
16
17
18#[AllowDynamicProperties]
19class bar {
20    public function __construct() {
21        $this->a = 1;
22    }
23}
24
25class test extends bar {
26    private $b = 2;
27
28    public function __construct() {
29        parent::__construct();
30
31        $p = new reflectionobject($this);
32        var_dump($h = $p->getProperty('a'));
33        var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic());
34        var_dump($p->getProperties());
35    }
36}
37
38new test;
39
40?>
41--EXPECTF--
42object(ReflectionProperty)#%d (2) {
43  ["name"]=>
44  string(4) "test"
45  ["class"]=>
46  string(3) "foo"
47}
48object(ReflectionProperty)#%d (2) {
49  ["name"]=>
50  string(1) "a"
51  ["class"]=>
52  string(4) "test"
53}
54bool(false)
55bool(false)
56bool(false)
57bool(true)
58bool(false)
59array(2) {
60  [0]=>
61  object(ReflectionProperty)#%d (2) {
62    ["name"]=>
63    string(1) "b"
64    ["class"]=>
65    string(4) "test"
66  }
67  [1]=>
68  object(ReflectionProperty)#%d (2) {
69    ["name"]=>
70    string(1) "a"
71    ["class"]=>
72    string(4) "test"
73  }
74}
75