Make WordPress Core

Changeset 38151


Ignore:
Timestamp:
07/25/2016 03:27:43 PM (8 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r38138 r38151  
    169169    }
    170170
    171     if ( empty( $filename ) || '.' == $filename || '/' == $filename ) {
     171    if ( empty( $filename ) || '.' == $filename || '/' == $filename || '\\' == $filename ) {
    172172        $filename = time();
    173173    }
Note: See TracChangeset for help on using the changeset viewer.