1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-28 07:41:55 +03:00

Tests added for convertBitDefaultValue. Consider valid database names with single quotes. Change regex to only replace if digits between b'..'

Signed-off-by: Corey Buckley <coreybuckley13@gmail.com>
This commit is contained in:
corey buckley
2020-01-25 13:49:26 -05:00
committed by William Desportes
parent 07c4a73eb0
commit fcb451d70b
2 changed files with 17 additions and 1 deletions

View File

@@ -2858,7 +2858,7 @@ class Util
*/
public static function convertBitDefaultValue($bit_default_value)
{
return preg_replace("/^b'(.*?)'?$/s", '$1', htmlspecialchars_decode($bit_default_value, ENT_QUOTES), 1);
return preg_replace("/^b'(\d*)'?$/", '$1', htmlspecialchars_decode($bit_default_value, ENT_QUOTES), 1);
}
/**

View File

@@ -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'",
],
];
}