Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11184

PHP notice undefined variable "quillUnits" when using proximity search with "km" units

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.4
    • Fix Version/s: 4.2.5
    • Labels:
      None

      Description

      I created a simple proximity-search-enabled profile, then used that profile form to search for contacts (restricted to a group, but I don't think that's part of the issue). When I select "km" for distance units, I get the following notice on the results page (same notice repeated twice):

      Notice: Undefined variable: qillUnits in CRM_Contact_BAO_ProximityQuery::process() (line 327 of /Applications/MAMP/htdocs/mysite/sites/all/modules/civicrm/CRM/Contact/BAO/ProximityQuery.php).

      I get the same notice (only once) if I click 'map these contacts' on the results list.

      The results list appears to be correct - if I edit the search criteria units to "miles" I get more results - and no PHP notices.

      I couldn't reproduce on the (Drupal 7) demo sandbox site, probably because warnings and notices are being suppressed.

      The solution seems to be to change line 327 of ProximityQuery.php to use "=" instead of ".=" in the "else" branch. When I do so, all notices go away. I just want to confirm that there's another reason for the concatenation operator in this instance that I haven't fathomed. the main branch of the same if..then..else uses the straight assignment operator in the case of "miles", so it appears that there's nothing to concatenate onto in the "else" branch.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              chiebert Craig Hiebert
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: