Skip to content

Commit

Permalink
Fix uploadError validation rule to work with OS Win. Here the error i…
Browse files Browse the repository at this point in the history
…s string, not integer.
  • Loading branch information
euromark committed Feb 12, 2014
1 parent 827dc77 commit 1725386
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Utility/ValidationTest.php
Expand Up @@ -2368,9 +2368,11 @@ public function testMimeTypeFalse() {
public function testUploadError() {
$this->assertTrue(Validation::uploadError(0));
$this->assertTrue(Validation::uploadError(array('error' => 0)));
$this->assertTrue(Validation::uploadError(array('error' => '0')));

$this->assertFalse(Validation::uploadError(2));
$this->assertFalse(Validation::uploadError(array('error' => 2)));
$this->assertFalse(Validation::uploadError(array('error' => '2')));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Validation.php
Expand Up @@ -964,7 +964,7 @@ public static function uploadError($check) {
$check = $check['error'];
}

return $check === UPLOAD_ERR_OK;
return (int)$check === UPLOAD_ERR_OK;
}

/**
Expand Down

0 comments on commit 1725386

Please sign in to comment.