따옴표 내의 빼기 기호는 의미를 부여하지 않도록 수정

This commit is contained in:
Min-Soo Kim 2020-12-25 18:20:44 +09:00
parent 8e48abd0db
commit e86b2ec311

View file

@ -445,6 +445,10 @@ class VariableBase
// flag to mark transformed quotation mark.
$escaped_quot = false;
// flag to mark escaped hypen in the quotation block
$escaped_hyphen = false;
// parse the value (text);
if (strpos ($value, '"') !== false)
{
@ -471,6 +475,10 @@ class VariableBase
if (strlen($item) > 2 && (substr($item, 0, 1) === substr($item, -1)) && substr($item, -1) === '"')
{
$item = substr($item, 1, -1);
if (substr($item, 0, 1) === '-')
{
$escaped_hyphen = true;
}
}
elseif (strlen($item) > 3 && (substr($item, 0, 1) === '-') && (substr($item, 1, 1) === substr($item, -1)) && substr($item, -1) === '"')
{
@ -507,7 +515,7 @@ class VariableBase
}
else
{
if (substr($item, 0, 1) === '-')
if (substr($item, 0, 1) === '-' && $escaped_hyphen !== true)
{
$conditions[] = sprintf('%s NOT LIKE ?', $column);
$item = substr($item, 1);
@ -516,7 +524,7 @@ class VariableBase
{
$conditions[] = sprintf('%s LIKE ?', $column);
}
$params[] = '%' . str_replace(['\\', '_', '%'], ['\\\\', '\_', '\%'], $item) . '%';
$params[] = '%' . str_replace(['\\', '_', '%', '-'], ['\\\\', '\_', '\%', '\-'], $item) . '%';
// if there is no operator, assume 'AND'
$conditions[] = 'AND';
}