Skip to content

Proxy not working with stdClass #374

Open
@marcosh

Description

@marcosh

If I try to create a proxy of a stdClass as follows

$proxyFactory = new LazyLoadingValueHolderFactory();
$initializer = function (
    & $wrappedObject,
    LazyLoadingInterface $proxy
) {
    $proxy->setProxyInitializer(null);
    $wrappedObject = (object) ['bar' => 'baz'];

    return true;
};

$object = $proxyFactory->createProxy(\stdClass::class, $initializer);

$object->bar;

I get the following unexpected error: Undefined property: stdClass::$bar

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions