Solved: Calendar Plugin Error: Undefined array key "joins" in

Found a bug? Tell us!!
Post Reply
moonchild
Regular
Posts: 201
Joined: Mon Nov 21, 2005 11:23 pm
Location: Esslingen
Contact:

Solved: Calendar Plugin Error: Undefined array key "joins" in

Post by moonchild »

Hi there,

I got

"Warning: Undefined array key "joins" in /home/www/plugins/serendipity_plugin_calendar/serendipity_plugin_calendar.php on line 234"

in Serendipity 2.4-beta1 and PHP 8.0.16

Any hints?

Regards,
Thomas
Last edited by moonchild on Tue Oct 18, 2022 9:22 am, edited 1 time in total.
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Calendar Plugin Error: Undefined array key "joins" in

Post by onli »

So, this works in my test installation. But that could be because of something in my test installation setting that array key, and that not happening in yours.

Are you up for editing that plugin file and testing a patch?

At around line 234 of the file plugins/serendipity_plugin_calendar/serendipity_plugin_calendar.php there is this code block:

Code: Select all

if (!isset($querystring)) {
    $querystring = "SELECT id, timestamp
                      FROM {$serendipity['dbPrefix']}entries e
                      {$cond['joins']}
                      {$cond['and']}";
}
change it to this:

Code: Select all

if (!isset($querystring)) {
    if (! array_key_exists('joins', $cond)) {
        $cond['joins'] = '';
    }
    $querystring = "SELECT id, timestamp
                      FROM {$serendipity['dbPrefix']}entries e
                      {$cond['joins']}
                      {$cond['and']}";
}
Save the file, reload the blog and this warning should be gone.

Alternatively you can also hide warnings like this by enabling production mode. This would happen automatically when 2.4 gets a stable release, you can active it yourself by adding

Code: Select all

$serendipity['production'] = true;
to your serendipity_config_local.inc.php.
moonchild
Regular
Posts: 201
Joined: Mon Nov 21, 2005 11:23 pm
Location: Esslingen
Contact:

Re: Calendar Plugin Error: Undefined array key "joins" in

Post by moonchild »

Hello Onli,
thanks, that solved the problem with this plugin, I made the change in the plugin that you suggested.

Regards,
Thomas
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Solved: Calendar Plugin Error: Undefined array key "joins" in

Post by onli »

Then I will add this to the code in general.
Post Reply