Exif error when updating to 3.9.4

I recently updated a website I’m working on to Kirby 3.9.4 and faced an error when trying to resize or get the proportion of an image in PHP. This problem only occurs when on my server which is running on PHP 8.2, when running the website locally everything is smooth.

Here is the error message:

claviska\SimpleImage::getExif(): Return value must be of type ?array, bool returned

Surprisingly enough, refreshing the page after the error seems to fix it once and for all, but only on the refreshed page. I’m really not sure what I should do about it, refreshing every single one of the pages would just be too much of a hassle and don’t feel reliable.

Thank you in advance
Noé Gogniat <3

Do you have a stack trace?

Are you using any plugins that call this method?

Seems to be a bug by the SimpleImage library: getExif(): Return value must be of type ?array, bool returned · Issue #323 · claviska/SimpleImage · GitHub
Maybe we can patch fix this on our side and/or contribute to a PR so it’s fixed on their end.

Here are the stack traces:

The code creating the issue is the following:

if($page->template() == 'news-article'): 
        $page_image = $page->main_image()->toFile();
        $twitter_image_thumb = [
            'width'   => 1200,
            'height'  => 675,
            'quality' => 80,
            'crop'    => true
        ];
        $og_image_thumb = [
            'width'   => 1200,
            'height'  => 630,
            'quality' => 80,
            'crop'    => true
        ];
    ?>
    <?php if($page_image != null) ?><meta id="schema_image" itemprop="image" content="<?= $page_image->url() ?>">
    <?php if($page_image != null) ?><meta property="og:image" content="<?= $page_image->thumb($og_image_thumb)->url() ?>">
    <?php if($page_image != null) ?><meta property="og:image:width" content="<?= $page_image->thumb($og_image_thumb)->width() ?>">
    <?php if($page_image != null) ?><meta property="og:image:height" content="<?= $page_image->thumb($og_image_thumb)->height() ?>">
    <?php if($page_image != null) ?><meta name="twitter:image" content="<?= $page_image->thumb($twitter_image_thumb)->url() ?>">

I’m using one plugin MetaKnight which calls the method yes, but it doesn’t calls it on the problematic pages.

SimpleImage has released a new version that fixes this issue. We will try to include this in Kirby 3.9.5 (to be released sometime later this week).