• Resolved ceitechllc

    (@ceitechllc)


    Hello,

    I am getting (on average) roughly 42 lines of PHP Notice logs added to our ‘*.error.log’ file every time Autoptimzize attempts to do something. The error log dump looks as follows, with our local directory removed:

    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390
    [21-Mar-2019 16:12:17 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize/classes/autoptimizeExtra.php on line 390

    Within “autoptimizeExtra.php”, on line 389:

    $indiv_srcset_parts = explode( ‘ ‘, trim( $indiv_srcset ) );

    I can see the empty value, but as this is apart of your core code, I’d like your help for addressing this error. The error dump files are getting excessively large as this block of ~42 lines gets added every couple of hours.

    The entire code block in “autoptimizeExtra.php”, on lines 376 thru 400:

    // extract img tags.
    if ( preg_match_all( ‘#<img[^>]*src[^>]*>#Usmi’, $in, $matches ) ) {
    foreach ( $matches[0] as $tag ) {
    $orig_tag = $tag;
    $imgopt_w = ”;
    $imgopt_h = ”;

    // first do (data-)srcsets.
    if ( preg_match_all( ‘#srcset=(“|\’)(.*)(“|\’)#Usmi’, $tag, $allsrcsets, PREG_SET_ORDER ) ) {
    foreach ( $allsrcsets as $srcset ) {
    $srcset = $srcset[2];
    $srcsets = explode( ‘,’, $srcset );
    foreach ( $srcsets as $indiv_srcset ) {
    $indiv_srcset_parts = explode( ‘ ‘, trim( $indiv_srcset ) );
    if ( $indiv_srcset_parts[1] && rtrim( $indiv_srcset_parts[1], ‘w’ ) !== $indiv_srcset_parts[1] ) {
    $imgopt_w = rtrim( $indiv_srcset_parts[1], ‘w’ );
    }
    if ( $this->can_optimize_image( $indiv_srcset_parts[0] ) ) {
    $imgopt_url = $this->build_imgopt_url( $indiv_srcset_parts[0], $imgopt_w, ” );
    $tag = str_replace( $indiv_srcset_parts[0], $imgopt_url, $tag );
    $to_replace[ $orig_tag ] = $tag;
    }
    }
    }
    }

    **EDIT: Accidently a word lol

    • This topic was modified 6 years ago by ceitechllc.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ceitechllc

    (@ceitechllc)

    Additional Information:

    Autoptimize version – 2.4.4
    WP version – 5.1
    PHP version – 7.1.27

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    This _should_ be fixed in AO25 which is in beta now, would be great if you could download that and take it out for a spin? ??

    frank

    Thread Starter ceitechllc

    (@ceitechllc)

    I’ll download it and give it a test later today.

    Thank you for the quick response, frank

    Thread Starter ceitechllc

    (@ceitechllc)

    I was able to deploy the beta code, and the errors above seem to have been corrected, though I am receiving a new log dump.

    It’s still roughly the same about of lines. The PHP notice is as follows:


    [22-Mar-2019 13:14:24 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize-beta/classes/autoptimizeImages.php on line 508
    [22-Mar-2019 13:14:24 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize-beta/classes/autoptimizeImages.php on line 508
    [22-Mar-2019 13:14:24 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize-beta/classes/autoptimizeImages.php on line 508
    [22-Mar-2019 13:14:24 UTC] PHP Notice: Undefined offset: 1 in /home/***/public_html/wp-content/plugins/autoptimize-beta/classes/autoptimizeImages.php on line 508

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    same error, other file because all image optimization logic was moved to autoptimizeImages.php ??

    I’ll come with a fix later today!

    But question: as far as I can tell you’re not using the image optimization in AO? Or are these notices the reason why you disabled it?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, this commit should fix that notice, can you test?

    re. have AO img opt active; it’s possible you have it active, but as you’re already using jetpack to do the same, the AO one just let’s things be ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP Notice: Undefined offset: 1’ is closed to new replies.