Hello,
I'd like to know if the whereFulltext() function in the QueryBuilder is safe with user content. I am doing some testing, and I am receiving "syntax error" exceptions from the DB, for example, if I enter "+a*)" as search term I get this:
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 syntax error, unexpected ')', expecting $end in .../site/vendor/illuminate/database/Connection.php on line 712
( ! ) Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1064 syntax error, unexpected ')', expecting $end (SQL: select `someval` from `data` where match (`firstname`, lastname`) against (+a*) in boolean mode)) in .../site/vendor/illuminate/database/Connection.php on line 712
I am using it like this:
$results = Capsule::table('paper')
->select('someval')
->whereFullText('searchabletext', $query, ['mode' => 'boolean'])
->get();
I am not using full Laravel, only the QueryBuilder through the Capsule.
Is this safe, and I just need to catch the exception? The docs state that "There is no need to clean or sanitize strings passed to the query builder as query bindings."...