Skip to content

Commit

Permalink
Merge branch 'old' into 22.x
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed May 16, 2023
2 parents e31541a + a8ca706 commit 7bc4988
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boot/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function old(?string $key, bool $escape = true) : mixed
{
App::session()->activate();
$data = App::request()->getRedirectData($key);
if ($escape) {
if ($data !== null && $escape) {
$data = is_scalar($data) || (is_object($data) && method_exists($data, '__toString'))
? esc((string) $data)
: '';
Expand Down
1 change: 1 addition & 0 deletions tests/boot/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function testOld() : void
'xss' => '<script>alert("xss")</script>',
]);
App::session()->stop();
self::assertNull(old('unknown'));
self::assertSame('', old('user'));
self::assertSame('John Doe', old('user[name]'));
self::assertSame(
Expand Down

0 comments on commit 7bc4988

Please sign in to comment.