Skip to content

Error binding parameters in MatchExpression #106

@evgen84

Description

@evgen84

What steps will reproduce the problem?

The problem appears only in case parameter contains \ as last symbol. Seems it's in the
yii\sphinx\MatchBuilder::parseParams(). When changing preg_replace() to str_replace() it works but it seems it's not correct to use str_replace() based on comment:

// $model extends \yii\sphinx\ActiveRecord
$value = '543524\\';
$data = $model::find()
        ->match(new MatchExpression(['title' => $value]))
        ->all();

What's expected?

result set

What do you get instead?

Exception 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: ...unexpected $end near

Additional info

Q A
Yii version 2.0.14.2
Yii Sphinx version 2.0.11
Sphinx server version 2.2.10
PHP version 7.0.31
Operating system ubuntu16.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions