Fixed  rc2 feed problem

gamecock

Member
I have a lot of feeds setup. This started showing in the logs today:

It seems to block execution of the other feeds

ErrorException: Undefined index: tag:news.google.com,2005:cluster=http://www2.timesdispatch.com/news/...beamer-willing-to-make-changes-in--ar-863652/ - library/XenForo/Model/Feed.php:367
Generated By: Unknown Account, 12 minutes ago

Stack Trace
#0 /home6/ifootbal/public_html/library/XenForo/Model/Feed.php(367): XenForo_Application::handlePhpError(Array, Array)
#1 /home6/ifootbal/public_html/library/XenForo/Model/Feed.php(493): XenForo_Model_Feed->_checkProcessedEntries(Array)
#2 /home6/ifootbal/public_html/library/XenForo/Model/Feed.php(506): XenForo_Model_Feed->importFeedData()
#3 /home6/ifootbal/public_html/library/XenForo/CronEntry/Feeder.php(15): XenForo_Model_Feed->scheduledImport()
#4 /home6/ifootbal/public_html/library/XenForo/Model/Cron.php(353): XenForo_CronEntry_Feeder::importFeeds(Array)
#5 /home6/ifootbal/public_html/library/XenForo/Cron.php(29): XenForo_Model_Cron->runEntry(Array)
#6 /home6/ifootbal/public_html/library/XenForo/Cron.php(64): XenForo_Cron->run()
#7 /home6/ifootbal/public_html/cron.php(12): XenForo_Cron::runAndOutput()
#8 {main}
Request State
array(3) {
["url"] => string(43) "http://ifootballfan.com/cron.php?1298600290"
["_GET"] => array(1) {
[1298600290] => string(0) ""
}
["_POST"] => array(0) {
}
}
 
I haven't been able to reproduce this. The line numbers are also different in RC3, so I do have to guess a bit about what line is doing it, but I'm pretty sure I see it.

However, I don't see why this is necessarily happening. I see the line, but I'm not sure why it's failing. Can you still reproduce it? (Regardless, I have prevented the error.)
 
rc3

#0 /home6/ifootbal/public_html/library/XenForo/Model/Feed.php(374): XenForo_Application::handlePhpError(Array, Array)
#1 /home6/ifootbal/public_html/library/XenForo/Model/Feed.php(500): XenForo_Model_Feed->_checkProcessedEntries(Array)
#2 /home6/ifootbal/public_html/library/XenForo/Model/Feed.php(513): XenForo_Model_Feed->importFeedData()
#3 /home6/ifootbal/public_html/library/XenForo/CronEntry/Feeder.php(15): XenForo_Model_Feed->scheduledImport()
#4 /home6/ifootbal/public_html/library/XenForo/Model/Cron.php(353): XenForo_CronEntry_Feeder::importFeeds(Array)
#5 /home6/ifootbal/public_html/library/XenForo/Cron.php(29): XenForo_Model_Cron->runEntry(Array)
#6 /home6/ifootbal/public_html/library/XenForo/Cron.php(64): XenForo_Cron->run()
#7 /home6/ifootbal/public_html/cron.php(12): XenForo_Cron::runAndOutput()
#8 {main}
 
So it's still happening to you right now? Can you save a dump of your xf_feed_log table (via phpMyAdmin)? I couldn't reproduce it when I added the feed and I'm not seeing an obvious reason.
 
Its not happening since last night it appears. Something changed about the content I suppose. I had the feed disabled overnight because it was jacking things up. I turned it back on and ran it again without an exception
 
quote="Mike, post: 168485"]I haven't been able to reproduce this. The line numbers are also different in RC3, so I do have to guess a bit about what line is doing it, but I'm pretty sure I see it.

However, I don't see why this is necessarily happening. I see the line, but I'm not sure why it's failing. Can you still reproduce it? (Regardless, I have prevented the error.)[/quote]

Can you give me the code change?
 
library/XenForo/Model/Feed.php. This is in unified diff format, so you remove lines that start with "-" and add lines that start with "+". Lines without either at the beginning on context that you should leave alone.

Code:
         {
             return $feedData;
         }

-        $existing = $this->fetchAllKeyed('
-            SELECT * FROM xf_feed_log
+        $existing = $this->_getDb()->fetchCol('
+            SELECT unique_id
+            FROM xf_feed_log
             WHERE feed_id = ?
                 AND unique_id IN (' . $this->_getDb()->quote(array_keys($ids)) . ')
-        ', 'unique_id', $feed['feed_id']);
-
-        foreach ($existing AS $id => $feedLog)
-        {
-            unset($feedData['entries'][$ids[$id]]);
+        ', $feed['feed_id']);
+
+        foreach ($existing AS $id)
+        {
+            if (isset($ids[$id]))
+            {
+                unset($feedData['entries'][$ids[$id]]);
+            }
         }

         $feedData['entries'] = $this->_limitEntries($feedData['entries'], self::$_maxEntriesPerImport);
 
Top Bottom