Skip to content

Commit 6293168

Browse files
authored
Merge pull request #4441 from Roardom/fix-htmlspecialchars-migration
(Fix) Decoding null user fields in htmlspecialchars_decode migration
2 parents a31e694 + aa6da08 commit 6293168

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: database/migrations/2024_07_03_085223_htmlspecialchars_decode_bbcode.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ public function up(): void
121121
DB::table('users')
122122
->lazyById()
123123
->each(function (object $user): void {
124-
/** @var object{id: int, about: string, signature: string} $user */
124+
/** @var object{id: int, about: ?string, signature: ?string} $user */
125125
DB::table('users')
126126
->where('id', '=', $user->id)
127127
->update([
128-
'about' => htmlspecialchars_decode($user->about),
129-
'signature' => htmlspecialchars_decode($user->signature),
128+
'about' => htmlspecialchars_decode($user->about ?? ''),
129+
'signature' => htmlspecialchars_decode($user->signature ?? ''),
130130
]);
131131
});
132132
}

0 commit comments

Comments
 (0)