You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following docs and setting my app/config/services.php as follows:
/** * Set dispatcher adding UserPlugin (crada/phalcon-user-plugin) */$di->setShared(
'dispatcher',
function () use ($di) {
$eventsManager = $di->getShared('eventsManager');
$security = newSecurityPlugin();
$eventsManager->attach('dispatch', $security);
$dispatcher = newDispatcher();
$dispatcher->setEventsManager($eventsManager);
return$dispatcher;
}
);
/** * Set auth service to UserPlugin/Auth (crada/phalcon-user-plugin) */$di->setShared(
'auth',
function () {
returnnewAuth();
}
);
/** * Set ACL service to UserPlugin/Acl (crada/phalcon-user-plugin) */$di->setShared(
'acl',
function () {
returnnewAcl();
}
);
/** * Set mail service to UserPlugin/Mail (crada/phalcon-user-plugin) */$di->setShared(
'mail',
function () {
returnnewMail();
}
);
Results in exception:
( ! ) Fatal error: Uncaught Error: Call to a member function disable() on null in /var/www/project/vendor/crada/phalcon-user-plugin/lib/Plugin/Security.php on line 115
--
1 | 0.0000 | 399984 | {main}( ) | .../index.php:0
2 | 0.0013 | 432208 | handle ( ) | .../index.php:42
3 | 0.0015 | 453872 | dispatch ( ) | .../index.php:42
4 | 0.0015 | 454336 | fire ( ) | .../index.php:42
5 | 0.0015 | 455344 | fireQueue ( ) | .../index.php:42
6 | 0.0015 | 455792 | Phalcon\UserPlugin\Plugin\Security->beforeDispatchLoop( ) | .../index.php:42
Both the following changes in vendor/crada/phalcon-user-plugin/lib/Plugin/Security.php stopped the fatal error (not a solution, just targets error location):
The text was updated successfully, but these errors were encountered:
ronindesign
changed the title
Fatal exception when disabling view on null in Plugin/Security.php
Fatal exception when disabling view on null in Plugin/Security.php
Jan 28, 2018
The following fix from @mikguo on #27 solved my issue by adding line: $security->setView($di->getShared('view'))->setAuth($di->getShared('auth'));
Resulting in updated app/config/services.php:
/** * Set auth service to UserPlugin/Auth (crada/phalcon-user-plugin) */$di->setShared(
'auth',
function () {
returnnewAuth();
}
);
/** * Set ACL service to UserPlugin/Acl (crada/phalcon-user-plugin) */$di->setShared(
'acl',
function () {
returnnewAcl();
}
);
/** * Set mail service to UserPlugin/Mail (crada/phalcon-user-plugin) */$di->setShared(
'mail',
function () {
returnnewMail();
}
);
/** * Set dispatcher adding UserPlugin (crada/phalcon-user-plugin) */$di->setShared(
'dispatcher',
function () use ($di) {
$eventsManager = $di->getShared('eventsManager');
$security = newSecurityPlugin();
$security->setView($di->getShared('view'))->setAuth($di->getShared('auth'));
$eventsManager->attach('dispatch', $security);
$dispatcher = newDispatcher();
$dispatcher->setEventsManager($eventsManager);
return$dispatcher;
}
);
Following docs and setting my
app/config/services.php
as follows:Results in exception:
Both the following changes in
vendor/crada/phalcon-user-plugin/lib/Plugin/Security.php
stopped the fatal error (not a solution, just targets error location):I noticed
Security::setView
doesn't seem to be called anywhere, so tried changing$this->view->disable()
to$view->disable()
:The text was updated successfully, but these errors were encountered: