From 8f35b191db7243f22be60697b45c78caba30c5c7 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Mon, 12 Jan 2015 04:21:22 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@31158 git-svn-id: http://core.svn.wordpress.org/trunk@31139 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-blogs.php | 3 +-- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index d291f169db..83fec396ab 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -298,8 +298,7 @@ function update_blog_details( $blog_id, $details = array() ) { $fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'); foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) { if ( 'path' === $field ) { - $details[ $field ] = array_filter( explode( '/', $details[ $field ] ) ); - $details[ $field ] = trailingslashit( '/' . implode( '/', $details[ $field ] ) ); + $details[ $field ] = trailingslashit( '/' . trim( $details[ $field ], '/' ) ); } $update_details[ $field ] = $details[ $field ]; diff --git a/wp-includes/version.php b/wp-includes/version.php index 38ff5807c6..b70e28b7ba 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31157'; +$wp_version = '4.2-alpha-31158'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.