Skip to content
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

[11.x] Fix only number as session key will result in numbered session keys #51611

Merged
merged 2 commits into from
May 29, 2024

Conversation

Katalam
Copy link
Contributor

@Katalam Katalam commented May 29, 2024

Will fix #51599

This will happen because array_merge works like

If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended. Values in the input arrays with numeric keys will be renumbered with incrementing keys starting from zero in the result array.

from https://www.php.net/manual/en/function.array-merge.php

As replacement we can use array_replace we have an example here https://www.php.net/manual/en/function.array-merge.php#126628

I normally would add a extra test case, but I found it so small to be given an extra test.

The change will preserve the current functionality but add the ability to add another functionality at the same time

@taylorotwell taylorotwell merged commit 97238d2 into laravel:11.x May 29, 2024
30 checks passed
@Katalam Katalam deleted the array-replace branch May 29, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When the Laravel session key is' 123 ', obtaining data is empty
2 participants