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

PHP Notice when adding premiums to contribution pages and more generally when using Rest client requests to CRM_Financial_Page_Ajax.php

    Details

      Description

      The CiviCRM Financial component defines its REST functions in the page CRM_Financial_Page_Ajax.php.

      These functions are then invoked through:
      return call_user_func(array($params['className'], $params['fnName']), $params);

      https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/REST.php#L331

      This syntax assumes that the functions of the Ajax.php pages are static but most are not static even in the core file. Therefore we receive a notice:
      "Strict warning: call_user_func() expects parameter 1 to be a valid callback, non-static method CRM_Financial_Page_AJAX::jqFinancialType() should not be called statically in CRM_Utils_REST::process() (line 329 of /var/www/myhost/sites/all/modules/civicrm/CRM/Utils/REST.php)."

      It looks like the syntax should either be changed or the methods such as jqFinancialType should be declared static.

      $class = new $params['className'];
      return call_user_func(array($class, $params['fnName']), $params);

      http://stackoverflow.com/questions/273169/how-do-i-dynamically-invoke-a-class-method-in-php/273176#273176

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              lola_slade Lola Slade
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: