From: VirtualTam Date: Sun, 17 Jan 2016 23:24:36 +0000 (+0100) Subject: fix: use PHP_EOL for carriage returns in file logs X-Git-Tag: v0.6.3~8^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=refs%2Fpull%2F443%2Fhead;hp=122d90ef8d83c6702a8b47f81c32fa3ba7a53c31;p=github%2Fshaarli%2FShaarli.git fix: use PHP_EOL for carriage returns in file logs Relates to #436 Signed-off-by: VirtualTam --- diff --git a/application/Utils.php b/application/Utils.php index cb30595f..551db3e7 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -16,7 +16,7 @@ function logm($logFile, $clientIp, $message) { file_put_contents( $logFile, - date('Y/m/d H:i:s').' - '.$clientIp.' - '.strval($message).'\n', + date('Y/m/d H:i:s').' - '.$clientIp.' - '.strval($message).PHP_EOL, FILE_APPEND ); } diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index f3bb556e..3073b5eb 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -51,7 +51,7 @@ class UtilsTest extends PHPUnit_Framework_TestCase protected function getLastLogEntry() { $logFile = file(self::$testLogFile); - return explode(' - ', trim(array_pop($logFile), '\n')); + return explode(' - ', trim(array_pop($logFile), PHP_EOL)); } /**