diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index 238793912..39834b2a2 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -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; } } diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index d4d4c9dda..564191c54 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -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. *