|
@@ -103,6 +103,12 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Indicates whether use of $_magicFiles should be attempted.
|
|
|
|
|
+ * @var boolean
|
|
|
|
|
+ */
|
|
|
|
|
+ protected $_tryCommonMagicFiles = true;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Option to allow header check
|
|
* Option to allow header check
|
|
|
*
|
|
*
|
|
|
* @var boolean
|
|
* @var boolean
|
|
@@ -151,7 +157,10 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
|
|
if (null === $this->_magicfile) {
|
|
if (null === $this->_magicfile) {
|
|
|
if (!empty($_ENV['MAGIC'])) {
|
|
if (!empty($_ENV['MAGIC'])) {
|
|
|
$this->setMagicFile($_ENV['MAGIC']);
|
|
$this->setMagicFile($_ENV['MAGIC']);
|
|
|
- } elseif (!(@ini_get("safe_mode") == 'On' || @ini_get("safe_mode") === 1)) {
|
|
|
|
|
|
|
+ } elseif (
|
|
|
|
|
+ !(@ini_get("safe_mode") == 'On' || @ini_get("safe_mode") === 1)
|
|
|
|
|
+ && $this->shouldTryCommonMagicFiles() // @see ZF-11784
|
|
|
|
|
+ ) {
|
|
|
require_once 'Zend/Validate/Exception.php';
|
|
require_once 'Zend/Validate/Exception.php';
|
|
|
foreach ($this->_magicFiles as $file) {
|
|
foreach ($this->_magicFiles as $file) {
|
|
|
// supressing errors which are thrown due to openbase_dir restrictions
|
|
// supressing errors which are thrown due to openbase_dir restrictions
|
|
@@ -210,6 +219,32 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Enables or disables attempts to try the common magic file locations
|
|
|
|
|
+ * specified by Zend_Validate_File_MimeType::_magicFiles
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param boolean $flag
|
|
|
|
|
+ * @return Zend_Validate_File_MimeType Provides fluent interface
|
|
|
|
|
+ * @see http://framework.zend.com/issues/browse/ZF-11784
|
|
|
|
|
+ */
|
|
|
|
|
+ public function setTryCommonMagicFilesFlag($flag = true)
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->_tryCommonMagicFiles = (boolean) $flag;
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Accessor for Zend_Validate_File_MimeType::_magicFiles
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return boolean
|
|
|
|
|
+ * @see http://framework.zend.com/issues/browse/ZF-11784
|
|
|
|
|
+ */
|
|
|
|
|
+ public function shouldTryCommonMagicFiles()
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->_tryCommonMagicFiles;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Returns the Header Check option
|
|
* Returns the Header Check option
|
|
|
*
|
|
*
|
|
|
* @return boolean
|
|
* @return boolean
|