Missing $serendipity['smarty']?

Found a bug? Tell us!!
Post Reply
greenwayg
Regular
Posts: 34
Joined: Wed Jan 02, 2008 8:25 pm

Missing $serendipity['smarty']?

Post by greenwayg »

Hi,

I am occasionally getting an error in my s9y installation. The error log says:

Code: Select all

[Sun Jan 23 14:50:13 2011] [error] [client 1.2.3.4] PHP Fatal error:  Call to a member function assign() on a non-object in /var/www/htdocs/vhost/mydomain/serendipity/plugins/serendipity_event_picasa/serendipity_event_picasa.php on line 485, referer: http://www.mydomain.com/serendipity/index.php?/archives/2011/01/22/429-pagetitle.html
The offending line is:

Code: Select all

$serendipity['smarty']->assign(get_class($this).'_albumName',      $albumName);
This fatal error causes a blank page to show up in my web browser. But if I refresh, it works fine, the page loads correctly, and there is no error in the log. Is this a bug in the plugin? Can $serendipity['smarty'] sometimes not exist? Is there something I need to do to cause it to exist before using it in the plugin?

thanks,
greg
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Missing $serendipity['smarty']?

Post by garvinhicking »

Hi!

Do you use any cachcing plugins, and/or PHP bytecode caches like APC?

Your problems to me sounds a bit like some misbehaving cache...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
greenwayg
Regular
Posts: 34
Joined: Wed Jan 02, 2008 8:25 pm

Re: Missing $serendipity['smarty']?

Post by greenwayg »

Nope, no caches that I'm aware of. Just a stock php5/apache server. It's very low-traffic, so I've never given a second thought to performance.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Missing $serendipity['smarty']?

Post by Timbalu »

I remember having this sometimes in special functions in event plugins too and I solved it adding a

Code: Select all

        if (!is_object($serendipity['smarty'])) { 
            serendipity_smarty_init(); // if not set to avoid member function assign() on a non-object error, start Smarty templating
        }
just at the start of that function.

Ian
greenwayg
Regular
Posts: 34
Joined: Wed Jan 02, 2008 8:25 pm

Re: Missing $serendipity['smarty']?

Post by greenwayg »

Timbalu wrote:I remember having this sometimes in special functions in event plugins too and I solved it adding a

Code: Select all

        if (!is_object($serendipity['smarty'])) { 
            serendipity_smarty_init(); // if not set to avoid member function assign() on a non-object error, start Smarty templating
        }
just at the start of that function.

Ian
I was wondering if it was something along those lines. I'll give that snippet a try and see if that fixes it. I never figured out exactly what the reproduce case is for the bug, so I'll just go with this for a few days/weeks and see if I run into the problem again.

Thanks!
greg
Post Reply