• Resolved Goddamn Noise

    (@goddamnnoise)


    Hi

    I’m developing a new site and today it crashed a few times. Looking at the server logs I see this warning a lot of times (probably one time per each image on my site):

    PHP message: PHP Warning: Undefined array key 1 in …/wp-content/plugins/ultimate-addons-for-gutenberg/lib/zipwp-images/classes/zipwp-images-api.php on line 471

    Looking at the zipwp-images-api.php file, it seems you should check if the explode() function returns something before using it in the get_image_dimensions() function.

    I’m using Spectra 2.19.25 and I’m not using ZipWP, so I don’t know why Spectra is calling that lib.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support BSF – Ravi Gojiya

    (@ravigojiya)

    Hi @goddamnnoise,

    Thanks for the detailed report and the analysis you have already done.

    I checked the code on our side, and you are correct. On line 471 of zipwp-images-api.php, the function calls explode() and reads index [1] without first checking that the URL actually contains a question mark. When an image URL comes through without a query string, explode() returns only one element, so reading the second one produces the warning you are seeing.

    About your other question, the ZipWP image library is a built-in part of Spectra. When Spectra is active, it adds a Stock Images option inside the WordPress Media Library that lets you search and insert images from sources like Pexels directly. That is why this code runs in the background even when you are not actively using ZipWP, and it is also why every Spectra installation has this file present.

    This has been confirmed as a valid bug on our side, and a fix is already being worked on. It will be included in an upcoming Spectra release.

    On the crashes you mentioned, a plain PHP warning of this type should not normally bring a site down, so the actual crash may be coming from a different source. If you can share the fatal error message from the logs along with the steps that led to it, we will be happy to look into that as well.

    Have a great day ahead!

    Thread Starter Goddamn Noise

    (@goddamnnoise)

    Hi Ravi,

    Thanks for fixing the bug in the next release and for the explanation.

    I’ll share here the details of the crash if the site crashes again and I think it is related with this problem.

    Have the same issue, fix within zipwp-images-api.php up until it is updated, exchange the public function get_image_dimensions function with this version:

    public function get_image_dimensions( $url ) {
    $clean_url = esc_url_raw( $url );

    // Query-Teil sicher extrahieren
    $query = wp_parse_url( $clean_url, PHP_URL_QUERY );

    if ( empty( $query ) || ! is_string( $query ) ) {
    return array(
    ‘width’ => ”,
    ‘height’ => ”,
    );
    }

    parse_str( $query, $query_params );

    return array(
    ‘width’ => isset( $query_params[‘w’] ) ? sanitize_text_field( (string) $query_params[‘w’] ) : ”,
    ‘height’ => isset( $query_params[‘h’] ) ? sanitize_text_field( (string) $query_params[‘h’] ) : ”,
    );
    }

    Plugin Support BSF – Ravi Gojiya

    (@ravigojiya)

    Hi @goddamnnoise,

    You are very welcome, and thank you for the kind reply.

    That sounds great. If the site does crash again and you suspect it is related to this, please share the fatal error message from the logs along with anything you noticed leading up to it. We will be happy to dig into it and figure out what is going on from there.

    Have a nice day ahead!

    Plugin Support BSF – Ravi Gojiya

    (@ravigojiya)

    Hi @mmeid72,

    Thank you for jumping in and sharing your suggested fix. We really appreciate the time you have taken to help the community.

    One small note for anyone reading this thread, we generally do not recommend editing plugin files directly. Any change made inside the plugin folder will be overwritten the next time Spectra is updated, and it can also cause unexpected behavior during future releases.

    The good news is that our development team has already picked this up. A pull request to address the issue inside zipwp-images-api.php is being raised at the moment, and the proper fix will ship in an upcoming Spectra release. That way you will be able to update normally and have everything resolved without any manual changes to the plugin files.

    In the meantime, if the warnings are filling up your debug log, you can keep WP_DEBUG turned on while setting WP_DEBUG_DISPLAY to false inside wp-config.php. That way, entries are still captured for review, but they will not show up on the front end for visitors.

    Have a wonderful day ahead!

    Plugin Support BSF – Ravi Gojiya

    (@ravigojiya)

    Hi @goddamnnoise and @mmeid72,

    Good news! We have released a proper fix for this in Spectra Free v2.19.26. Please update the plugin, and the warnings in your server logs should stop.

    @mmeid72, thanks for sharing the manual fix in the meantime. That was helpful for anyone who needed an immediate workaround before the update landed.

    Please update to v2.19.26 and let us know if everything looks good on your end. If so, could you mark this topic as Resolved? That helps other users with the same issue find the solution faster.

    Have a nice day ahead!

    Thread Starter Goddamn Noise

    (@goddamnnoise)

    Hi again, Ravi,

    I’ve updated the plugin and the problem seems to be fixed.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.