Make WordPress Core


Ignore:
Timestamp:
03/31/2015 02:10:06 AM (12 years ago)
Author:
dd32
Message:

Add some logic into wp_tempnam to prevent it creating 'falsey' directory names that might get used elsewhere within WordPress.
Although this logic looks a little strange at this low level, it's the best location within the Upgrades code for it to happen.
Fixes #31811

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/file.php

    r25002 r31936  
    153153        }
    154154
     155        /**
     156         * @dataProvider data_wp_tempnam_filenames
     157         */
     158        function test_wp_tempnam( $case ) {
     159                $file = wp_tempnam( $case );
     160                unlink( $file );
     161
     162                $this->assertNotEmpty( basename( basename( $file, '.tmp' ), '.zip' ) );
     163        }
     164        function data_wp_tempnam_filenames() {
     165                return array(
     166                        array( '0.zip' ),
     167                        array( '0.1.2.3.zip' ),
     168                        array( 'filename.zip' ),
     169                        array( 'directory/0.zip' ),
     170                        array( 'directory/filename.zip' ),
     171                        array( 'directory/0/0.zip' ),
     172                );
     173        }
     174
    155175}
Note: See TracChangeset for help on using the changeset viewer.