CampaignChain / campaignchain

CampaignChain Community Edition
Other
119 stars 51 forks source link

Firts Login Error #458

Open gmlemus opened 6 years ago

gmlemus commented 6 years ago

Hello guys.

I run the first installation, however when i perform the first login i get the following error:

in InstallVoter.php line 49 at ErrorHandler->handleError('2', 'get_class() expects parameter 1 to be object, null given', '/var/www/html/campaignchain/campaignchain/vendor/campaignchain/core/Security/Authorization/Voter/InstallVoter.php', '49', array('token' => object(UsernamePasswordToken), 'object' => null, 'attributes' => array('IS_AUTHENTICATED_REMEMBERED'))) at get_class(null) in InstallVoter.php line 49 at InstallVoter->vote(object(UsernamePasswordToken), null, array('IS_AUTHENTICATED_REMEMBERED')) in classes.php line 2896 at AccessDecisionManager->decideUnanimous(object(UsernamePasswordToken), array('IS_AUTHENTICATED_REMEMBERED'), null) in classes.php line 2823 at AccessDecisionManager->decide(object(UsernamePasswordToken), array('IS_AUTHENTICATED_REMEMBERED'), null) in classes.php line 2951 at AuthorizationChecker->isGranted(array('IS_AUTHENTICATED_REMEMBERED')) in LoginListener.php line 80 at LoginListener->setLocale(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) at call_user_func(array(object(LoginListener), 'setLocale'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) in WrappedListener.php line 61 at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) in classes.php line 1871 at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in classes.php line 1786 at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in TraceableEventDispatcher.php line 140 at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in HttpKernel.php line 125 at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 64 at HttpKernel->handle(object(Request), '1', true) in ContainerAwareHttpKernel.php line 69 at ContainerAwareHttpKernel->handle(object(Request), '1', true) in Kernel.php line 185 at Kernel->handle(object(Request)) in app_dev.php line 23 at require('/var/www/html/campaignchain/campaignchain/web/app_dev.php') in router_dev.php line 40

Any ideas?

hutchic commented 6 years ago

I think the problem is the following lines in both of the security voters https://github.com/CampaignChain/core/blob/master/Security/Authorization/Voter/DevVoter.php#L48-L50

        if (!$this->supportsClass(get_class($object))) {
            return VoterInterface::ACCESS_ABSTAIN;
        }

should be along these lines

        if ($object===null || !$this->supportsClass(get_class($object))) {
            return VoterInterface::ACCESS_ABSTAIN;
        }