Oops, it's version 6.x-1.13

Hi there,

My host upgraded to PHP5.4 and now I have message like this

# strict warning: Only variables should be passed by reference in ../sites/all/themes/zeropoint/template.php on line 382

Anyway to mute these messages?

Thanks

Comments

ynohtna’s picture

Version: 6.x-1.3 » 6.x-1.13
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.

florian’s picture

You can safely comment lines 380-383 in template.php.

darrellduane’s picture

@Florian, Which theme are you referring to ? Each theme has a different template.php. Also, the solution I offered still allows other warnings to come through, I believe the solution you mention turns off all error messages.

florian’s picture

You should comment this lines:

  if ($vars['teaser'] && isset($vars['taxonomy'])) {
    foreach ($vars['taxonomy'] as $taxonomy_id_string => $term_info) {
      $taxonomy_id = array_pop(explode('_', $taxonomy_id_string));
      $node_classes[] = 'tag-'. $taxonomy_id;  
Elastic’s picture

Priority: Normal » Minor
Status: Active » Fixed

Thank you to DarrelDuane for his very useful post which helped me to fix the problem on my website.
I understand it is naughty to break the core code of Drupal : shouldn't it be done by at this level by Drupal designers in a new release ?

darrellduane’s picture

Hi Elastic,
Thanks for your kind words. Yes, in theory it'd be nice for the core developers to make fixes to the code to solve these problems. But in order to maintain the integrity of the project, and to avoid problems that come with making a product work under all circumstances, its important to draw boundaries and limit the scope of a product. Drupal 6 was never designed to work with PHP 5.4 and now that Drupal 7 is released and Drupal 8 is under development, Drupal 6 is in a "feature freeze" where enhancements such as this won't be done, and Drupal 6 will only formally support up to PHP 5.3.

Elastic’s picture

Hi Darrell,

Thanks for your answer and I agree all along with your statements.
Then, it makes me thinking of pushing my website forward to Drupal 7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Made mistake on version