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 Drupal Modules (Moderator: Donald Lobo) »
  • Strict warning: Non-static method CRM_Utils_System civicrm.views.inc
Pages: [1]

Author Topic: Strict warning: Non-static method CRM_Utils_System civicrm.views.inc  (Read 677 times)

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Strict warning: Non-static method CRM_Utils_System civicrm.views.inc
December 11, 2013, 02:36:27 pm
Hi,

I'm receiving the following error many, many times per minute from drupal log:

TYPE   php
DATE   Wednesday, December 11, 2013 - 22:31
USER           class_admin
MESSAGE   Strict warning: Non-static method CRM_Utils_System::href() should not be called statically in CRM_Utils_System::href() (line 140 of /home/class/public_html/sites/all/modules/civicrm/drupal/modules/views/civicrm.views.inc).
SEVERITY           debug

Clearly its points towards the civicrm.views.inc  The code at that line is as follows:

Code: [Select]
/**
 * Return link to CiviCRM path
 *
 * @param $text
 *
 * @param $path
 *
 * @param $query
 *
 * @return String path to CiviCRM
 */
function civicrm_views_href($text, $path, $query) {
  civicrm_initialize();
  require_once 'CRM/Utils/System.php';
  return CRM_Utils_System::href($text, $path, $query);
}


Anyone got any ideas or pointers?
www.ulearnschool.com

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Strict warning: Non-static method CRM_Utils_System civicrm.views.inc
December 11, 2013, 11:24:59 pm
This is a strict warning, and it probably means you are using PHP 5.4 or higher, whilst part of CiviCRM is still based on PHP 5.3. Strict means that you are checking all the rules as strictly as possbile. A warning does mean that you are breaking some of the PHP rules, but the program still does what it is supposed to do.
If you Google on 'hiding strict errors in Drupal' you are bound to get some pointers on how to suppress these errors? Alternatively, fix the issues in the CiviCRM code and you will be terribly loved within the community  ;D

In this case the function civicrm_views_href in a static way whilst it is not a static function. Changing it to:
Code: [Select]
static function civicrm_views_href($test, $path, $query) {will probably make the warning disappear.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Re: Strict warning: Non-static method CRM_Utils_System civicrm.views.inc
December 12, 2013, 04:39:59 am
Hey Erik,

Thanks for getting back! Yep - I got the suppression solution / workaround alright. In Drupal I found the disable_messages module, which I think does that job.

The developers over at OOSeed tell me this issue has been seen to. Here is code in case in anyone is interested....

   /CRM/Utils/System.php

Code: [Select]
-  function href($text, $path = NULL, $query = NULL, $absolute = TRUE,
+ static function href($text, $path = NULL, $query = NULL, $absolute = TRUE,
    $fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE

www.ulearnschool.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Strict warning: Non-static method CRM_Utils_System civicrm.views.inc

This forum was archived on 2017-11-26.