From 6d87a96c85ed00fcd59e063120a1e62af20eb5e0 Mon Sep 17 00:00:00 2001 From: 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: http://svn.automattic.com/wordpress/trunk@20640 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 0834adb83..4b4b3f4c1 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 );