Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3764'
Browse files Browse the repository at this point in the history
Close #3764
  • Loading branch information
weierophinney committed Feb 19, 2013
2 parents 79e50a0 + 43be644 commit 5a341b7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
8 changes: 6 additions & 2 deletions library/Zend/Validator/File/IsCompressed.php
Expand Up @@ -79,10 +79,14 @@ public function __construct($options = array())
$options = ArrayUtils::iteratorToArray($options);
}

if (empty($options)) {
$options = array('mimeType' => $default);
if ($options === null) {
$options = array();
}

parent::__construct($options);

if (!$this->getMimeType()) {
$this->setMimeType($default);
}
}
}
8 changes: 6 additions & 2 deletions library/Zend/Validator/File/IsImage.php
Expand Up @@ -104,10 +104,14 @@ public function __construct($options = array())
$options = ArrayUtils::iteratorToArray($options);
}

if (empty($options)) {
$options = array('mimeType' => $default);
if ($options === null) {
$options = array();
}

parent::__construct($options);

if (!$this->getMimeType()) {
$this->setMimeType($default);
}
}
}
9 changes: 9 additions & 0 deletions tests/ZendTest/Validator/File/IsCompressedTest.php
Expand Up @@ -182,6 +182,15 @@ public function testOptionsAtConstructor()
$this->assertEquals('image/gif,image/jpg', $validator->getMimeType());
}

public function testNonMimeOptionsAtConstructorStillSetsDefaults()
{
$validator = new File\IsCompressed(array(
'enableHeaderCheck' => true,
));

$this->assertNotEmpty($validator->getMimeType());
}

/**
* @group ZF-11258
*/
Expand Down
9 changes: 9 additions & 0 deletions tests/ZendTest/Validator/File/IsImageTest.php
Expand Up @@ -173,6 +173,15 @@ public function testOptionsAtConstructor()
$this->assertEquals('image/gif,image/jpg', $validator->getMimeType());
}

public function testNonMimeOptionsAtConstructorStillSetsDefaults()
{
$validator = new File\IsImage(array(
'enableHeaderCheck' => true,
));

$this->assertNotEmpty($validator->getMimeType());
}

/**
* @group ZF-11258
*/
Expand Down

0 comments on commit 5a341b7

Please sign in to comment.