Ref #16429 - PHP 8 error on preg_replace

47) PhpMyAdmin\Tests\Setup\ConfigGeneratorTest::testGetConfigFile
TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, int given

libraries/classes/Setup/ConfigGenerator.php:61
test/classes/Setup/ConfigGeneratorTest.php:55
vendor/phpunit/phpunit/phpunit:61

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-11-19 23:24:26 +01:00
parent 723c0095b9
commit cd3a0e46ce
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -58,7 +58,7 @@ class ConfigGenerator
$persistKeys = $cf->getPersistKeysMap();
foreach ($conf as $k => $v) {
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
$k = preg_replace('/[^A-Za-z0-9_]/', '_', (string) $k);
$ret .= self::getVarExport($k, $v, $crlf);
if (! isset($persistKeys[$k])) {
continue;