Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MagpieRSS throws unhandled error when no internet connection is available #6138

Closed
modxbot opened this issue Nov 26, 2011 · 2 comments
Closed
Labels
bug The issue in the code or project, which should be addressed. type-frontend Issues related to UI/UX issues, mostly about styles and frontend implementations on JavaScript.

Comments

@modxbot
Copy link
Contributor

modxbot commented Nov 26, 2011

everettg_99 created Redmine issue ID 6138

To reproduce this, try turning off your internet connection and running a local version of 2.2.0-rc1. Log into the manager and so long as the default dashboard is displaying, this error gets thrown:

[2011-11-23 00:01:32] (ERROR @ /Users/everett2/Sites/revo/html/core/model/modx/xmlrss/rssfetch.class.php : 237) User warning: MagpieRSS: Failed to fetch http://feeds.feedburner.com/modx-announce (HTTP Error: connection failed () [2011-11-23 00:01:32] (ERROR @ /Users/everett2/Sites/revo/html/manager/controllers/default/dashboard/widget.modx-news.php : 28) PHP warning: array_keys() expects parameter 1 to be array, null given [2011-11-23 00:01:32] (ERROR @ /Users/everett2/Sites/revo/html/manager/controllers/default/dashboard/widget.modx-news.php : 28) PHP warning: Invalid argument supplied for foreach() [2011-11-23 00:01:32] (ERROR @ /Users/everett2/Sites/revo/html/core/model/modx/xmlrss/rssfetch.class.php : 237) User warning: MagpieRSS: Failed to fetch http://feeds.feedburner.com/modxsecurity (HTTP Error: connection failed () [2011-11-23 00:01:32] (ERROR @ /Users/everett2/Sites/revo/html/manager/controllers/default/dashboard/widget.modx-security.php : 25) PHP warning: array_keys() expects parameter 1 to be array, null given [2011-11-23 00:01:32] (ERROR @ /Users/everett2/Sites/revo/html/manager/controllers/default/dashboard/widget.modx-security.php : 25) PHP warning: Invalid argument supplied for foreach()

Looks like some of the code there should handle the inputs in the event that no internet connection is available.

Not sure if error is always thrown, but it definitely was popping up sometimes.

@modxbot
Copy link
Contributor Author

modxbot commented May 31, 2013

everettg_99 submitted:

A couple changes seem to have fixed this:

manager/controllers/default/dashboard/widget.modx-news.php line 28 - 34:

            if (is_object($rss)) {
                foreach (array_keys($rss->items) as $key) {
                    $item= &$rss->items[$key];
                    $item['pubdate'] = strftime('%c',$item['date_timestamp']);
                    $o[] = $this->getFileChunk('dashboard/rssitem.tpl',$item);
                }
            }

manager/controllers/default/dashboard/widget.modx-security.php:

modx->loadClass('xmlrss.modRSSParser','',false,true);
        $this->rss = new modRSSParser($this->modx);
        $o = array();
        $url = $this->modx->getOption('feed_modx_security');
        $newsEnabled = $this->modx->getOption('feed_modx_security_enabled',null,true);
        if (!empty($url) && !empty($newsEnabled)) {
            $rss = $this->rss->parse($url);
            if (is_object($rss)) {
                foreach (array_keys($rss->items) as $key) {
                    $item= &$rss->items[$key];
                    $item['pubdate'] = strftime('%c',$item['date_timestamp']);
                    $o[] = $this->getFileChunk('dashboard/rssitem.tpl',$item);
                }   
            }   
        }   
        return implode("\n",$o);
    }   
}
return 'modDashboardWidgetSecurityFeed';

model/modx/xmlrss/rssfetch.class.php line 190:

                elseif ( $resp->status == '0' ) {
                     // you sir, are offline
                     return false;
                 }

@opengeek
Copy link
Member

opengeek commented Jun 4, 2013

opengeek submitted:

thanks for patch Everett -- will be in 2.2.8

enigmatic-user pushed a commit to enigmatic-user/revolution that referenced this issue Feb 13, 2014
Merge remote-tracking branch 'fireproofsocks/master' into bug-6138

* fireproofsocks/master:
  Fixed offline problem described in http://tracker.modx.com/issues/6138
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed. type-frontend Issues related to UI/UX issues, mostly about styles and frontend implementations on JavaScript.
Projects
None yet
Development

No branches or pull requests

2 participants