WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/12/2015 04:20:47 AM (5 years ago)
Author:
jeremyfelt
Message:

Use a less complex approach for enforcing path slashes in update_blog_details()

Ensure leading and traling slashes are in place and don't touch anything in the middle. Validating with array_filter() would have missed a possible valid falsy path - /my-path/0/.

Props nacin.

Fixes #18117.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r31157 r31158  
    299299    foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) {
    300300        if ( 'path' === $field ) {
    301             $details[ $field ] = array_filter( explode( '/', $details[ $field ] ) );
    302             $details[ $field ] = trailingslashit( '/' . implode( '/', $details[ $field ] ) );
     301            $details[ $field ] = trailingslashit( '/' . trim( $details[ $field ], '/' ) );
    303302        }
    304303
Note: See TracChangeset for help on using the changeset viewer.