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: http://svn.automattic.com/wordpress/trunk@20640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-04-30 01:25:29 +00:00
parent 608b26589e
commit 6d87a96c85
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 );