Support » Plugin: Open Graphite » Many alerts in logs

  • Resolved lekiend

    (@lekiend)


    Hello,

    Using your plugin, I have tons of Notice alerts in my logs.
    Maybe a good idea to correct your source code ?

    [STDERR] PHP Notice:  Trying to access array offset on value of type bool in /public/wp-content/plugins/open-graphite/_open_graphite.php on line 458
    [STDERR] PHP Notice:  Trying to access array offset on value of type bool in /public/wp-content/plugins/open-graphite/_open_graphite.php on line 459
    [STDERR] PHP Notice:  Trying to access array offset on value of type bool in /public/wp-content/plugins/open-graphite/_open_graphite.php on line 460
    [STDERR] PHP Notice:  Trying to access array offset on value of type bool in /public/wp-content/plugins/open-graphite/_open_graphite.php on line 549
    [STDERR] PHP Notice:  Trying to access array offset on value of type bool in /public/wp-content/plugins/open-graphite/_open_graphite.php on line 550
    [STDERR] PHP Notice:  Trying to access array offset on value of type bool in /public/wp-content/plugins/open-graphite/_open_graphite.php on line 551

    You could solve this adding ?? '' behind your array values

    Like this

    $full_image = wp_get_attachment_image_src( $image_ID, $size = 'full', $icon = false);
    $full_image_URL = $full_image[0] ?? '';
    $full_image_width = $full_image[1] ?? '';
    $full_image_height = $full_image[2] ?? '';
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Michael Ott

    (@mikeyott)

    Thanks @lekiend

    Interesting. My PHP error logs aren’t complaining about that, but from what I just researched I absolutely should be seeing the same notice in PHP 7.4 (which is what I am running on production, but no complaints on my local development in PHP 7.2 either which is expected).

    Anyhoo, I’ll take a look.

    Cheers.

    Plugin Author Michael Ott

    (@mikeyott)

    @lekiend

    All sorted in v 1.4.3. Have a great day.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.