Browse Source

Merge branch 'master' into 3.next

ADmad 7 years ago
parent
commit
6ab7f35834

+ 14 - 4
.travis.yml

@@ -5,12 +5,15 @@ php:
   - 5.6
   - 7.1
   - 7.2
+  - 7.3.0RC1
 
-dist: trusty
+sudo: required
+
+dist: xenial
 
 env:
   matrix:
-    - DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test'
+    - DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
     - DB=pgsql db_dsn='postgres://postgres@127.0.0.1/cakephp_test'
     - DB=sqlite db_dsn='sqlite:///:memory:'
   global:
@@ -23,6 +26,9 @@ services:
   - mysql
 
 addons:
+  apt:
+    packages:
+      - libzip4
   postgresql: "9.4"
 
 cache:
@@ -41,7 +47,8 @@ matrix:
       env: PHPSTAN=1 DEFAULT=0
 
 before_install:
-  - phpenv config-rm xdebug.ini
+  - echo cakephp version && tail -1 VERSION.txt
+  - if [[ ${TRAVIS_PHP_VERSION} != "7.3.0RC1" ]]; then phpenv config-rm xdebug.ini; fi
 
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test2;'; fi
@@ -52,7 +59,10 @@ before_install:
   - if [ $DB = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi
 
   - if [[ $DEFAULT = 1 || $PHPSTAN = 1 ]] ; then pecl channel-update pecl.php.net; fi;
-  - if [[ $DEFAULT = 1 || $PHPSTAN = 1 ]] ; then echo 'extension = memcached.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
+  - |
+      if [[ ${TRAVIS_PHP_VERSION} != "7.3.0RC1" && ${TRAVIS_PHP_VERSION} != "5.6" && ($DEFAULT = 1 || $PHPSTAN = 1) ]]; then
+        echo 'extension = memcached.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini;
+      fi
   - if [[ $DEFAULT = 1 || $PHPSTAN = 1 ]] ; then echo 'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
   - if [[ $DEFAULT = 1 || $PHPSTAN = 1 ]] ; then echo 'extension = apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
   - if [[ $DEFAULT = 1 || $PHPSTAN = 1 ]] ; then echo 'apc.enable_cli = 1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi

+ 0 - 1
phpstan.neon

@@ -17,7 +17,6 @@ parameters:
         - '#Method Cake\\View\\Form\\ContextInterface::val\(\) invoked with 2 parameters, 1 required#'
         - '#Access to an undefined property Exception::\$queryString#'
         - '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#'
-        - '#Method Redis::#'
         - '#Call to an undefined method Traversable::getArrayCopy().#'
         - '#Variable \$config in isset\(\) is never defined#'
         - '#Call to static method id\(\) on an unknown class PHPUnit_Runner_Version#'

+ 4 - 3
src/Http/Response.php

@@ -2055,19 +2055,20 @@ class Response implements ResponseInterface
     {
         $etags = preg_split('/\s*,\s*/', (string)$request->getHeaderLine('If-None-Match'), 0, PREG_SPLIT_NO_EMPTY);
         $responseTag = $this->getHeaderLine('Etag');
+        $etagMatches = null;
         if ($responseTag) {
             $etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
         }
 
         $modifiedSince = $request->getHeaderLine('If-Modified-Since');
+        $timeMatches = null;
         if ($modifiedSince && $this->hasHeader('Last-Modified')) {
             $timeMatches = strtotime($this->getHeaderLine('Last-Modified')) === strtotime($modifiedSince);
         }
-        $checks = compact('etagMatches', 'timeMatches');
-        if (empty($checks)) {
+        if ($etagMatches === null && $timeMatches === null) {
             return false;
         }
-        $notModified = !in_array(false, $checks, true);
+        $notModified = $etagMatches !== false && $timeMatches !== false;
         if ($notModified) {
             $this->notModified();
         }

+ 1 - 1
tests/TestCase/Cache/Engine/FileEngineTest.php

@@ -335,7 +335,7 @@ class FileEngineTest extends TestCase
             'engine' => 'File',
             'isWindows' => true,
             'prefix' => null,
-            'path' => TMP
+            'path' => CACHE
         ]);
 
         $expected = [

+ 4 - 4
tests/TestCase/Controller/Component/CookieComponentTest.php

@@ -671,16 +671,16 @@ class CookieComponentTest extends TestCase
         ]);
 
         $data = $this->Cookie->read('Encrypted_empty');
-        $this->assertEquals('', $data);
+        $this->assertSame('', $data);
 
         $data = $this->Cookie->read('Encrypted_wrong_prefix');
-        $this->assertEquals('', $data);
+        $this->assertSame('', $data);
 
         $data = $this->Cookie->read('Encrypted_altered');
-        $this->assertEquals('', $data);
+        $this->assertSame('', $data);
 
         $data = $this->Cookie->read('Encrypted_invalid_chars');
-        $this->assertEquals('', $data);
+        $this->assertSame('', $data);
     }
 
     /**

+ 3 - 3
tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php

@@ -467,7 +467,7 @@ class RoutingMiddlewareTest extends TestCase
         $cacheConfigName = '_cake_router_';
         Cache::setConfig($cacheConfigName, [
             'engine' => 'File',
-            'path' => TMP,
+            'path' => CACHE,
         ]);
         Router::$initialized = false;
         $request = ServerRequestFactory::fromGlobals(['REQUEST_URI' => '/articles']);
@@ -497,7 +497,7 @@ class RoutingMiddlewareTest extends TestCase
         Cache::disable();
         Cache::setConfig($cacheConfigName, [
             'engine' => 'File',
-            'path' => TMP,
+            'path' => CACHE,
         ]);
         Router::$initialized = false;
         $request = ServerRequestFactory::fromGlobals(['REQUEST_URI' => '/articles']);
@@ -529,7 +529,7 @@ class RoutingMiddlewareTest extends TestCase
 
         Cache::setConfig('_cake_router_', [
             'engine' => 'File',
-            'path' => TMP,
+            'path' => CACHE,
         ]);
         Router::$initialized = false;
         $request = ServerRequestFactory::fromGlobals(['REQUEST_URI' => '/articles']);