WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#19908 closed defect (bug) (worksforme)

PHP warnings in media listing

Reported by: dimitrov.adrian Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.3.1
Component: Media Keywords: reporter-feedback
Focuses: Cc:

Description

Notice: Uninitialized string offset: 0 in /var/www/wptest/wp-includes/media.php on line 537
Notice: Uninitialized string offset: 0 in /var/www/wptest/wp-includes/media.php on line 537
Notice: Uninitialized string offset: 0 in /var/www/wptest/wp-includes/media.php on line 543
Notice: Uninitialized string offset: 0 in /var/www/wptest/wp-includes/media.php on line 543
Notice: Uninitialized string offset: 0 in /var/www/wptest/wp-includes/media.php on line 550
Notice: Uninitialized string offset: 0 in /var/www/wptest/wp-includes/media.php on line 550

Change History (6)

#1 follow-up: @nacin
6 years ago

  • Keywords reporter-feedback added

Hi, can we have some steps to reproduce? These notices indicate that image_get_intermediate_size() is being called with incorrect arguments. If you are passing $size as an array, it needs to be array( $width, $height ), where $width and $height are integers.

#2 in reply to: ↑ 1 @dimitrov.adrian
6 years ago

  • Severity changed from normal to trivial

This is only warnings that apear in above some of images (i can't track what exactly trigger the warning). So i can disable it while turn off php error reporting (and in productivity sites i do that).
I have default twentyeleven theme with no plugins, and few posts and attachments.

#3 @SergeyBiryukov
6 years ago

Kinda related: #17736

#4 @mau
6 years ago

  • Cc ngomau@… added

#5 @xnau
6 years ago

I ran across this error and i traced it to a problem with the "sizes" array within the attachment metadata. The metadata for an image that was triggering the notice looked like this:

array (
  'width' => '400',
  'height' => '340',
  'hwstring_small' => "height='96' width='112'",
  'file' => 'default-image.jpg',
  'sizes' => 
  array (
    'thumbnail' => 
    array (
      'file' => 'default-image-150x127.jpg',
      'width' => '150',
      'height' => '127',
    ),
    'medium' => 
    array (
      'file' => 'default-image-200x170.jpg',
      'width' => '200',
      'height' => '170',
    ),
    'large' => '',
    'small-thumb' => 
    array (
      'file' => 'default-image-88x75.jpg',
      'width' => '88',
      'height' => '75',
    ),
    'micro-thumb' => 
    array (
      'file' => 'default-image-47x40.jpg',
      'width' => '47',
      'height' => '40',
    ),
    'product-slide' => 
    array (
      'file' => 'default-image-376x320.jpg',
      'width' => '376',
      'height' => '320',
    ),
    'post-thumbnail' => 
    array (
      'file' => 'default-image-141x120.jpg',
      'width' => '141',
      'height' => '120',
    ),
  ),
  'image_meta' => 
  array (
    'aperture' => '0',
    'credit' => '',
    'camera' => '',
    'caption' => '',
    'created_timestamp' => '0',
    'copyright' => '',
    'focal_length' => '0',
    'iso' => '0',
    'shutter_speed' => '0',
    'title' => '',
  ),
)

(note the 'large' image size missing it's array)

If I remove the empty size definition element, the notice stops. The question is how did the metadata get corrupted in the first place? I think it was possibly caused by a plugin I was using to rebuild the thumbnails (AJAX Thumbnail Rebuild). More testing is needed, but I thought I'd report my findings.

Last edited 6 years ago by SergeyBiryukov (previous) (diff)

#6 @nacin
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.