I installed and activated views on a test site, just updated to D6.29.
Then i got this warning message:
strict warning: Non-static method view::load_views() should not be called statically in /home/user/lampstack-5.4.11-0/apache2/htdocs/herramientasd6/sites/all/modules/views/views.module on line 864.

I reviewed drupal code looking for a solution. I found the call

<?php
    // First, get all applicable views.
    views_include('view');
    $views = view::load_views();
?>

points to a class member method located at "sites/all/modules/views/includes/view.inc" and defined at line 1395 as

<?php
 // ... "sites/all/modules/views/includes/view.inc" line 1395
  function load_views() {
    $result = db_query("SELECT DISTINCT v.* FROM {views_view} v");
    $views = array();
    $vids = array();

    // Load all the views.
   //...
}
?>

I changed the method declaration to

<?php
 // ... "sites/all/modules/views/includes/view.inc" line 1395
public static function load_views() { // patched declaration
    $result = db_query("SELECT DISTINCT v.* FROM {views_view} v");
    $views = array();
    $vids = array();

    // Load all the views.
   //...
?>
}

And stop reciving warning messages.
I guess It was posible I found a couple of similar calls in the module; perform a text search for "::" and found another static call to a non static declared method, and patched it in the same way:

 // ... "sites/all/modules/views/includes/view.inc" line 1342
/**
   * Load a view from the database based upon either vid or name.
   *
   * This is a static factory method that implements internal caching for
   * view objects.
   *
   * @param $arg
   *  The name of the view or its internal view id (vid)
   * @param $reset
   *  If TRUE, reset this entry in the load cache.
   * @return A view object or NULL if it was not available.
   */
  function &load($arg, $reset = FALSE) { // non static declaration called as static from views.module line 907
// ...
}

// the  static call is performed as
// views.module line 907
function views_get_view($name, $reset = FALSE) {
  views_include('view');
  $view = view::load($name, $reset); // the call
  //..

I've patched both calls and works on my test site. I can't know if it is a good enough solution. So dicided to open an issue report.

Comments

ibnkhaldun’s picture

I read a similar issue a few minutes ago. (see Multiple php errors "Declaration of views...") I've noted It's possible the problem is php version related. I' had my test site running over php 5.4.11. I'll test over a prior php version, so can get idea...

ibnkhaldun’s picture

comment on signatures

Before creating a new site over php 5.3.3 I reviewed View's code and found a signatures difference, not easy to fix

<?php
// Declaration of init() method at /.../views/includes/handlers.inc 's line 237
class views_handler extends views_object {
  // ...
  function init(&$view, $options){ }
}

// Declaration of init() method at /.../views/handlers/views_handler_argument.inc 's line 48
class views_handler_argument extends views_handler {
  // ...
  function init(&$view, &$options) {
    parent::init($view, $options);
  }
}
?>

Note: (&$view, &$options) !== (&$view, $options) &$options !== $options so we have a fall of trouble views_handler_argument claims to modify &$options while her brothers ...

The solution has 3 questions TODO

  1. Change the init() 's definition at views_handler
  2. found the family extending it (all descendents, and check wherther or not is necesary to change the signature
  3. What about contributed modules extending or implementing views_handler ?
BerkeleyJon’s picture

This seems to duplicate #465332: Strict warning: non-static method view::load() should not be called statically , which has a patch fixing these same problems.

ibnkhaldun’s picture

thx a lot. I've read it. This is a duplicated issue!

ibnkhaldun’s picture

Status: Active » Closed (duplicate)

See comment #3