Permalink
Browse files

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

Fixes #3256
  • Loading branch information...
markstory committed Oct 11, 2012
1 parent 8800d7b commit 1110e26483fd0c509b10b096d414ed82004965c0
Showing with 19 additions and 1 deletion.
  1. +1 −1 lib/Cake/Network/CakeRequest.php
  2. +18 −0 lib/Cake/Test/Case/Network/CakeRequestTest.php
@@ -319,7 +319,7 @@ protected function _base() {
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;
}
}
@@ -587,6 +587,24 @@ public function testFilesParsing() {
$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.
*

0 comments on commit 1110e26

Please sign in to comment.