Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

codjt's avatar

My Session flash bugs WTF

Hello,

I have a bugs with Session flash I have the same blade template for message and i include this in my layout notif.blade.php

 @if(Session::has("success"))
     <div class="alert alert-success">{{ Session::get("success") }}</div>
 @endif

@if($errors->any())
   <div class="alert alert-danger">
       <ul>
           @foreach($errors->all() as $error)
               <li>{{ $error }}</li>
           @endforeach
       </ul>
   </div>
@endif

it's works fine for 3 controllers results, when a i create,update,delete, it's ok i see my text result but i don't know why in my 4 controllers the session flash "success" have data but the view is empty

I explain

 public function update($id,Request $request, MotifRequest $motifRequest)
    {
        $motif = Motif::findOrFail($id);
        $motif->update($request->all());
        Session::flash('success', 'Modification réalisée avec succès sur le motif');
        return redirect(route("admin.motif.edit", $id));
    }

In the debugbar the session exist with letter 'b' before data, very strange ?!!?

  
      "success" => b"Modification réalisée avec succès sur le motif"
  

In the view, the if Session::has("success") return true but i see just the css bootstrap success

<div class="alert alert-success"></div>

Do you have idea ?

0 likes
1 reply
codjt's avatar
codjt
OP
Best Answer
Level 1

I find the problem's, the text was paste in ISO and my file was in utf-8...i convert text in utf-8

No problem's now

Please or to participate in this conversation.