strict warning: Non-static method view – Drupal warning messages – Drupal / PHP 5.4

As E_STRICT is now the part of E_ALL from PHP 5.4 ( Reference ), this warning can pop-up on most systems with Drupal + PHP 5.4 because usually E_ALL is set as the default error reporting for PHP. Also PHP 5.4 is not officially supported by Druapl. Using a supported PHP version also can resolve issues with Drupal views ( Refer for Druapl’s PHP requirements )

Anyway we need to use PHP 5.4 for Druapl and to avoid such warnings to display in the website. Disabling E_STRICT in php.ini didn’t help, because Druapl defines its own error reporting function. So we had to make the following changes to the Druapl core files, as per the information collected from their forum.

1. Open /includes/

In the beginning of function drupal_set_message and  below “if ($message) { ” line, put the following  code

if( !strncmp($message, ‘strict warning:’, 14) ) {
return isset($_SESSION[‘messages’]) ? $_SESSION[‘messages’] : NULL;

2. Open /includes/

In the beginning of function definition drupal_error_handler , put the following code

if ($errno == E_STRICT) { return; }

That should stop the warning messages!



Facebook Comments