Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container doesn't resolve properties of already built instances after their state reset #306

Open
alamagus opened this issue Aug 10, 2022 · 2 comments
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug

Comments

@alamagus
Copy link

What steps will reproduce the problem?

Run yiisoft/demo via RR(yiisoft/yii-runner-roadrunner)
1st request is handled properly, after which StateResetter::reset() is invoked
in subsequent requests container returns instances with unresolved properties

Example for subsequent requests:

What is the expected result?

Screenshot from 2022-08-10 09-04-14

What do you get instead?

Screenshot from 2022-08-10 09-05-57

Additional info

Q A
Version 1.1.0
PHP version 8.1.2
Operating system Ubuntu 22.04
@rustamwin rustamwin added type:bug Bug status:to be verified Needs to be reproduced and validated. labels Aug 10, 2022
@vjik
Copy link
Member

vjik commented Aug 11, 2022

Seems, problem here.

On first request container parse definitions and convert their to objects, but on reset this is not happening.

@samdark samdark added status:ready for adoption Feel free to implement this issue. and removed status:to be verified Needs to be reproduced and validated. labels Aug 11, 2022
@alamagus
Copy link
Author

as a temporary solution for anyone who's running demo app on RR, amend reset:

'reset' => function (\Psr\Container\ContainerInterface $container) use ($params) {
    /** @var WebView $this */
    $this->clear();

    $resolvedParams = [];
    foreach ($params['yiisoft/view']['parameters'] as $id => $value) {
        $resolvedParams[$id] = $value instanceof \Yiisoft\Definitions\Reference ? $value->resolve($container) : $value;
    }
    $this->setParameters($resolvedParams);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Projects
None yet
Development

No branches or pull requests

4 participants