[wp-trac] [WordPress Trac] #35755: wp_tempnam produces filenames longer than 255 characters

WordPress Trac noreply at wordpress.org
Sat Jul 1 13:01:13 UTC 2023


#35755: wp_tempnam produces filenames longer than 255 characters
---------------------------------------------------+---------------------
 Reporter:  doems                                  |       Owner:  (none)
     Type:  defect (bug)                           |      Status:  new
 Priority:  normal                                 |   Milestone:  6.3
Component:  Filesystem API                         |     Version:  4.4
 Severity:  normal                                 |  Resolution:
 Keywords:  has-patch has-unit-tests dev-feedback  |     Focuses:
---------------------------------------------------+---------------------

Comment (by costdev):

 If we cut the filename, then call `wp_unique_filename()`, it could add
 characters that make the filename go over the 255 character limit.

 The return value of `wp_unique_filename()` is also filterable, so we can't
 anticipate the length accurately. To ensure the unique filename isn't over
 the limit, we need to check the difference between the result of
 `wp_unique_filename()` and 255, and cut the difference off the original
 filename before re-running.

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


More information about the wp-trac mailing list