php - Symfony session avoid _sf2_attributes -
apparently every key save symfony2 session goes under subkey:
$session->set('foo', 'bar');
will result in:
array('_sf2_attributes' => array('foo' => 'bar'));
this problem because i'm building application interacts legacy code. want use symfony's session handler want old parts of app able read $_session
. in other words, want
$session->set('foo', 'bar');
and
$_session['foo'] = 'bar';
to have same effect.
i didn't see configuration option achieve this. use specific session handler set to
session: handler_id: my_app.session_handler
so won't problem symfony uses different session name. solution can think of creating new session handler class around customer session handler (my_app.session_handler
) checks if application tries access _sf2_attributes
think it's extremely ugly , i'm not sure if work.
thanks!
this not handler have implement on own, should sessionstorage
.
by default, symfony2 uses nativesessionstorage
. should looking method loadsession()
. can see, initializes session $key
received getstoragekey()
, initialized _sf2_attributes
here - in attributebag
let me know if have problems injecting custom session storage.
Comments
Post a Comment