[wp-trac] [WordPress Trac] #62347: wp_get_image_mime does not check that the file exists

WordPress Trac noreply at wordpress.org
Mon Nov 18 15:32:56 UTC 2024


#62347: wp_get_image_mime does not check that the file exists
-----------------------------------------------+---------------------------
 Reporter:  Iulia Cazan                        |       Owner:  (none)
     Type:  defect (bug)                       |      Status:  new
 Priority:  normal                             |   Milestone:  Awaiting
                                               |  Review
Component:  Media                              |     Version:
 Severity:  normal                             |  Resolution:
 Keywords:  reporter-feedback has-patch close  |     Focuses:
-----------------------------------------------+---------------------------
Changes (by desrosj):

 * keywords:  reporter-feedback has-patch => reporter-feedback has-patch
               close


Comment:

 I'm going to add a `close` suggestion for this.

 I went and checked all instances where `wp_get_image_mime()` is called in
 Core and confirmed what @swissspidy said above. The file is always
 verified before calling that function.

 I don't think that the attached pull request is one that we should make.
 The function is responsible for determining the mime type of an image file
 and returns `false` if one cannot be determined. If it's changed to return
 `false` when the file does not exist, it would be misleading when the file
 is missing or invalid. It also silences scenarios like this where a plugin
 or theme is likely not properly verifying a file.

 @iulia-cazan could you provide a backtrace of the error you are seeing?
 Could you try to disable your plugins one at a time to see if the problem
 is solved? Or, if you can reproduce the error with a fresh install of
 WordPress, can you please provide steps someone else can take to replicate
 the error?

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


More information about the wp-trac mailing list