Skip to content

Commit

Permalink
[PHP 8.2] Fix deprecated ${var} string interpolation patterns (#42520)
Browse files Browse the repository at this point in the history
PHP 8.2 deprecates string interpolation patterns that place the
dollar sign outside the curly braces. This fixes such patterns
by replacing them with proper curly braced patterns.

Fixes `Illuminate\Cookie\Middleware\EncryptCookies::validateArray()`
This is so far the only such occurrence.

Reference:
 - [PHP.Watch: `${var}` string interpolation deprecated](https://php.watch/versions/8.2/$%7Bvar%7D-string-interpolation-deprecated)
 - [wiki.php.net RFC](https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation)
  • Loading branch information
Ayesh authored May 26, 2022
1 parent 2ca86f9 commit cc23b2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Cookie/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function validateArray(string $key, array $value)
$validated = [];

foreach ($value as $index => $subValue) {
$validated[$index] = $this->validateValue("${key}[${index}]", $subValue);
$validated[$index] = $this->validateValue("{$key}[{$index}]", $subValue);
}

return $validated;
Expand Down

0 comments on commit cc23b2e

Please sign in to comment.