1--TEST--
2Dynamic properties deprecation
3--FILE--
4<?php
5
6class Test {}
7
8$obj = new Test;
9$obj->prop = 1; // Deprecated
10$obj->prop = 1; // Ok
11$obj->prop2 += 1; // Deprecated
12$obj->prop2 += 1; // Ok
13$obj->prop3++; // Deprecated
14$obj->prop3++; // Ok
15$obj->prop4[] = 1; // Deprecated
16$obj->prop4[] = 1; // Ok
17isset($obj->prop5); // Ok
18unset($obj->prop6); // Ok
19
20// stdClass should not throw deprecation.
21$obj = new stdClass;
22$obj->prop = 1;
23
24// Classes with #[AllowDynamicProperties] should not throw deprecation.
25#[AllowDynamicProperties]
26class Test2 {}
27class Test3 extends Test2 {}
28
29$obj = new Test2;
30$obj->prop = 1;
31
32$obj = new Test3;
33$obj->prop = 1;
34
35?>
36--EXPECTF--
37Deprecated: Creation of dynamic property Test::$prop is deprecated in %s on line %d
38
39Deprecated: Creation of dynamic property Test::$prop2 is deprecated in %s on line %d
40
41Warning: Undefined property: Test::$prop2 in %s on line %d
42
43Deprecated: Creation of dynamic property Test::$prop3 is deprecated in %s on line %d
44
45Warning: Undefined property: Test::$prop3 in %s on line %d
46
47Deprecated: Creation of dynamic property Test::$prop4 is deprecated in %s on line %d
48