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
Comment #1
ibnkhaldun CreditAttribution: ibnkhaldun commentedI 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...
Comment #2
ibnkhaldun CreditAttribution: ibnkhaldun commentedcomment 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
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
Comment #3
BerkeleyJon CreditAttribution: BerkeleyJon commentedThis seems to duplicate #465332: Strict warning: non-static method view::load() should not be called statically , which has a patch fixing these same problems.
Comment #4
ibnkhaldun CreditAttribution: ibnkhaldun commentedthx a lot. I've read it. This is a duplicated issue!
Comment #5
ibnkhaldun CreditAttribution: ibnkhaldun commentedSee comment #3