From 199f9adec27ed1c6aa87140a219b4b0476eb8854 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 30 Apr 2012 01:25:29 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 0834adb83e..4b4b3f4c1e 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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 );