is_writable function fails on Windows systems causing spurious http_request_failed error — at Version 2
|Reported by:||Otto42||Owned by:|
|Component:||HTTP API||Keywords:||has-patch commit|
Description (last modified by ocean90)
In class-http.php, in request(), there is a double check to be sure a file is writable using this code:
$r['filename'] = get_temp_dir() . basename( $url ); ... if ( ! is_writable( dirname( $r['filename'] ) ) ) return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
Problem is that is_writable can return false incorrectly on Windows systems, due to a PHP bug:
Now, get_temp_dir() already performs an is_writable check on the resulting temp directories, and it uses a win_is_writable() call to work around this problem on Windows systems.
Thus, this secondary check is seemingly unnecessary anyway, anything returned by get_temp_dir() really should be writable.
So either the writable check in class-http.php needs to be made Windows compatible, or removed entirely.
A few reports of the problem on support forums:
This problem may have been exacerbated by #20778.