magento2: Catalog Search module search with parenthesis breaks the site.

Preconditions (*)

  1. Magento 2.3.1

Steps to reproduce (*)

  1. Enable Elastic Search
  2. append ‘/catalogsearch/result/?q=%28%28%28%28’ to url. Ex: site.com/catalogsearch/result/?q=%28%28%28%28
  3. The site will return a error.

Expected result (*)

  1. Should not have any errors.

Actual result (*)

2 exception(s): Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42000]: Syntax error or access violation: 1064 syntax error, unexpected $end, query was: SELECT search_synonyms.* FROM search_synonyms WHERE (MATCH (synonyms) AGAINST (‘\(’ IN BOOLEAN MODE)) Exception #1 (PDOException): SQLSTATE[42000]: Syntax error or access violation: 1064 syntax error, unexpected $end

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

Steps to reproduce (*) Enable Elastic Search append ‘/catalogsearch/result/?q=%28%28%28%28’ to url. Ex: site.com/catalogsearch/result/?q=%28%28%28%28 The site will return a error.

The reason why Magento2.3.2 works is because it skips the search when it is less than 3 characters.

Alright. I will look into it. Thanks!