[ticket/17281] Fix return type and ensure type correctness

PHPBB3-17281
This commit is contained in:
Marc Alexander 2023-12-30 20:58:54 +01:00
parent 5d53089651
commit e42b743b86
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -190,7 +190,7 @@ class manager
* @param array $row User data or group data * @param array $row User data or group data
* @param string $prefix Prefix of data keys (e.g. user), should not include the trailing underscore * @param string $prefix Prefix of data keys (e.g. user), should not include the trailing underscore
* *
* @return array{string, string} User or group data with keys that have been * @return array User or group data with keys that have been
* stripped from the preceding "user_" or "group_" * stripped from the preceding "user_" or "group_"
* Also the group id is prefixed with g, when the prefix group is removed. * Also the group id is prefixed with g, when the prefix group is removed.
*/ */
@ -205,7 +205,7 @@ class manager
$output = []; $output = [];
foreach ($row as $key => $value) foreach ($row as $key => $value)
{ {
$key = preg_replace("#^(?:{$prefix}_)#", '', $key); $key = preg_replace("#^(?:{$prefix}_)#", '', (string) $key);
$output[$key] = $value; $output[$key] = $value;
} }