Browse Source

Merge pull request #13433 from cakephp/travis-php7.4

Run testsuite on PHP 7.4.
Mark Sch 6 years ago
parent
commit
53718eb520

+ 9 - 2
.travis.yml

@@ -5,6 +5,7 @@ php:
   - 5.6
   - 7.2
   - 7.3
+  - '7.4snapshot'
 
 dist: trusty
 
@@ -45,9 +46,15 @@ matrix:
     - php: 7.1
       env: CODECOVERAGE=1 DEFAULT=0
 
+  allow_failures:
+    - php: '7.4snapshot'
+
 before_install:
   - echo cakephp version && tail -1 VERSION.txt
-  - phpenv config-rm xdebug.ini
+  - |
+      if [[ ${TRAVIS_PHP_VERSION} != "7.4snapshot" ]]; 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
@@ -66,7 +73,7 @@ before_install:
   - echo 'extension = apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
   - echo 'apc.enable_cli = 1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
 
-  - if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]] ; then echo "yes" | pecl install channel://pecl.php.net/apcu-5.1.5 || true; fi
+  - if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]] ; then echo "yes" | pecl install channel://pecl.php.net/apcu-5.1.17 || true; fi
   - if [[ ${TRAVIS_PHP_VERSION:0:1} == "5" ]] ; then echo "yes" | pecl install apcu-4.0.11 || true; fi
   - |
       if [[ ${TRAVIS_PHP_VERSION:0:1} == "5" && $DB = 'mysql' ]]; then

+ 2 - 2
src/Console/ConsoleOptionParser.php

@@ -1073,8 +1073,8 @@ class ConsoleOptionParser
         if (substr($name, 0, 2) === '--') {
             return isset($this->_options[substr($name, 2)]);
         }
-        if ($name{0} === '-' && $name{1} !== '-') {
-            return isset($this->_shortOptions[$name{1}]);
+        if ($name[0] === '-' && $name[1] !== '-') {
+            return isset($this->_shortOptions[$name[1]]);
         }
 
         return false;

+ 1 - 1
src/Filesystem/Folder.php

@@ -596,7 +596,7 @@ class Folder
         foreach ($iterator as $itemPath => $fsIterator) {
             if ($skipHidden) {
                 $subPathName = $fsIterator->getSubPathname();
-                if ($subPathName{0} === '.' || strpos($subPathName, DIRECTORY_SEPARATOR . '.') !== false) {
+                if ($subPathName[0] === '.' || strpos($subPathName, DIRECTORY_SEPARATOR . '.') !== false) {
                     continue;
                 }
             }

+ 1 - 1
src/TestSuite/TestCase.php

@@ -492,7 +492,7 @@ abstract class TestCase extends BaseTestCase
                 $tags = (string)$tags;
             }
             $i++;
-            if (is_string($tags) && $tags{0} === '<') {
+            if (is_string($tags) && $tags[0] === '<') {
                 $tags = [substr($tags, 1) => []];
             } elseif (is_string($tags)) {
                 $tagsTrimmed = preg_replace('/\s+/m', '', $tags);

+ 6 - 1
src/Utility/Hash.php

@@ -253,8 +253,13 @@ class Hash
                 return false;
             }
 
+            if (is_array($data)) {
+                $attrPresent = array_key_exists($attr, $data);
+            } else {
+                $attrPresent = $data->offsetExists($attr);
+            }
             // Empty attribute = fail.
-            if (!(isset($data[$attr]) || array_key_exists($attr, $data))) {
+            if (!$attrPresent) {
                 return false;
             }
 

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

@@ -2061,7 +2061,7 @@ class FormHelper extends Helper
         if ($isUrl) {
             $options['src'] = $caption;
         } elseif ($isImage) {
-            if ($caption{0} !== '/') {
+            if ($caption[0] !== '/') {
                 $url = $this->Url->webroot(Configure::read('App.imageBaseUrl') . $caption);
             } else {
                 $url = $this->Url->webroot(trim($caption, '/'));