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

[BUG]: Wrong return type for Phalcon\Di::getInternalEventsManager #14992

Closed
sergeyklay opened this issue May 3, 2020 · 1 comment · Fixed by #14993
Closed

[BUG]: Wrong return type for Phalcon\Di::getInternalEventsManager #14992

sergeyklay opened this issue May 3, 2020 · 1 comment · Fixed by #14993
Assignees
Labels
bug A bug report status: low Low

Comments

@sergeyklay
Copy link
Contributor

The current implementation of Phalcon\Di::getInternalEventsManager implies that method must return Phalcon\Events\ManagerInterface:

cphalcon/phalcon/Di.zep

Lines 268 to 271 in fc2b8d6

public function getInternalEventsManager() -> <ManagerInterface>
{
return this->eventsManager;
}

however, Phalcon\Di::$eventsManager is NULL by default:

cphalcon/phalcon/Di.zep

Lines 74 to 79 in fc2b8d6

/**
* Events Manager
*
* @var ManagerInterface
*/
protected eventsManager;

This leads to a fatal error:

$di = new Phalcon\Di();
$di->getInternalEventsManager();
PHP Fatal error:
Return value of Phalcon\Di::getInternalEventsManager()
must implement interface Phalcon\Events\ManagerInterface, null returned in Unknown on line 0
@sergeyklay sergeyklay added bug A bug report status: unverified Unverified and removed status: unverified Unverified labels May 3, 2020
@sergeyklay sergeyklay self-assigned this May 3, 2020
@sergeyklay sergeyklay linked a pull request May 3, 2020 that will close this issue
5 tasks
@sergeyklay
Copy link
Contributor Author

Fixed in 4.0.x branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant