Browse Source

Fix #17798: Avoid creating folder for stream log targets in `FileTarget`

tags/2.0.33
Sergey 5 years ago committed by GitHub
parent
commit
f69670fb65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      framework/CHANGELOG.md
  2. 6
      framework/log/FileTarget.php

1
framework/CHANGELOG.md

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.33 under development
------------------------
- Bug #17798: Avoid creating folder for stream log targets in `FileTarget` (wapmorgan)
- Bug #17850: Update to `ReplaceArrayValue` config exception message (alex-code)
- Bug #17843: Fix `yii\web\Session::setCookieParamsInternal` check param "samesite" (schevgeny)
- Bug #17828: Fix `yii\web\UploadedFile::saveAs()` failing when error value in `$_FILES` entry is a string (haveyaseen)

6
framework/log/FileTarget.php

@ -101,8 +101,10 @@ class FileTarget extends Target
*/
public function export()
{
$logPath = dirname($this->logFile);
FileHelper::createDirectory($logPath, $this->dirMode, true);
if (strpos($this->logFile, '://') === false || strncmp($this->logFile, 'file://', 7) === 0) {
$logPath = dirname($this->logFile);
FileHelper::createDirectory($logPath, $this->dirMode, true);
}
$text = implode("\n", array_map([$this, 'formatMessage'], $this->messages)) . "\n";
if (($fp = @fopen($this->logFile, 'a')) === false) {

Loading…
Cancel
Save