There is an bug within the "filter module".
I always get the following error message:
----
warning: Invalid argument supplied for foreach() in /var/www/htdocs/drupal-5.5/modules/filter/filter.module on line 927.
-----

My "drupal" installation is a standard 5.5 installation. Server: Apache 2.2.3, PHP 5.2.0.

I found the bug:

within the function "theme_filter_tips" in ..../modules/filter/filter.module (around line 927) there is the "foreach" loop

foreach ($tips as $name => $tiplist)

6 Lines beneath the foreach (within the loop) the variable "tips" is made empty and is then used to hold the "tipstring".

$tips = '';
foreach ($tiplist as $tip) {
        $tips .= '<li'. ($long ? ' id="filter-'. str_replace("/", "-", $tip['id']) .'">' : '>') . $tip['tip'] . '</li>';
      }

The solution:

Use "$tipString" within the loop to hold the output string and do not use the "tips" variable for that.

Regards

CommentFileSizeAuthor
#1 20080112.filter-tips-php-520.patch1.02 KBBart Jansens
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bart Jansens’s picture

Status: Active » Needs review
FileSize
1.02 KB

Apparently this is only an issue in some php versions, I wasn't able to reproduce it. But the code is ugly non the less.

Patch attached that uses a second variable with a different name.

drumm’s picture

Status: Needs review » Fixed

I committed a straight backport from Drupal 6, which has solved this issue with slightly different code.

Status: Fixed » Closed (fixed)

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