slimphp / Slim-Skeleton

Slim Framework 4 Skeleton Application
http://www.slimframework.com
MIT License
1.59k stars 478 forks source link

String interpolation syntax in ViewUserAction is deprecated in PHP 8.2 #320

Closed hochleitner closed 1 year ago

hochleitner commented 1 year ago

ViewUserAction.php uses the syntax ${userId} to interpolate a variable in a string when sending an info message to the logger. This has been deprecated in PHP 8.2 and will therefore lead to a deprecation notice on PHP 8.2 systems.

Steps to reproduce

Using PHP 8.2, call the one of the following routes:

Output (with Xdebug installed):

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/Slim-Skeleton/src/Application/Actions/User/ViewUserAction.php on line 19

Solution

Change ${userId} to {$userId}. This will also work in PHP versions < 8.2.

I will open a PR with the change.