CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Search Builder breaks on string searches
Pages: [1]

Author Topic: Search Builder breaks on string searches  (Read 920 times)

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Search Builder breaks on string searches
March 09, 2012, 09:42:06 am
Using the Search Builder to search certain string fields breaks it.

The fields that break the Search Builder include City, Email and Postal Code. When a '=' or 'LIKE' search is performed on any of these fields, the string literal being searched for is not quoted in generated query, which causes an SQL syntax error. Instead of a search results page, the user gets an error page which says "Sorry. A non-recoverable error has occurred." and "DB Error: syntax error".

Putting single or double quotes around the value being searched for does not work as the Search Builder prevents the value from being quoted by automatically escaping the quotes with backslashes. The result is the same - an unquoted string literal in the generated query that causes a fatal SQL syntax error.

This error can be recreated on the Drupal 7 CiviCRM 4.1 demo site:
http://drupal.demo.civicrm.org/civicrm/contact/search/builder
Just go to the Search Builder, select record type Individual, select the field City, select the operator '=' and enter 'London' in the value box (quoted or unquoted) and then click the Search button.

The error does not occur with all string fields. For example, it does not occur when searching on First Name or Display Name. The Search Builder allows values to be quoted for those fields.

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Search Builder breaks on string searches
March 21, 2012, 10:31:34 am
Please can an administrator post a reply to this? It seems to me that CiviCRM's Search Builder is broken in quite a serious way. Can someone confirm this? I can't see this issue on the Issue Tracker. Should I add it? Thanks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search Builder breaks on string searches
March 21, 2012, 11:03:28 am

The search builder code is currently on "life support" and is not being maintained actively. Yes, we do agree it is quite important and cool and needed, but we dont have the time/energy/resources to maintain it.

If you are interested in being the maintainer, fix bugs and add more features please ping us on IRC and we can help you get started

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search Builder breaks on string searches
July 28, 2012, 09:30:16 am

This and a few other search builder issues are being addressed and fixed for 4.3 thanx to support from the NYSS

You can potentially backport the patch from:

http://issues.civicrm.org/jira/browse/CRM-10567

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Search Builder breaks on string searches
August 29, 2012, 03:18:21 am
Great, thanks, I'll look forward to that. Sorry I didn't have time to work on it myself.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Search Builder breaks on string searches

This forum was archived on 2017-11-26.