php - Symfony/Silex SecurityServiceProvider: Serialization of 'Closure' is not allowed -
i follow [silex securityserviceprovider][1]
[1]: http://silex.sensiolabs.org/doc/providers/security.html step step, when submit login form, got error:
exception in abstracttoken.php line 154: serialization of 'closure' not allowed
i don't know error comes from... use same code exemple:
controller:
$app->get('/login', function(request $request) use ($app) { return $app['twig']->render('login.twig', array( 'error' => $app['security.last_error']($request), 'last_username' => $app['session']->get('_security.last_username'), )); });
view:
<form action="{{ path('connexion') }}" method="post"> {{ error }} <input type="text" name="_username" value="{{ last_username }}" /> <input type="password" name="_password" value="" /> <input type="submit" /> </form>
the first lines of error:
in abstracttoken.php line 154 @ splobjectstorage->serialize() @ serialize(array(object(user), true, array(object(role)), array())) in abstracttoken.php line 154 @ abstracttoken->serialize() in usernamepasswordtoken.php line 96 @ usernamepasswordtoken->serialize() @ serialize(object(usernamepasswordtoken)) in contextlistener.php line 129 @ contextlistener->onkernelresponse(object(filterresponseevent), 'kernel.response', object(traceableeventdispatcher)) @ call_user_func(array(object(contextlistener), 'onkernelresponse'), object(filterresponseevent), 'kernel.response', object(traceableeventdispatcher)) in wrappedlistener.php line 61 @ wrappedlistener->__invoke(object(filterresponseevent), 'kernel.response', object(eventdispatcher)) @ call_user_func(object(wrappedlistener), object(filterresponseevent), 'kernel.response', object(eventdispatcher)) in eventdispatcher.php line 174
thanks help
i solved problem implements \serializable.
class user extends entity implements userinterface, \serializable {
according doc
http://symfony.com/doc/current/cookbook/security/entity_provider.html
Thank you for sharing this informative post. looking forward to reading more.
ReplyDeleteBest PHP Development Services