Skip to content

Invalid Argument Warning in feedwordpress.php:2126 (v2024.1119) #162

@fl0om

Description

@fl0om

PHP Warning: Invalid argument supplied for foreach() in /wp-content/plugins/feedwordpress/feedwordpress.php on line 2126

This warning repeats multiple times in the logs, suggesting that the same issue is occurring repeatedly during execution.

It appears that an invalid argument (likely null or another non-iterable type) is being passed to a foreach loop on line 2126 of feedwordpress.php. foreach expects an array or an object that implements Traversable.

Suggestion:

It would be helpful if the plugin could include a check before using foreach, such as:

if (is_array($var) || is_object($var)) {
    foreach ($var as $item) {
        // ...
    }
}

This would prevent the warning from appearing and help ensure smoother execution.

Current system configuration:

  • WordPress version: 6.8.1
  • PHP version: 7.3.31
  • Web server: nginx/1.14.2
  • Database: MariaDB 10.3.39

I recognize that my environment is slightly outdated, and I plan to update PHP and other components soon. However, I wanted to report this issue in case the plugin could benefit from an additional safeguard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions