8000 bug #33814 [HttpFoundation] Check if data passed to SessionBagProxy::… · symfony/symfony@e7f7041 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7f7041

Browse files
bug #33814 [HttpFoundation] Check if data passed to SessionBagProxy::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
2 parents fb5f8fb + 38782bc commit e7f7041

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ protected function loadSession(array &$session = null)
430430

431431
foreach ($bags as $bag) {
432432
$key = $bag->getStorageKey();
433-
$session[$key] = isset($session[$key]) ? $session[$key] : [];
433+
$session[$key] = isset($session[$key]) && \is_array($session[$key]) ? $session[$key] : [];
434434
$bag->initialize($session[$key]);
435435
}
436436

0 commit comments

Comments
 (0)
0