[wp-trac] [WordPress Trac] #59573: warning: trying to access array offset on value of type bool in wp-incloudes/media.php

WordPress Trac noreply at wordpress.org
Mon Oct 9 16:14:04 UTC 2023


#59573: warning: trying to access array offset on value of type bool in wp-
incloudes/media.php
----------------------------+-----------------------------
 Reporter:  androidforlife  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  General         |    Version:  6.3.1
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 function image_get_intermediate_size($post_id, $size = 'thumbnail')
 {
     $imagedata = wp_get_attachment_metadata($post_id);

     // Überprüfung, ob $imagedata und $imagedata['sizes'] echte Arrays
 sind
     if (!is_array($imagedata) || empty($imagedata['sizes']) ||
 !is_array($imagedata['sizes'])) {
         return false;
     }

     // Überprüfung, ob $size eine gültige Struktur hat
     if (!is_array($size) || count($size) < 2) {
         return false;
     }

     $data = [];
 .....

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59573>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list