Browse Source

Merge branch 'master' into 3.next

Mark Story 8 years ago
parent
commit
a8b95da529

+ 1 - 1
VERSION.txt

@@ -16,4 +16,4 @@
 // @license       https://opensource.org/licenses/mit-license.php MIT License
 // +--------------------------------------------------------------------------------------------+ //
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-3.5.12
+3.5.13

+ 1 - 1
src/Controller/Component/RequestHandlerComponent.php

@@ -515,7 +515,7 @@ class RequestHandlerComponent extends Component
         $acceptRaw = $request->parseAccept();
 
         if (empty($acceptRaw)) {
-            return $this->ext;
+            return $type ? $type === $this->ext : $this->ext;
         }
         $accepts = $response->mapType(array_shift($acceptRaw));
 

+ 1 - 1
src/View/Helper/FormHelper.php

@@ -1453,7 +1453,7 @@ class FormHelper extends Helper
 
         if ($allowOverride && substr($fieldName, -5) === '._ids') {
             $options['type'] = 'select';
-            if (empty($options['multiple'])) {
+            if ((!isset($options['multiple']) || ($options['multiple'] && $options['multiple'] != 'checkbox'))) {
                 $options['multiple'] = true;
             }
         }

+ 4 - 0
tests/TestCase/Controller/Component/RequestHandlerComponentTest.php

@@ -948,6 +948,10 @@ class RequestHandlerComponentTest extends TestCase
         $this->Controller->request = $this->request->withHeader('Accept', '*/*;q=0.5');
         $this->assertEquals('html', $this->RequestHandler->prefers());
         $this->assertFalse($this->RequestHandler->prefers('rss'));
+
+        $this->Controller->request = $this->request->withEnv('HTTP_ACCEPT', null);
+        $this->RequestHandler->ext = 'json';
+        $this->assertFalse($this->RequestHandler->prefers('xml'));
     }
 
     /**

+ 7 - 0
tests/TestCase/View/Helper/FormHelperTest.php

@@ -5223,6 +5223,13 @@ class FormHelperTest extends TestCase
             ['multiple' => 'multiple', 'form' => 'my-form']
         );
         $this->assertHtml($expected, $result);
+
+        $result = $this->Form->select(
+            'Model.multi_field',
+            $options,
+            ['form' => 'my-form', 'multiple' => false]
+        );
+        $this->assertNotContains('multiple', $result);
     }
 
     /**