From d7253ca244068c16acc1ca0b5c01359b32911433 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 25 Jul 2016 15:28:29 +0000 Subject: [PATCH] Filesystem API: Prevent an endless self-calling loop in `wp_tempnam()`. Under certain conditions upgrades on Windows may fail because `wp_tempnam()` gets called in a loop. This can happen when `wp_tempnam()` is called with `\.maintenance` for the `$filename` parameter. The function strips the extension, in this case `.maintenance`, which results in an empty filename. Because it's empty, `wp_tempnam()` calls itself with `dirname( '\.maintenance' )`. On *nix systems this would be `"/"` which allows `wp_tempnam()` to fall back on `time()`. But on Windows it's `"\"`. This change adds the backslash to the list of characters which allow `wp_tempnam()` to fall back on `time()`. See [32322], [31936]. Fixes #33999. Built from https://develop.svn.wordpress.org/trunk@38151 git-svn-id: http://core.svn.wordpress.org/trunk@38092 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 1250e36f6f..6bb61cff4e 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -168,7 +168,7 @@ function wp_tempnam( $filename = '', $dir = '' ) { $dir = get_temp_dir(); } - if ( empty( $filename ) || '.' == $filename || '/' == $filename ) { + if ( empty( $filename ) || '.' == $filename || '/' == $filename || '\\' == $filename ) { $filename = time(); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3339b75210..71a2b12716 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta4-38150'; +$wp_version = '4.6-beta4-38151'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.