CRM-18808 SOAP calls in Drupal result in "Call to undefined method CRM_Utils_SoapServer::getUsersTableName()" error

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      SOAP calls for processing bounces in Drupal result in "Call to undefined method CRM_Utils_SoapServer::getUsersTableName()" error.

      This is occurring due to the following call in CRM/Utils/SoapServer.php on line 125:

      $result =& $className::authenticate($name, $pass, $loadCMSBootstrap);
      

      Which statically calls non-static method "authenticate" on the CRM_Utils_System_Drupal class and where the following code has been added

      $userFrameworkUsersTableName = $this->getUsersTableName();
      

      In this context "$this" becomes an instance of CRM_Utils_SoapServer rather than an instance of CRM_Utils_System_Drupal

      Here are the relevant code changes:

      1. method "authenticate" made non-static:

      https://github.com/civicrm/civicrm-core/commit/17f443df7d2235655cbbfe68bfcf7a13a570b606

      2. "$this->getUsersTableName();" line added:

      https://github.com/civicrm/civicrm-core/commit/348754d5baf83293564406b5770f01edf647b74b

      Proposed fix is to remove the deprecated static call in SoapServer.php and instantiate the Drupal class before calling the "authenticate" method on it:

      Replace line 125:

      $result =& $className::authenticate($name, $pass, $loadCMSBootstrap);
      

      with

      $ufInstance = new $this->ufClass();
      $result =& $ufInstance->authenticate($name, $pass, $loadCMSBootstrap);
      

      All of the other CRM_Utils_System_* cms specific files have the non-static authenticate method so this should work for all though we only tested that this patch works with Drupal.

        Attachments

          Activity

          [CRM-18808] SOAP calls in Drupal result in "Call to undefined method CRM_Utils_SoapServer::getUsersTableName()" error
          KarinG added a comment -

          Hi - thank you for this! Can you please put this into a PR against CiviCRM Core/master so that it can (hopefully) be tested on different CMS-es during review week?

          Eileen McNaughton added a comment -

          Hey Karin,

          Just wondering at what point we should put a version on - my inclination is not to add a version until either a PR is submitted or I'm actually leaning to adding it at the point when the QA team select it as one to review in that month.

          Leyla Alieva added a comment -

          We've never submitted a PR before, is there a certain process we have to follow ?

          Regarding testing, we can help test this if necessary across different CMS.

          KarinG added a comment -

          Hi Leyla - Here's the write-up/wiki for creating a Pull Request: https://wiki.civicrm.org/confluence/display/CRMDOC/Contributing+to+CiviCRM+using+GitHub - if you have any questions please do ask. Thanks for reporting and fixing this!

          Eileen McNaughton added a comment -

          Please set the fix version when there is PR to QA - I've set to unscheduled for now

          Tim Otten added a comment - - edited

          I was writing a unit-test for the SOAP and REST end-points and stumbled onto this bug. The following PR includes both a fix and test (to avoid future regressions):

          https://github.com/civicrm/civicrm-core/pull/8914

          Leyla Alieva added a comment -

          Thank you, Tim!

            People

            • Assignee:
              Unassigned
              Reporter:
              Leyla Alieva

              Dates

              • Created:
                Updated:
                Resolved: