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 box autocomplete broken after upgrade
Pages: [1] 2

Author Topic: Search box autocomplete broken after upgrade  (Read 1484 times)

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Search box autocomplete broken after upgrade
January 21, 2015, 06:13:46 am
I have searched the forums for this problem and tried the various 'fixes' to no avail.
Upgraded my Joomla 2.5.28 installation from 4.4.x to 4.5.5 without problem.
All search boxes (not only upper left) are broken as I try to lookup a contact for relationship/registration/etc.

Here is the request URL:
https://mysite.org/administrator/?option=com_civicrm&task=civicrm/ajax/rest&entity=contact&action=getquick&json=%7B%22name%22%3A%22webb%22%2C%22field_name%22%3A%22%22%2C%22table_name%22%3A%22cc%22%7D

Here is the console message:
{"is_error":1,"0":"error_message","1":"Unable to decode supplied JSON."}

Can anyone point me in the right direction?

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Search box autocomplete broken after upgrade
January 21, 2015, 08:53:55 am
That's the exact same error message Lynx got in http://forum.civicrm.org/index.php/topic,35456.msg150680.html#msg150680
I wonder if there's something odd about how Joomla decodes url strings? Just a guess. Would be great if you two put your heads together since it seems to be the same problem.
Try asking your question on the new CiviCRM help site.

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Re: Search box autocomplete broken after upgrade
January 21, 2015, 11:47:29 am
I have another site still on 4.4.3 (that still works) and the encoded string looks different than 4.5.5:

Request URL:
http://mysite.com/administrator/?option=com_civicrm&task=civicrm/ajax/rest&className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=navigation&s=keith&limit=10&timestamp=1421869409302&fieldName=&tableName=cc

Did the encoding method change since 4.4.3?

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Search box autocomplete broken after upgrade
January 21, 2015, 11:55:21 am
Yes, in 4.5 it switched to using json.
Try asking your question on the new CiviCRM help site.

lynx

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: Joomla 2
  • MySQL version: 5.5.40
  • PHP version: 5.3.29
Re: Search box autocomplete broken after upgrade
January 21, 2015, 01:33:27 pm
Well, what I did to fix it was to stick:
Code: [Select]
$params = json_decode(str_replace('\\','',$requestParams['json']), TRUE);around line 422 in REST.php, ie manually stripping the extra escapes.

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Re: Search box autocomplete broken after upgrade
January 21, 2015, 03:20:27 pm
Thanks Lynx, that did the trick and I'm back in business  ;D

But as you mentioned in your email, it doesn't address why it's needed but I'm happy to have a workaround for now.

Coleman, is there any harm to include the modification in core? 

Keith

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Search box autocomplete broken after upgrade
January 21, 2015, 06:40:31 pm
I think we will need to accommodate for the extra slashes in core, but need to do a bit more investigation into why exactly they are there and what to do about it.
I believe we have a similar workaround implemented for WP: https://github.com/civicrm/civicrm-wordpress/blob/master/civicrm.php#L1153
So if this problem is specific to Joomla then perhaps the above is also the solution.
Try asking your question on the new CiviCRM help site.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Search box autocomplete broken after upgrade
January 22, 2015, 06:38:28 am
Mysteriously the problem is not present in a stock Joomla install, e.g. http://joomla.demo.civicrm.org/ you can see all the ajax working fine.
I also just asked a long-time Civi/Joomla user for his input and he said he's never run across this issue.
So what would be really helpful is if you two were able to pinpoint what's different about your Jooma installs vs our demo site.
Try asking your question on the new CiviCRM help site.

lynx

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: Joomla 2
  • MySQL version: 5.5.40
  • PHP version: 5.3.29
Re: Search box autocomplete broken after upgrade
January 22, 2015, 06:43:31 am
Like I already noted, demo is at joomla 3.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Search box autocomplete broken after upgrade
January 22, 2015, 07:01:12 am
Ok I think the next steps would probably be to:
  • Install J2.5 and J3 side-by-side on the same server (to eliminate other variables) and verify that Joomla version # is the culprit here
  • Fashion a patch that checks Joomla version and strips slashes from the url as necessary
Anyone want to take that on?
Try asking your question on the new CiviCRM help site.

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Re: Search box autocomplete broken after upgrade
January 22, 2015, 09:09:23 am
I have a site on 2.x that I need to migrate, I'll dupe in on my development server and examine in parallel.

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Re: Search box autocomplete broken after upgrade
January 22, 2015, 05:39:30 pm
Process:
1. Install J2.5.x and J3.3.x on same server
2. Install fresh CiviCRM 4.5.5 within each environment
3. Test autocomplete in J2.5.x ==> failed
4. Test autocomplete in J3.3.x ==> failed

After fresh install of J3.3.x, admin screen advised to disable "magic_quotes_gpc" for this version of Joomla!
Eureka!

1. Disabled "magic_quote_gpc" in both J2.5.x and J3.3.x environments
2. Test autocomplete in J2.5.x ==> pass
3. Test autocomplete in J3.3.x ==> pass

I used these instructions noted on the Joomla! docs:
https://docs.joomla.org/How_to_turn_off_magic_quotes_gpc_for_Joomla_3

J3.x checks for this condition at install but J2.5.x does not, and will not since support ended 12/31/14.  Perhaps this check should be added as part of CiviCRM installation?


Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Search box autocomplete broken after upgrade
January 23, 2015, 08:03:37 am
Well done planetwebb! Karma points!

Ok so the server configuration is indeed the problem, as we suspected. I don't know too much about this particular php setting but it would be good to find out if it only affects Joomla (in that case we should add it to our joomla installer) or if it's a general problem. My guess is the former because I've never heard of it affecting D or WP but the below is pure speculation:

  • Joomla: Accepts the setting, from 3.0+ the installer prompts you to disable it.
  • Drupal: Overrides the setting and forces it to "off"?
  • Wordpress: Overrides the setting and forces it to "on"?

Can anyone confirm the above guesses?
Try asking your question on the new CiviCRM help site.

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Re: Search box autocomplete broken after upgrade
January 23, 2015, 12:14:23 pm
Joomla:  Since most sites will migrate away from 2.5.x due to (lack) of support, and this issue was introduced moving to json, we could add this requirement in the installation notes for Joomla 2.5.x

Drupal:  Looks like Drupal manages:
https://www.drupal.org/taxonomy/term/33804

Wordpress:  No experience

"magic_quote_gpc" has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
http://php.net/manual/en/security.magicquotes.disabling.php
http://php.net/manual/en/security.magicquotes.php

lynx

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: Joomla 2
  • MySQL version: 5.5.40
  • PHP version: 5.3.29
Re: Search box autocomplete broken after upgrade
January 24, 2015, 06:10:43 am
I can confirm that disabling that option solved it for me (with my hack reverted). I just appened "magic_quotes_gpc = Off" to administrator/php.ini .

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Search box autocomplete broken after upgrade

This forum was archived on 2017-11-26.