Page 1 of 1

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

Posted: Sun Oct 16, 2022 2:57 pm
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

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

Posted: Mon Oct 17, 2022 4:04 pm
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.

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

Posted: Tue Oct 18, 2022 9:15 am
by moonchild
Hello Onli,
thanks, that solved the problem with this plugin, I made the change in the plugin that you suggested.

Regards,
Thomas

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

Posted: Tue Oct 18, 2022 3:36 pm
by onli
Then I will add this to the code in general.