0

嗨,有人可以帮我吗?我得到了所有 PHP 站点的失败:

代码是通过 Joomla 3.4.1 中的插件“NoNumber Sourcerer”插入的

bool(false) Warning: Invalid argument supplied for foreach() in /var/www/admin/libraries/class.System.php on line 117.

这是第 117 行class.system.php

foreach ($result as $entry) {
    $modulePath = dirname(__FILE__) . '/../modules/' . $entry['DirectoryName'] . '/';

    if (is_dir($modulePath) && $entry['DirectoryName'] != '.' && $entry['DirectoryName'] != '..') {
        if (is_file($modulePath . 'index.php')) {
                require_once $modulePath . 'index.php';

                $class = new ReflectionClass($entry['Class']);

                $module = $class->newInstance();

                $this->modules[] = $module;

                foreach ($module->getActions() as $action) {
                    $this->moduleMappings[$action] = $module;
                }

                if ($entry['IsDefault'] != 0) {
                    //print_R($module);
                    $this->defaultModule = $module;
                }
            }
        }
    }
}
4

1 回答 1

0

尝试检查是否$result有值并使用 -

if($result != NULL && is_array($result)) {
    foreach ($result as $entry) {
         // your conditions
    }
}
于 2015-03-24T12:05:02.137 回答