• Resolved vitoralmeida

    (@vitoralmeida)


    Hello all, thanks for this incredible plugin!
    Reviewing server logs, we found several php notices about “Trying to access array offset on value of type null” on autoptimizeImages class.

    In our production server we block all external connections and make some exceptions and the service used to fetch status (https://misc.optimizingmatters.com/api/autoptimize_service_availablity.json?from=aomain&ver=) ins’t in this whitelist (and cant be because infrastructure restrictions)

    At ./autoptimize/classes/autoptimizeCriticalCSSSettings.php line 255/256 (//// warn if service is down.) your code tests the condition of autoptimize_service_availablity, to prevent invalid array access.

    It’s possible to do the same thing at this point ./autoptimize/classes/autoptimizeImages.php line 204/205 ?

    see the error reporting at Query Monitor https://i.imgur.com/WXTV4Ge.jpg

    Thanks in advanced :)`

    • This topic was modified 3 years, 4 months ago by vitoralmeida.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    that should be fixed in the beta, feel free to download it from https://github.com/futtta/autoptimize/archive/refs/heads/beta.zip and install that instead of 2.9.2 to test/ confirm ??

    frank

    Thread Starter vitoralmeida

    (@vitoralmeida)

    Hey Frank!

    Thanks for your very fast response and solution.
    I tested locally and everything going nice now, but i can’t use this code because our project is based on composer dependencies (including wp plugins, throuthg https://packagist.org/ and https://wpackagist.org/), considering that i will wait for oficial release.

    Before open this topic, i did this code, and contrasting to yours i set the status to down, because this domains are blocked too. What you think about this difference?

    
    add_filter('pre_option_autoptimize_service_availablity', function() {
            return [
                'extra_imgopt' => [
                    'status'           => 'down',
                    'hosts'            => [
                        1 => 'https://cdn.shortpixel.ai/'
                    ],
                    'launch-threshold' => '4096'
                ],
                'critcss'      => [
                    'status' => 'down',
                    'hosts'  => [
                        1 => 'https://criticalcss.com/'
                    ]
                ]
            ];
    });
    
    • This reply was modified 3 years, 4 months ago by vitoralmeida.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Although that likely works great for your use case, I can’t assume that others that might nave issues getting the service status are not using criticalcss/ image optimization ??

    frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Notice with WP_HTTP_BLOCK_EXTERNAL enable’ is closed to new replies.