From 6e8cc4c151c477893d5ae9cb0ca3f2a80727c7d9 Mon Sep 17 00:00:00 2001 From: Hisateru Tanaka Date: Sat, 7 Oct 2017 05:31:37 +0900 Subject: [PATCH] Fixes #14929: Ensure trailing `;` on combining files with `asset` command to fix compiler failures --- framework/CHANGELOG.md | 1 + framework/console/controllers/AssetController.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 6c75b1b62f..b074f10416 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.13 under development ------------------------ +- Enh #14929: Ensure trailing `;` on combining files with `asset` command to fix compiler failures (tanakahisateru) - Bug #14016: Fixed empty messages marked as unused in PHP and PO sources when extracted with message command when `markUnused` is `false` (samdark) - Enh #9438: `yii\web\DbSession` now relies on error handler to display errors (samdark) - Bug #6226: Fix fatal symlink error when publishing in multi threaded environments (dynasource) diff --git a/framework/console/controllers/AssetController.php b/framework/console/controllers/AssetController.php index 59ad7af7bc..516b76b199 100644 --- a/framework/console/controllers/AssetController.php +++ b/framework/console/controllers/AssetController.php @@ -568,8 +568,12 @@ EOD; { $content = ''; foreach ($inputFiles as $file) { + $fileContent = rtrim(file_get_contents($file)); + if (substr($fileContent, -1) !== ';') { + $fileContent .= ';'; + } $content .= "/*** BEGIN FILE: $file ***/\n" - . file_get_contents($file) + . $fileContent . "\n" . "/*** END FILE: $file ***/\n"; } if (!file_put_contents($outputFile, $content)) {