WordPress.org

Make WordPress Core

Ticket #22267: 22267.c2.diff

File 22267.c2.diff, 1.1 KB (added by knutsp, 6 years ago)

Patch C: Removes both / and \, adds / regardless, Replacement is now written as "/
"

  • formatting.php

     
    13621362 * @param string $string What to add the trailing slash to.
    13631363 * @return string String with trailing slash added.
    13641364 */
    1365 function trailingslashit($string) {
    1366         return untrailingslashit($string) . '/';
     1365function trailingslashit( $string ) {
     1366        return untrailingslashit( $string ) . '/';
    13671367}
    13681368
    13691369/**
    1370  * Removes trailing slash if it exists.
     1370 * Removes trailing slash or backslash if it exists.
    13711371 *
    13721372 * The primary use of this is for paths and thus should be used for paths. It is
    13731373 * not restricted to paths and offers no specific path support.
    13741374 *
    13751375 * @since 2.2.0
    13761376 *
    1377  * @param string $string What to remove the trailing slash from.
    1378  * @return string String without the trailing slash.
     1377 * @param string $string What to remove the trailing slash or backslash from.
     1378 * @return string String without the trailing slash or backslash.
    13791379 */
    1380 function untrailingslashit($string) {
    1381         return rtrim($string, '/');
     1380function untrailingslashit( $string ) {
     1381        return rtrim( $string, '/\\' );
    13821382}
    13831383
    13841384/**