[wp-trac] [WordPress Trac] #58094: CSV files are prevented in PHP 8.1. due to wp_check_filetype_and_ext()

WordPress Trac noreply at wordpress.org
Tue Jul 4 22:37:04 UTC 2023


#58094: CSV files are prevented in PHP 8.1. due to wp_check_filetype_and_ext()
----------------------------------------------+---------------------
 Reporter:  bradshawtm                        |       Owner:  (none)
     Type:  defect (bug)                      |      Status:  new
 Priority:  normal                            |   Milestone:  6.3
Component:  Upload                            |     Version:  6.2
 Severity:  minor                             |  Resolution:
 Keywords:  php81 needs-unit-tests has-patch  |     Focuses:
----------------------------------------------+---------------------

Comment (by felipeelia):

 I tried to reproduce the problem but I could not (sorry if I missed
 something :-) )

 Summarizing my findings, in `wp_check_filetype_and_ext()` we deal with two
 mime types: one from `wp_check_filetype()` and another from
 `finfo_file()`.

 As @bradshawtm pointed out, `finfo_file()` will indeed return `'text/csv'`
 but so will `wp_check_filetype()`, and adaptations are only needed when
 those two don't match.

 Happy to work on the unit tests if I missed something and can start
 reproducing the problem.

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


More information about the wp-trac mailing list