[wp-trac] [WordPress Trac] #31786: Customizer: current header image does not show when it has the same name as another header image

WordPress Trac noreply at wordpress.org
Fri Mar 27 14:07:52 UTC 2015


#31786: Customizer: current header image does not show when it has the same name as
another header image
--------------------------+-----------------------------
 Reporter:  sirbrillig    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Customize     |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I noticed that during heavy testing (this probably won't affect most
 people) of the Customizer's Header Image Controls, occasionally after
 cropping an image, saving the change, and reloading the Customizer, the
 current header image would display "no image set", despite there actually
 being an image.

 The reason for this is twofold. One is that the Backbone View that
 displays the current image has no fallback if it can't find the current
 header image in its "Previously Uploaded" array (or the defaults). I've
 created a patch to address that here: #31742.

 But the main reason for this bug is that the "Previously Uploaded" array
 can sometimes not include certain images. This is because the
 `get_uploaded_header_images` function in
 https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/theme.php#L1181 returns the list of images as an associative
 array keyed by the *basename* of the image.

 This is a problem because multiple images uploaded on different days can
 have the same name, and in my testing this happened a lot when I was
 cropping images several times. In most cases this is no problem because
 the image paths are different, and the image attachment IDs are different.
 Here, however, it means that in the Customizer you'll only see one image
 if there are several with the same filename and if the current image is
 not in that list, it will display as though no image is set.

 Again, this is a relatively hidden bug, but I think it's probably a good
 idea if it is fixed sooner rather than later in case more code uses
 `get_uploaded_header_images` and expects it to be keyed by filename.

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


More information about the wp-trac mailing list