Skip to content

Commit 1725386

Browse files
author
euromark
committed
Fix uploadError validation rule to work with OS Win. Here the error is string, not integer.
1 parent 827dc77 commit 1725386

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/Cake/Test/Case/Utility/ValidationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,9 +2368,11 @@ public function testMimeTypeFalse() {
23682368
public function testUploadError() {
23692369
$this->assertTrue(Validation::uploadError(0));
23702370
$this->assertTrue(Validation::uploadError(array('error' => 0)));
2371+
$this->assertTrue(Validation::uploadError(array('error' => '0')));
23712372

23722373
$this->assertFalse(Validation::uploadError(2));
23732374
$this->assertFalse(Validation::uploadError(array('error' => 2)));
2375+
$this->assertFalse(Validation::uploadError(array('error' => '2')));
23742376
}
23752377

23762378
/**

lib/Cake/Utility/Validation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ public static function uploadError($check) {
964964
$check = $check['error'];
965965
}
966966

967-
return $check === UPLOAD_ERR_OK;
967+
return (int)$check === UPLOAD_ERR_OK;
968968
}
969969

970970
/**

0 commit comments

Comments
 (0)