[wp-trac] [WordPress Trac] #36838: Invalid argument supplied for foreach() in /wp-includes/theme-compat/embed-content.php on line 32

WordPress Trac noreply at wordpress.org
Fri May 13 22:13:13 UTC 2016


#36838: Invalid argument supplied for foreach() in /wp-includes/theme-compat/embed-
content.php on line 32
--------------------------+------------------------------
 Reporter:  MarkRH        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Embeds        |     Version:  4.5.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by MarkRH):

 Thought I should add that I modified the code to keep it from happening
 and to log what URLs are being accessed:

 {{{
       if ( is_array( $meta ) ) {
          my_log('embed-content.php: - '.$_SERVER['REQUEST_URI'].' -
 ','/embed.log');
          if (isset($meta['sizes'])) {
                         foreach ( $meta['sizes'] as $size => $data ) {
                                 if ( $data['width'] / $data['height'] >
 $aspect_ratio ) {
                                         $aspect_ratio = $data['width'] /
 $data['height'];
                                         $measurements = array(
 $data['width'], $data['height'] );
                                         $image_size   = $size;
                                 }
                         }
          } else {
             $data = $meta;
                                 if ( $data['width'] / $data['height'] >
 $aspect_ratio ) {
                                         $aspect_ratio = $data['width'] /
 $data['height'];
                                         $measurements = array(
 $data['width'], $data['height'] );
                                 }

          }

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36838#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list