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
This commit is contained in:
parent
343a6587cf
commit
8f35b191db
|
@ -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');
|
$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 ) {
|
foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) {
|
||||||
if ( 'path' === $field ) {
|
if ( 'path' === $field ) {
|
||||||
$details[ $field ] = array_filter( explode( '/', $details[ $field ] ) );
|
$details[ $field ] = trailingslashit( '/' . trim( $details[ $field ], '/' ) );
|
||||||
$details[ $field ] = trailingslashit( '/' . implode( '/', $details[ $field ] ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_details[ $field ] = $details[ $field ];
|
$update_details[ $field ] = $details[ $field ];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue