ソースを参照

Merge branch '4.x' into 4.next

ADmad 3 年 前
コミット
902a63a5b4

+ 1 - 1
.github/workflows/ci.yml

@@ -251,7 +251,7 @@ jobs:
       run: composer update
 
     - name: Install PHP tools with phive.
-      run: phive install --trust-gpg-keys 'CF1A108D0E7AE720,12CE0F1D262429A5'
+      run: phive install --trust-gpg-keys 'CF1A108D0E7AE720,51C67305FFC2E5C0,12CE0F1D262429A5'
 
     - name: Run phpcs
       if: always()

+ 1 - 1
.phive/phars.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <phive xmlns="https://phar.io/phive">
-  <phar name="phpstan" version="1.10.2" installed="1.10.2" location="./tools/phpstan" copy="false"/>
+  <phar name="phpstan" version="1.10.11" installed="1.10.11" location="./tools/phpstan" copy="false"/>
   <phar name="psalm" version="4.30.0" installed="4.30.0" location="./tools/psalm" copy="false"/>
 </phive>

+ 2 - 1
src/Database/Query.php

@@ -29,6 +29,7 @@ use Closure;
 use InvalidArgumentException;
 use IteratorAggregate;
 use RuntimeException;
+use Throwable;
 use function Cake\Core\deprecationWarning;
 
 /**
@@ -2479,7 +2480,7 @@ class Query implements ExpressionInterface, IteratorAggregate
             );
             $sql = $this->sql();
             $params = $this->getValueBinder()->bindings();
-        } catch (RuntimeException $e) {
+        } catch (Throwable $e) {
             $sql = 'SQL could not be generated for this query as it is incomplete.';
             $params = [];
         } finally {

+ 1 - 1
src/Http/Cookie/CookieCollection.php

@@ -90,7 +90,7 @@ class CookieCollection implements IteratorAggregate, Countable
         $data = $request->getCookieParams();
         $cookies = [];
         foreach ($data as $name => $value) {
-            $cookies[] = new Cookie($name, $value);
+            $cookies[] = new Cookie((string)$name, $value);
         }
 
         return new static($cookies);

+ 12 - 2
tests/TestCase/Http/Cookie/CookieCollectionTest.php

@@ -474,15 +474,25 @@ class CookieCollectionTest extends TestCase
      */
     public function testCreateFromServerRequest(): void
     {
-        $request = new ServerRequest(['cookies' => ['name' => 'val', 'cakephp' => 'rocks']]);
+        $request = new ServerRequest([
+            'cookies' => [
+                'name' => 'val',
+                'cakephp' => 'rocks',
+                '123' => 'a integer key cookie',
+            ],
+        ]);
         $cookies = CookieCollection::createFromServerRequest($request);
-        $this->assertCount(2, $cookies);
+        $this->assertCount(3, $cookies);
         $this->assertTrue($cookies->has('name'));
         $this->assertTrue($cookies->has('cakephp'));
+        $this->assertTrue($cookies->has('123'));
 
         $cookie = $cookies->get('name');
         $this->assertSame('val', $cookie->getValue());
         $this->assertSame('/', $cookie->getPath());
         $this->assertSame('', $cookie->getDomain(), 'No domain on request cookies');
+
+        $cookie = $cookies->get('123');
+        $this->assertSame('a integer key cookie', $cookie->getValue());
     }
 }

+ 2 - 0
tests/TestCase/Http/ServerRequestTest.php

@@ -1628,9 +1628,11 @@ XML;
                 'user' => [
                     'remember' => '1',
                 ],
+                '123' => 'a integer key cookie',
             ],
         ]);
         $this->assertSame('A value in the cookie', $request->getCookie('testing'));
+        $this->assertSame('a integer key cookie', $request->getCookie('123'));
         $this->assertNull($request->getCookie('not there'));
         $this->assertSame('default', $request->getCookie('not there', 'default'));