From 20aa5d7150bcc4e50be5dfc5ccf1274c54dc5d07 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Tue, 13 Dec 2016 02:48:41 +0000 Subject: [PATCH] General: Correctly detect trailing newline when prepending. We need to check that the final line is actually an artifact of explode(), not just an empty input string. See #37082. Built from https://develop.svn.wordpress.org/trunk@39592 git-svn-id: http://core.svn.wordpress.org/trunk@39532 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pomo/po.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/pomo/po.php b/wp-includes/pomo/po.php index 1fc8a469d2..c31c7627df 100644 --- a/wp-includes/pomo/po.php +++ b/wp-includes/pomo/po.php @@ -169,7 +169,7 @@ class PO extends Gettext_Translations { public static function prepend_each_line($string, $with) { $lines = explode("\n", $string); $append = ''; - if ('' === end($lines)) { + if ("\n" === substr($string, -1) && '' === end($lines)) { // Last line might be empty because $string was terminated // with a newline, remove it from the $lines array, // we'll restore state by re-terminating the string at the end diff --git a/wp-includes/version.php b/wp-includes/version.php index 74a1289a5d..9b9c5dc5fa 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-39591'; +$wp_version = '4.8-alpha-39592'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.