Align framework and skeleton app config for session cookie name: use slug not snake for fallback - #61128
Open
imgrant wants to merge 1 commit into
Open
Align framework and skeleton app config for session cookie name: use slug not snake for fallback#61128imgrant wants to merge 1 commit into
imgrant wants to merge 1 commit into
Conversation
Contributor
Author
|
Haha, my bad, I thought I was clever, finding the original issue guess I didn't search hard enough! 😖 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR mirrors the skeleton app config file, which changed
slug()→snake()in laravel/laravel@dd473ea, but was reverted a few weeks later in laravel/laravel@902200e.The skeleton app config and framework config should show similar behaviour because they are merged; removing a default skeleton app config should not change the behaviour. The framework should move to use
slug()to derive the session cookie name (whenSESSION_COOKIEis not set), notsnake(), because the latter does not fully strip punctuation that are not valid cookie names (:,., etc). The Laravel 13.x upgrade documentation also showsslug()to be in use here.Note, the framework
slug()→snake()change was introduced in #56172, with the commit message "UseStr::snake()as intended". Issue #60569 was opened about this very same discrepancy but was closed without a PR, with rationale that changes to the framework could be breaking, whereas changes to the skeleton only affect new installations.So, feel free to reject this PR if you see fit, but my reading is that the adoption of
snake()is the breaking change — prior to mid-2025, the framework (and skeleton) usedslug()here. In 2025, this was changed tosnake()in both framework and skeleton, arguably breaking the framework (due to the afore-mentioned potential for illegal cookie names to result), before being reverted in the skeleton only a few weeks later.I hit this issue while trying to slim down my app configs — I removed a local
config/session.php(which hadslug()), thinking I was repeating the framework config.Essentially, if you created a new app using the skeleton before July 2025, it wouldn't have mattered if you kept the app's
config/session.phpor adopted the framework. For three weeks in July, if you created a new app from the skeleton, removing the app'sconfig/session.phpcould was also fine, even though both could result in illegal cookie names. Since then, creating an app from the skeleton gives valid cookie names (usesslug()), but removing the app'sconfig/session.phpcould break the behaviour (and could result in illegal cookie names).Given the docs describe using
slug(), and the fact that, essentially, carryingsnake()forward in the framework forever means apps should (must) always maintain their local definition (in order to useslug()), which stands in contrary to the streamlined config merging introduced with Laravel 11 (at least, to my thinking, but again, willing to accept rejection on this).