Commit 62fdaeec by Klimov Paul

Extra quote escaping at `yii\sphinx\Connection::escapeMatchValue()` fixed

parent adb36e42
......@@ -138,10 +138,11 @@ class Connection extends \yii\db\Connection
*/
public function escapeMatchValue($str)
{
return addslashes(str_replace(
['/', '"', "'", '(', ')', '|', '-', '!', '@', '~', '&', '^', '$', '=', "\x00", "\n", "\r", "\x1a"],
['\\/', '\\"', "\\'", '\\(', '\\)', '\\|', '\\-', '\\!', '\\@', '\\~', '\\&', '\\^', '\\$', '\\=', "\\x00", "\\n", "\\r", "\\x1a"],
$str = str_replace(
['\\', '/', '"', "'", '(', ')', '|', '-', '!', '@', '~', '&', '^', '$', '=', "\x00", "\n", "\r", "\x1a"],
['\\\\', '\\/', '\\"', "\\'", '\\(', '\\)', '\\|', '\\-', '\\!', '\\@', '\\~', '\\&', '\\^', '\\$', '\\=', "\\x00", "\\n", "\\r", "\\x1a"],
$str
));
);
return str_replace('\\', '\\\\', $str);
}
}
......@@ -281,7 +281,7 @@ class QueryTest extends SphinxTestCase
$query = new Query;
$rows = $query->from('yii2_test_article_index')
->match('about"@^')
->match('about\"')
->all($connection);
$this->assertNotEmpty($rows);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment