antecedent / patchwork

Method redefinition (monkey-patching) functionality for PHP.
https://antecedent.github.io/patchwork/
MIT License
444 stars 40 forks source link

Interception of the "new" keyword tries to pass non-L-values for by-reference constructor arguments #73

Closed antecedent closed 7 years ago

antecedent commented 7 years ago

Errors of the following kind are generated even when the original code (before preprocessing) passes an L-value to the constructor:

Warning: Parameter 1 to Constructee::__construct() expected to be a reference, value given

For example, this happens in:

class Constructee
{
    public function __construct(&$reference)
    {
        $reference = null;
    }
}

$variable = 123;

new Constructee($variable);