peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.31k stars 202 forks source link

dynamic call to method with out/ref arguments is not implemented #995

Open jakubmisek opened 2 years ago

jakubmisek commented 2 years ago

calling methods dynamically with ByRef argument is not handled properly, resulting in run-time exception.

this happens only in some cases, this feature seems to be implemented already for PHP-like functions already implemented when a function argument is a PHP-like PhpAlias.

public class X {
  public void test( out Dictionary<string, string> d) {
    d = new Dictionary<string, string>() {
      { "a", "b" },
    };
  }
}
<?php
// $unk = new X; 
$unk->test( $d ); // exception at run time
print_r( $d );