Wednesday, June 19, 2013

php strict warnings | Drupal Groups

php strict warnings | Drupal Groups:

Thanks, forcing 5.2 worked.

Disabling warnings from php strict in Drupal

DarrellDuane's picture
I'm well aware that hacking core is frowned upon, but sometimes ya gotta do what ya gotta do. Running drupal 6 with views 2.x using PHP 5.4 (Fedora 17 in this case) yields a number of strict warnings that are not easily turned off. PHP doesn't allow you to turn off these strict warnings in its php.ini file, they come through even if E_STRICT is disabled, see
http://stackoverflow.com/questions/4692999/e-strict-messages-thrown-thou... for more details.
In order to fix this, I have edited includes/bootstrap.inc and put the following at the beginning of function drupal_set_message starting after line 991:
// filter out strict warnings due to conflicts between views-2.x and PHP 5.4
if( !strncmp($message, 'strict warning:', 14) ) {
return isset($_SESSION['messages']) ? $_SESSION['messages'] : NULL;
}
There may be other messages that come through that you want to filter in this manner as well.
If there is a hook that can be used to filter drupal messages or a cleaner way to do this by adding a module instead of hacking core I'd love to hear about it.
Post a Comment