We have been using SimplePie on our Magento install to pull our blog posts into our home page without issue for several months now. Due to some other issues with Magento, we had our web host turn off opcode in APC. Once we did that, the next hourly update of SimplePie stopped the loading of the home page and returns the following error in Apache:
[Wed Jan 18 09:59:57 2012] [error] PHP Fatal error: Class 'Zend_Log' not found in {server root}/lib/SimplePie/simplepie.inc on line 738
I am at a bit of a loss on what is happening and what to do to fix it. SimplePie is delivered as a banner/widget so if I put it on a different category page I get the same results. (Page stops at SimplePie command) I was hoping it would be something simple like the change is forcing the old chached RSS to remain and can not be modified but I am not sure.
Any help would be very appreciated!
<div class="col-narrow right sidebar-blog">
<h2>Our Gardening Blog</h2>
<?php
// Make sure SimplePie is included. You may need to change this to match the location of
require_once('lib/SimplePie/simplepie.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
// Set which feed to process.
$feed->set_feed_url('http://blog.americanmeadows.com/feed/');
// Run SimplePie.
$feed->init();
// This makes sure that the content is sent to the browser as text/html and the UTF-8
$feed->handle_content_type();
/*
Here, we'll loop through all of the items in the feed, and $item represents the
current item in the loop.
*/
foreach ($feed->get_items(0,2) as $rss_item):
?>
<div class="article-teaser">
<p><span><?php echo $rss_item->get_date('F j, Y'); ?></span></p>
<h2 class="article-title"><a href="<?php echo $rss_item->get_permalink(); ?>"><?php echo $rss_item->get_title(); ?></a></h2>
<?php if ($rss_item->get_item_tags('', 'thumbnail')) {$thumbnail = $rss_item->get_item_tags('', 'thumbnail'); echo "<img src='" . $thumbnail[0]['data'] . "'>"; } ?>
<p><?php echo $rss_item->get_description(); ?> <a class="more" href="<?php echo $rss_item->get_permalink(); ?>" target="_blank">Continue Reading</a></p>
</div>
<?php endforeach; ?>
</div>
I then have a banner which calls only the following
{{block type="page/html" template="page/html/blog.phtml"}}
I include that banner in the left column widget on our home page to have it display.
The lines in SimplePie is throwing the error is
function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
{
// Other objects, instances created here so we can set options on them
$this->sanitize =& new SimplePie_Sanitize; /* Error is thrown here */
// Set options if they're passed to the constructor
if ($cache_location !== null)
{
$this->set_cache_location($cache_location);
}
I think that is what you need but am happy to post more.
My only thought here is that somewhere something is setting Zend_Log
as an error logger. Check for set_error_handler()
in your code and see if that's being registered anywhere. (You could double check that by causing an error yourself with trigger_error()
and seeing what happens.)
As for why the error is occurring, I'd hazard a guess at that being because you're using 1.2.1 with PHP 4, which will give E_DEPRECATED
errors when assigning new by reference (such as on that line).