Skip to content

Recent change to config/session.php for cookie name to use Str::snake instead of Str::slug breaks the cookies #56449

@bluedreamer

Description

@bluedreamer

Laravel Version

12.21.0

PHP Version

8.4.10

Database Driver & Version

n/a

Description

This commit breaks cookie setting for the application if there is a period in the APP_NAME

laravel/laravel@dd473ea

Steps To Reproduce

Laravel Installer 5.16.0

  1. laravel new bugreport
  2. No starter kit
  3. composer require livewire/flux
  4. artisan livewire:layout
  5. Add flux blade directives
  6. artisan make:livewire Counter
  7. Add a route: Route::get('/counter', \App\Livewire\Counter::class);
  8. Increment button works nicely
  9. Change APP_NAME to "Laravel.com"
  10. Button breaks with a 419 expired every time

app.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <title>{{ $title ?? 'Page Title' }}</title>
        @vite(['resources/css/app.css', 'resources/js/app.js'])

        @fluxAppearance
    </head>
    <body>
        {{ $slot }}
        @fluxScripts
    </body>
</html>

Counter.php

<?php

namespace App\Livewire;

use Livewire\Component;

class Counter extends Component
{
    public $counter = 0;

    public function increment(): void
    {
        ++$this->counter;
    }

    public function render()
    {
        return view('livewire.counter');
    }
}

counter.blade.php

<div>
    <div class="text-4xl">{{ $counter }}</div>
    <flux:button variant="primary" wire:click="increment">Increment</flux:button>
</div>

web.php

<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/counter', \App\Livewire\Counter::class);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions