Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/Transien...
File: TransientFilesEngine.php
$legacy_proxy->call_function( 'status_header', 404 );
[500] Fix | Delete
$legacy_proxy->exit();
[501] Fix | Delete
}
[502] Fix | Delete
[503] Fix | Delete
$file_length = filesize( $file_path );
[504] Fix | Delete
if ( false === $file_length ) {
[505] Fix | Delete
throw new Exception( "Can't retrieve file size: $file_path" );
[506] Fix | Delete
}
[507] Fix | Delete
[508] Fix | Delete
$file_handle = fopen( $file_path, 'r' );
[509] Fix | Delete
} catch ( Exception $ex ) {
[510] Fix | Delete
$error_message = "Error serving transient file $file_name: {$ex->getMessage()}";
[511] Fix | Delete
wc_get_logger()->error( $error_message );
[512] Fix | Delete
[513] Fix | Delete
$legacy_proxy->call_function( 'status_header', 500 );
[514] Fix | Delete
$legacy_proxy->exit();
[515] Fix | Delete
}
[516] Fix | Delete
[517] Fix | Delete
$legacy_proxy->call_function( 'status_header', 200 );
[518] Fix | Delete
$legacy_proxy->call_function( 'header', 'Content-Type: text/html' );
[519] Fix | Delete
$legacy_proxy->call_function( 'header', "Content-Length: $file_length" );
[520] Fix | Delete
[521] Fix | Delete
try {
[522] Fix | Delete
while ( ! feof( $file_handle ) ) {
[523] Fix | Delete
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[524] Fix | Delete
echo fread( $file_handle, 1024 );
[525] Fix | Delete
}
[526] Fix | Delete
[527] Fix | Delete
/**
[528] Fix | Delete
* Action that fires after a transient file has been successfully served, right before terminating the request.
[529] Fix | Delete
*
[530] Fix | Delete
* @param array $transient_file_info Information about the served file, as returned by get_file_by_name.
[531] Fix | Delete
* @param bool $is_json_rest_api_request True if the request came from the JSON API endpoint, false if it came from the authenticated endpoint.
[532] Fix | Delete
*
[533] Fix | Delete
* @since 8.5.0
[534] Fix | Delete
*/
[535] Fix | Delete
do_action( 'woocommerce_transient_file_contents_served', $file_name );
[536] Fix | Delete
} catch ( Exception $e ) {
[537] Fix | Delete
wc_get_logger()->error( "Error serving transient file $file_name: {$e->getMessage()}" );
[538] Fix | Delete
// We can't change the response status code at this point.
[539] Fix | Delete
} finally {
[540] Fix | Delete
fclose( $file_handle );
[541] Fix | Delete
$legacy_proxy->exit();
[542] Fix | Delete
}
[543] Fix | Delete
}
[544] Fix | Delete
}
[545] Fix | Delete
[546] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function