diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 7b97adbb7b..7cdc9d45de 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -2858,7 +2858,7 @@ class Util */ public static function convertBitDefaultValue($bit_default_value) { - return rtrim(ltrim(htmlspecialchars_decode($bit_default_value, ENT_QUOTES), "b'"), "'"); + return preg_replace("/^b'(\d*)'?$/", '$1', htmlspecialchars_decode($bit_default_value, ENT_QUOTES), 1); } /** diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 9a59e97d8f..1cbc942a86 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -483,6 +483,22 @@ class UtilTest extends PmaTestCase "b'010111010'", "010111010", ], + "database name starting with b" => [ + "big database", + "big database", + ], + "database name containing b'" => [ + "a b'ig database", + "a b'ig database", + ], + "database name in single quotes" => [ + "'a*database*name'", + "'a*database*name'", + ], + "database name with multiple b'" => [ + "b'ens datab'ase'", + "b'ens datab'ase'", + ], ]; }