Fix 0'th index file not being copied to $_FILES.

Fixes #3256
This commit is contained in:
mark_story 2012-10-11 08:39:46 -04:00
parent 8800d7bdec
commit 1110e26483
2 changed files with 19 additions and 1 deletions

View file

@ -319,7 +319,7 @@ class CakeRequest implements ArrayAccess {
protected function _processFiles() {
if (isset($_FILES) && is_array($_FILES)) {
foreach ($_FILES as $name => $data) {
if ($name != 'data') {
if ($name !== 'data') {
$this->params['form'][$name] = $data;
}
}

View file

@ -587,6 +587,24 @@ class CakeRequestTest extends CakeTestCase {
$this->assertEquals($request->params['form'], $_FILES);
}
/**
* Test that files in the 0th index work.
*/
public function testFilesZeroithIndex() {
$_FILES = array(
0 => array(
'name' => 'cake_sqlserver_patch.patch',
'type' => 'text/plain',
'tmp_name' => '/private/var/tmp/phpy05Ywj',
'error' => 0,
'size' => 6271,
),
);
$request = new CakeRequest('some/path');
$this->assertEquals($_FILES, $request->params['form']);
}
/**
* test method overrides coming in from POST data.
*