PDA

View Full Version : Invalid argument supplied for foreach() in functions_prefix.php on line 133


postcd
10-13-2019, 06:13 AM
Hello,

anyone also found this PHP error in the vbulletin 4.x error log?

Invalid argument supplied for foreach() in /includes/functions_prefix.php on line 133

I am having 4.2.5 and PHP 5.6.40

$ grep foreach functions_prefix.php
foreach ($restrictions AS $usergroup)
foreach ($prefixsets AS $prefixsetid => $prefixes)
foreach ($prefixes AS $prefixid => $prefix)
foreach ($valid_prefix_sets AS $prefixset)
foreach ($prefixset AS $prefixid => $prefix)

I checked the StackOverflow topic "Invalid argument supplied for foreach() (https://stackoverflow.com/questions/2630013/invalid-argument-supplied-for-foreach)" but not sure how i should adjust above foreach lines. Any idea please?

One answer was:
foreach ((array) $items as $item) {
// ...
}

So i tried replacing:
foreach ($
by:
foreach ((array) $
resulting in:
$ grep foreach functions_prefix.php
foreach ((array) $restrictions AS $usergroup)
foreach ((array) $prefixsets AS $prefixsetid => $prefixes)
foreach ((array) $prefixes AS $prefixid => $prefix)
foreach ((array) $valid_prefix_sets AS $prefixset)
foreach ((array) $prefixset AS $prefixid => $prefix)

is that right, or how better do it please?