Make WordPress Core

Changeset 39592


Ignore:
Timestamp:
12/13/2016 02:47:07 AM (8 years ago)
Author:
rmccue
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pomo/po.php

    r39591 r39592  
    170170        $lines = explode("\n", $string);
    171171        $append = '';
    172         if ('' === end($lines)) {
     172        if ("\n" === substr($string, -1) && '' === end($lines)) {
    173173            // Last line might be empty because $string was terminated
    174174            // with a newline, remove it from the $lines array,
Note: See TracChangeset for help on using the changeset viewer.