Properly extract file headers via get_file_data() when CR line endings are used. props solarissmoke for the initial patch. fixes #19854.

git-svn-id: https://develop.svn.wordpress.org/trunk@20640 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-04-30 01:25:29 +00:00
parent f553c11f28
commit 199f9adec2
1 changed files with 3 additions and 0 deletions

View File

@ -3378,6 +3378,9 @@ function get_file_data( $file, $default_headers, $context = '' ) {
// PHP will close file handle, but we are good citizens.
fclose( $fp );
// Make sure we catch CR-only line endings.
$file_data = str_replace( "\r", "\n", $file_data );
if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) {
$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
$all_headers = array_merge( $extra_headers, (array) $default_headers );