You've already forked phpmyadmin
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:
committed by
William Desportes
parent
07c4a73eb0
commit
fcb451d70b
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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'",
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user