1

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!


The code for SimplePie is unaltered and is version 1.2.1. I have a page /app/design/frontend/default/default/template/page/html/blog.phtml which has the following code.
<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.

Greg Demetrick
  • 759
  • 1
  • 12
  • 28
  • Can you post the relevant source? SimplePie doesn't use any Zend component, so the version you have must be a customised version. – Ryan McCue Jan 18 '12 at 15:35
  • I just checked SimplePie.inc and it was a dev version of 1.2.1. I just updated it to the current version but am getting the same results. I will add how I have the delivery happening in the main question. – Greg Demetrick Jan 18 '12 at 16:17
  • The only thing on [line 738](https://github.com/simplepie/simplepie/blob/one-dot-two/simplepie.inc#L738) in SimplePie is the instantiation of `SimplePie_Sanitize`, so this must be coming from somewhere else. (Also, 1.2.1 has been released, so 1.2.1-dev is out of date) – Ryan McCue Jan 18 '12 at 16:31

1 Answers1

1

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).

Ryan McCue
  • 1,628
  • 14
  • 23
  • So here is the REALLY weird thing. If I add trigger_error() to the blogs.phtml page that loads, neither an error is created nor does the code kick up a problem. PHP is at version 5.3.8 but it does point to a setup issue and not your code at all. Thanks for putting your mind to this! – Greg Demetrick Jan 18 '12 at 18:46
  • Does removing it create the same problem again? It could have simply been a flush of the opcode cache that helped there. (Maybe your host did something weird and it's still loading the cache) – Ryan McCue Jan 19 '12 at 02:14
  • Yes, removing it causes the same problem again. I wouldn't be surprised if my host turned off opcode and didn't flush it's cache. – Greg Demetrick Jan 19 '12 at 14:34
  • Double-check with your host and see if they can find any errors in their configuration. Replace the `trigger_error()` with something like `echo ' ';` just to make sure the opcodes are changed and see if it still occurs. Also, try adding a `restore_error_handler()` just before you do `new SimplePie()` and see if that helps with anything. – Ryan McCue Jan 20 '12 at 03:46