Illegal string offset 'width' in wp-content/themes/parabola/attachment.php

  • Author
  • #56763


    In different sites with Parabola 2.2.2 theme, I’m reading this warnings frequently in the error_log:

    AH01071: Got error ‘PHP message: PHP Warning: Illegal string offset ‘width’ in /home/blablabla/public_html/wp-content/themes/parabola/attachment.php on line 36\nPHP message: PHP Warning: Illegal string offset ‘height’ in /home/blablabla/public_html/wp-content/themes/parabola/attachment.php on line 37\n’

    I don’t know how to reproduce it and what or how are the visitors doing site navigation.

    Affected code is:

    							if ( wp_attachment_is_image() ) {
    								$metadata = wp_get_attachment_metadata();
    								printf( __( 'Full size is %s pixels', 'parabola'),
    									sprintf( '<a href="%1$s" title="%2$s">%3$s &times; %4$s</a>',
    										esc_url( wp_get_attachment_url() ),
    										esc_attr( __('Link to full-size image', 'parabola') ),

    A search in Google shows some sites with the same failure:

    Any idea about why size aren’t read? I’m thinking in a patch to ensure values are defined prior to display them, but only solves the warning part.

    Thank you.

    • This topic was modified 3 years ago by Pitufo.
    Cryout Creations mastermind

    Thanks for lettings us know about this.

    Sounds like the code is trying to retrieve information for invalid (broken?) images.
    We’ll add a check to silence the warnings, but that doesn’t resolve WordPress’ wp_get_attachment_metadata() failing for specific files on your site.

    If you like our creations, help us share by rating them on
    Please read the available documentation and search the forums before posting.

    May be related to bot activities. As I only experience this on the palabola themed sites and only examined code, not tracked logs, I’m unsure about the origin.

    Too much thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Illegal string offset 'width' in wp-content/themes/parabola/attachment.php’ is closed to new replies.