"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/validators/FileValidator.php" between
yii2-2.0.35.tar.gz and yii2-2.0.36.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

FileValidator.php  (yii2-2.0.35):FileValidator.php  (yii2-2.0.36)
skipping to change at line 14 skipping to change at line 14
* @copyright Copyright (c) 2008 Yii Software LLC * @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii\validators; namespace yii\validators;
use Yii; use Yii;
use yii\helpers\FileHelper; use yii\helpers\FileHelper;
use yii\helpers\Html; use yii\helpers\Html;
use yii\helpers\Json; use yii\helpers\Json;
use yii\helpers\StringHelper;
use yii\web\JsExpression; use yii\web\JsExpression;
use yii\web\UploadedFile; use yii\web\UploadedFile;
/** /**
* FileValidator verifies if an attribute is receiving a valid uploaded file. * FileValidator verifies if an attribute is receiving a valid uploaded file.
* *
* Note that you should enable `fileinfo` PHP extension. * Note that you should enable `fileinfo` PHP extension.
* *
* @property int $sizeLimit The size limit for uploaded files. This property is read-only. * @property int $sizeLimit The size limit for uploaded files. This property is read-only.
* *
skipping to change at line 414 skipping to change at line 415
return false; return false;
} }
$extensionsByMimeType = FileHelper::getExtensionsByMimeType($mimeTyp e); $extensionsByMimeType = FileHelper::getExtensionsByMimeType($mimeTyp e);
if (!in_array($extension, $extensionsByMimeType, true)) { if (!in_array($extension, $extensionsByMimeType, true)) {
return false; return false;
} }
} }
if (!in_array($extension, $this->extensions, true)) { if (!empty($this->extensions)) {
foreach ((array) $this->extensions as $ext) {
if (StringHelper::endsWith($file->name, ".$ext", false)) {
return true;
}
}
return false; return false;
} }
return true; return true;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function clientValidateAttribute($model, $attribute, $view) public function clientValidateAttribute($model, $attribute, $view)
 End of changes. 2 change blocks. 
1 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)