Fixes #16183: Fixed when yii\helpers\BaseFileHelper sometimes returned wrong value

This commit is contained in:
Ondřej Vašíček
2018-10-27 01:07:17 +02:00
committed by Alexander Makarov
parent f8f53a2d07
commit ba0a3c00ca
2 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.16 under development
------------------------
- Bug #16183: Fixed when `yii\helpers\BaseFileHelper` sometimes returned wrong value (samdark, SilverFire, OndrejVasicek)
- Bug #13932: Fix number validator attributes comparison (uaoleg, s1lver)
- Bug #14039, #16636: Fixed validation for disabled inputs (s1lver, omzy83)
- Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver)

View File

@ -415,9 +415,13 @@ class BaseFileHelper
return unlink($path);
} catch (ErrorException $e) {
// last resort measure for Windows
$lines = [];
exec('DEL /F/Q ' . escapeshellarg($path), $lines, $deleteError);
return $deleteError !== 0;
if (function_exists('exec') && file_exists($path)) {
exec('DEL /F/Q ' . escapeshellarg($path));
return !file_exists($path);
}
return false;
}
}