Make WordPress Core

Changeset 32712


Ignore:
Timestamp:
06/09/2015 03:54:49 AM (10 years ago)
Author:
dd32
Message:

WP_HTTP: ensure that the temporary file is created within the temporary directly when stream is specified without a filename parameter.
Fixes #32549

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-http.php

    r32650 r32712  
    214214         */
    215215        if ( $r['stream']  && empty( $r['filename'] ) ) {
    216             $r['filename'] = wp_unique_filename( get_temp_dir(), basename( $url ) );
     216            $r['filename'] = get_temp_dir() . wp_unique_filename( get_temp_dir(), basename( $url ) );
    217217        }
    218218
  • trunk/tests/phpunit/tests/http/base.php

    r31290 r32712  
    189189            $filesize = filesize( $res['filename'] );
    190190            unlink( $res['filename'] );
    191         }       
     191        }
    192192
    193193        $this->assertFalse( is_wp_error( $res ) );
     
    195195        $this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
    196196        $this->assertEquals( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters
     197        $this->assertStringStartsWith( get_temp_dir(), $res['filename'] ); // Check it's saving within the temp dir
    197198    }
    198199
Note: See TracChangeset for help on using the changeset viewer.