File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed
Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -4,25 +4,16 @@ Lazy proxy with __get creating references and arithmetic
44<?php
55class A {
66 public $ _ ;
7-
87 public function __get ($ n ) {
98 global $ obj ;
10-
11- // Create a reference to an uninitialized property
129 $ obj ->x =& $ this ->_ ;
13-
14- // Static self-reference (edge case)
1510 static $ a = $ a ;
16-
17- // Arithmetic on reference
1811 $ e =& $ this ->_ - $ a ;
1912 }
2013}
21-
2214$ rc = new ReflectionClass (A::class);
2315$ obj = $ rc ->newLazyProxy (fn () => new A );
2416$ rc ->initializeLazyObject ($ obj );
25-
2617var_dump ($ obj ->p );
2718?>
2819--EXPECTF--
@@ -32,8 +23,8 @@ Warning: Undefined property: A::$x in %s on line %d
3223
3324Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
3425Stack trace:
35- #0 %s(9 ): A->__get('x')
36- #1 %s(23 ): A->__get('p')
26+ #0 %s(%d ): A->__get('x')
27+ #1 %s(%d ): A->__get('p')
3728#2 {main}
3829 thrown in %s on line %d
3930
You can’t perform that action at this time.
0 commit comments