[wp-trac] [WordPress Trac] #55897: Add tests for path_join()

WordPress Trac noreply at wordpress.org
Thu Jun 2 16:58:22 UTC 2022


#55897: Add tests for path_join()
-------------------------------------------------+-------------------------
 Reporter:  karlijnbk                            |       Owner:  karlijnbk
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.1
Component:  General                              |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:8 joyously]:
 > Isn't it only redundant in the second return in `path_join`? It seems
 like the `ltrim` should be used in the first return.
 > There is no test case for a path with multiple slashes.
 > Also, the `path_is_absolute` function checks for `/` or `\`, so should
 these paths be normalized first, before joining them?

 Good suggestions, thanks! Yes, it was only redundant in (and is now
 removed from) the second return.

 Looks like you're right about including it in the first return, and we
 should include a test case for a path with multiple slashes.

 I'm not sure about normalizing the paths though. Looking at how
 `path_join()` is used in core, I don't see any immediate issues with mixed
 slashes there. On second thought, I don't see any harm in that, as it will
 indeed provide more consistent behavior.

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


More information about the wp-trac mailing list