Hi. I inherited a Perch 2.8.23 implementation and while moving the site from an Ubuntu 16.04 server (PHP 7.0) to an Ubuntu 18.04 server (PHP 7.2), I found a little BUG that stopped us from logging in.
In line 160 of the "/perch/core/lib/PerchAuthenticatedUser.class.php" file, "$data" is defined as a string and the following line it is treated as an array:
Since PHP 7.1, this is no longer allowed. The solution is to change line 160 to:
Refer to https://www.php.net/manual/en/migration71.incompatible.php:
Assignment via string index access on an empty string
String modification by character on an empty string now works like for non-empty strings, i.e. writing to an out of range offset pads the string with spaces, where non-integer types are converted to integer, and only the first character of the assigned string is used. Formerly, empty strings where silently treated like an empty array.
Output of the above example in PHP 7.0:
Output of the above example in PHP 7.1: