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
SessionBagProxy::initialize() must be of the type array, string given #33769
Comments
to me, we don't need to support this use case
I suppose that's when you hint the issue? Can you give more details? How can we reproduce it? |
BTW, PR welcome :) |
this is just a way to a 100% reproduction without waiting sessions to expire. in my use case I'm migrating a legacy app to Symfony, exactly like Prestashop does it. I already provided a
Okay. 👍 |
…initialize is an array (mynameisbogdan) This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #33814). Discussion ---------- [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #33769 <!-- prefix each issue number with "Fix #", if any --> | License | MIT <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> If `$_SESSION['_sf2_attributes']` is set to a string, `SessionBagProxy::initialize` will throw an error since it's argument is type-hinted as array. So this change is to check before if the data to be passed is truly an array. Commits ------- 38782bc [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array
Symfony version(s) affected: v4.3.4, 4.4.x-dev
Description
When
_sf2_attributes
or_sf2_meta
is set to a string the following error occurs:Argument 1 passed to Symfony\Component\HttpFoundation\Session\SessionBagProxy::initialize() must be of the type array, string given, called in vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 460
To force the reproduction I used
$_SESSION['_sf2_attributes'] = '';
, but it seems to happen when the session expires too.How to reproduce
Possible Solution
Updating NativeSessionStorage::loadSession to check first if is an array?
The text was updated successfully, but these errors were encountered: