Skip to content

[BUG]: Controller __get() and getDI()->get() return different results. #17052

@Bellardia

Description

@Bellardia

It seems that the service returned using magic methods inside controllers are cached.

If I replace a default service inside a module, it won't be referenced properly inside controllers.

public function defaultAction($campaign, $pixel) {
        $di = \Phalcon\DI\FactoryDefault::getDefault();
        var_dump($di === $this->getDI(), $this->getDI()->get('request') === $this->request);
}

returns

bool(true)
bool(false)

This doesn't make sense: the internal DI is clearly the same as DI that is statically resolved, so I'm not sure where $this->request is being retrieved from, but it isn't being taken from the DI at call time.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

Labels

bugA bug report

Type

No fields configured for Bug.

Projects

Status
Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions