Skip to content

[VarExporter] Lazy proxy breaks pass by reference arguments #49191

Closed
@magnetik

Description

@magnetik

Symfony version(s) affected

6.2.x

Description

When using Symfony 6.2 and the var exporter lazy proxy, if you generate a proxy for \Redis the proxy looks like this:

class MyRedisProxy extends \Redis {
	
    public function sscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null)
    {
        return parent::sscan(...\func_get_args());
    }
	
}

See the iterator passed by reference? It seems that when used with func_get_args the reference get lost or something.

How to reproduce

As a consequence this code :

$myProxy = new MyRedisProxy();

$myProxy->connect('127.0.0.1', 6379);

$cursor = null;
while (($result = $myProxy->sScan('key_', $cursor, null, 1000)) !== false) {
	var_dump($result);
}

it an infinite loop.

Repro with VarExporter : https://github.com/magnetik/repro-symfony-proxy-break-reference

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions