Skip to content

Commit d1fc179

Browse files
committed
implements dynamic property access through __get()
fixes #1165
1 parent 074e05c commit d1fc179

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Peachpie.Runtime/Operators.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,9 +1200,9 @@ public static PhpValue PropertyGetValue(RuntimeTypeHandle caller, object instanc
12001200

12011201
// 3. __get
12021202
var getter = tinfo.RuntimeMethods[TypeMethods.MagicMethods.__get];
1203-
if (getter != null)
1203+
if (getter != null) // NOTE: magic methods must be public
12041204
{
1205-
// return getter.Invoke(ctx, instance, propertyName);
1205+
return getter.Invoke(null/*expecting non-static PHP method which doesn't need Context, otherwise nullref exception*/, instance, propertyName);
12061206
}
12071207

12081208
// error

0 commit comments

Comments
 (0)