Browse Source

Merge pull request #12488 from cakephp/73-compat

Add php7.3 to build matrix in allow failure mode.
Mark Story 7 years ago
parent
commit
9110e6c682

+ 13 - 4
.travis.yml

@@ -5,12 +5,15 @@ php:
   - 5.6
   - 5.6
   - 7.1
   - 7.1
   - 7.2
   - 7.2
+  - 7.3.0RC1
 
 
-dist: trusty
+sudo: required
+
+dist: xenial
 
 
 env:
 env:
   matrix:
   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=pgsql db_dsn='postgres://postgres@127.0.0.1/cakephp_test'
     - DB=sqlite db_dsn='sqlite:///:memory:'
     - DB=sqlite db_dsn='sqlite:///:memory:'
   global:
   global:
@@ -23,6 +26,9 @@ services:
   - mysql
   - mysql
 
 
 addons:
 addons:
+  apt:
+    packages:
+      - libzip4
   postgresql: "9.4"
   postgresql: "9.4"
 
 
 cache:
 cache:
@@ -42,7 +48,7 @@ matrix:
 
 
 before_install:
 before_install:
   - echo cakephp version && tail -1 VERSION.txt
   - echo cakephp version && tail -1 VERSION.txt
-  - phpenv config-rm xdebug.ini
+  - 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_test;'; fi
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test2;'; fi
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test2;'; fi
@@ -53,7 +59,10 @@ before_install:
   - if [ $DB = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi
   - 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 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 = 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 '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
   - 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#'
         - '#Method Cake\\View\\Form\\ContextInterface::val\(\) invoked with 2 parameters, 1 required#'
         - '#Access to an undefined property Exception::\$queryString#'
         - '#Access to an undefined property Exception::\$queryString#'
         - '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#'
         - '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#'
-        - '#Method Redis::#'
         - '#Call to an undefined method Traversable::getArrayCopy().#'
         - '#Call to an undefined method Traversable::getArrayCopy().#'
         - '#Variable \$config in isset\(\) is never defined#'
         - '#Variable \$config in isset\(\) is never defined#'
         - '#Call to static method id\(\) on an unknown class PHPUnit_Runner_Version#'
         - '#Call to static method id\(\) on an unknown class PHPUnit_Runner_Version#'

+ 2 - 2
src/Database/SqlDialectTrait.php

@@ -60,7 +60,7 @@ trait SqlDialectTrait
         }
         }
 
 
         // Alias.field AS thing
         // Alias.field AS thing
-        if (preg_match('/^([\w-]+(\.[\w-\s]+|\(.*\))*)\s+AS\s*([\w-]+)$/i', $identifier, $matches)) {
+        if (preg_match('/^([\w-]+(\.[\w\s-]+|\(.*\))*)\s+AS\s*([\w-]+)$/i', $identifier, $matches)) {
             return $this->quoteIdentifier($matches[1]) . ' AS ' . $this->quoteIdentifier($matches[3]);
             return $this->quoteIdentifier($matches[1]) . ' AS ' . $this->quoteIdentifier($matches[3]);
         }
         }
 
 
@@ -72,7 +72,7 @@ trait SqlDialectTrait
             return $this->_startQuote . $field . $this->_endQuote . $matches[2];
             return $this->_startQuote . $field . $this->_endQuote . $matches[2];
         }
         }
 
 
-        if (preg_match('/^[\w-_\s]*[\w-_]+/', $identifier)) {
+        if (preg_match('/^[\w_\s-]*[\w_-]+/', $identifier)) {
             return $this->_startQuote . $identifier . $this->_endQuote;
             return $this->_startQuote . $identifier . $this->_endQuote;
         }
         }
 
 

+ 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);
         $etags = preg_split('/\s*,\s*/', (string)$request->getHeaderLine('If-None-Match'), 0, PREG_SPLIT_NO_EMPTY);
         $responseTag = $this->getHeaderLine('Etag');
         $responseTag = $this->getHeaderLine('Etag');
+        $etagMatches = null;
         if ($responseTag) {
         if ($responseTag) {
             $etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
             $etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
         }
         }
 
 
         $modifiedSince = $request->getHeaderLine('If-Modified-Since');
         $modifiedSince = $request->getHeaderLine('If-Modified-Since');
+        $timeMatches = null;
         if ($modifiedSince && $this->hasHeader('Last-Modified')) {
         if ($modifiedSince && $this->hasHeader('Last-Modified')) {
             $timeMatches = strtotime($this->getHeaderLine('Last-Modified')) === strtotime($modifiedSince);
             $timeMatches = strtotime($this->getHeaderLine('Last-Modified')) === strtotime($modifiedSince);
         }
         }
-        $checks = compact('etagMatches', 'timeMatches');
-        if (empty($checks)) {
+        if ($etagMatches === null && $timeMatches === null) {
             return false;
             return false;
         }
         }
-        $notModified = !in_array(false, $checks, true);
+        $notModified = $etagMatches !== false && $timeMatches !== false;
         if ($notModified) {
         if ($notModified) {
             $this->notModified();
             $this->notModified();
         }
         }

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

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

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

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