diff --git a/.travis.yml b/.travis.yml index c4bec90f7..46d90171d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,15 +41,13 @@ matrix: - php: 7.2 env: DB=mysql PHPUNIT=5.7.19 - allow_failures: + exclude: - php: 7.2 env: DB=mysql - - php: 7.2 - env: DB=mysql PHPUNIT=5.7.19 - before_script: + - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]] ; then pear config-set preferred_state snapshot && yes "" | pecl install mcrypt ; fi - composer require "phpunit/phpunit=$PHPUNIT" - echo "require_once 'vendors/autoload.php';" >> app/Config/bootstrap.php - sudo locale-gen de_DE @@ -62,7 +60,6 @@ before_script: - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi" - chmod -R 777 ./app/tmp - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.3" ]] ; then pecl install timezonedb ; fi - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]] ; then pecl install mcrypt ; fi - sh -c "if [ '$PHPCS' = '1' ]; then composer require 'cakephp/cakephp-codesniffer:1.*'; fi" - sh -c "if [ '$PHPCS' = '1' ]; then vendors/bin/phpcs --config-set installed_paths vendors/cakephp/cakephp-codesniffer; fi" - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php index 7515779f9..433329d6f 100644 --- a/lib/Cake/Console/Command/Task/ControllerTask.php +++ b/lib/Cake/Console/Command/Task/ControllerTask.php @@ -331,6 +331,12 @@ class ControllerTask extends BakeTask { public function bake($controllerName, $actions = '', $helpers = null, $components = null) { $this->out("\n" . __d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET); + if ($helpers === null) { + $helpers = array(); + } + if ($components === null) { + $components = array(); + } $isScaffold = ($actions === 'scaffold') ? true : false; $this->Template->set(array( diff --git a/lib/Cake/I18n/Multibyte.php b/lib/Cake/I18n/Multibyte.php index 797044a85..c11082ac0 100644 --- a/lib/Cake/I18n/Multibyte.php +++ b/lib/Cake/I18n/Multibyte.php @@ -554,7 +554,7 @@ class Multibyte { if (!empty($keys)) { foreach ($keys as $key => $value) { - if ($keys[$key]['upper'] == $char && count($keys[$key]['lower'][0]) === 1) { + if ($keys[$key]['upper'] == $char && count($keys[$key]['lower']) > 0) { $lowerCase[] = $keys[$key]['lower'][0]; $matched = true; break 1; diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 8e9429b53..fec94fcf3 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -552,6 +552,12 @@ class CakeSession { if (!empty($sessionConfig['handler'])) { $sessionConfig['ini']['session.save_handler'] = 'user'; + + // In PHP7.2.0+ session.save_handler can't be set to 'user' by the user. + // https://github.com/php/php-src/commit/a93a51c3bf4ea1638ce0adc4a899cb93531b9f0d + if (version_compare(PHP_VERSION, '7.2.0', '>=')) { + unset($sessionConfig['ini']['session.save_handler']); + } } elseif (!empty($sessionConfig['session.save_path']) && Configure::read('debug')) { if (!is_dir($sessionConfig['session.save_path'])) { mkdir($sessionConfig['session.save_path'], 0775, true); diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index 09e99c92e..2b25e5827 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -415,6 +415,7 @@ class AuthComponentTest extends CakeTestCase { TestAuthComponent::clearUser(); $this->Auth->Session->delete('Auth'); $this->Auth->Session->delete('Message.auth'); + $this->Auth->Session->destroy(); unset($this->Controller, $this->Auth); } diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index 6d89c2030..c2879b39f 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -120,11 +120,11 @@ class ControllerPaginateModel extends CakeTestModel { /** * paginate method * - * @return bool + * @return array */ public function paginate($conditions, $fields, $order, $limit, $page, $recursive, $extra) { $this->extra = $extra; - return true; + return array(true); } /** diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php index 16951425f..4edaf935a 100644 --- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php @@ -186,6 +186,7 @@ class SecurityComponentTest extends CakeTestCase { public function tearDown() { parent::tearDown(); $this->Controller->Session->delete('_Token'); + $this->Controller->Session->destroy(); unset($this->Controller->Security); unset($this->Controller->Component); unset($this->Controller); diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index 14fa64b15..ec6b4eb46 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -17,6 +17,7 @@ */ App::uses('Router', 'Routing'); +App::uses('CakeSession', 'Model/Datasource'); App::uses('Controller', 'Controller'); App::uses('Scaffold', 'Controller'); App::uses('ScaffoldView', 'View'); @@ -175,6 +176,7 @@ class ScaffoldTest extends CakeTestCase { */ public function tearDown() { parent::tearDown(); + CakeSession::destroy(); unset($this->Controller); } diff --git a/lib/Cake/Test/Case/I18n/I18nTest.php b/lib/Cake/Test/Case/I18n/I18nTest.php index fd8cc36d2..3c3df309d 100644 --- a/lib/Cake/Test/Case/I18n/I18nTest.php +++ b/lib/Cake/Test/Case/I18n/I18nTest.php @@ -51,6 +51,7 @@ class I18nTest extends CakeTestCase { parent::tearDown(); Cache::delete('object_map', '_cake_core_'); + CakeSession::destroy(); App::build(); CakePlugin::unload(); } diff --git a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php index abd7b5fa6..5181842ad 100644 --- a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php +++ b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php @@ -64,7 +64,7 @@ class ConnectionManagerTest extends CakeTestCase { ConnectionManager::create($name, $config); $connections = ConnectionManager::enumConnectionObjects(); - $this->assertTrue((bool)(count(array_keys($connections) >= 1))); + $this->assertTrue(count(array_keys($connections)) >= 1); $source = ConnectionManager::getDataSource('test_get_datasource'); $this->assertTrue(is_object($source)); @@ -239,7 +239,7 @@ class ConnectionManagerTest extends CakeTestCase { $name = 'test_created_connection'; $connections = ConnectionManager::enumConnectionObjects(); - $this->assertTrue((bool)(count(array_keys($connections) >= 1))); + $this->assertTrue(count(array_keys($connections)) >= 1); $source = ConnectionManager::getDataSource('test'); $this->assertTrue(is_object($source)); diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 52f99908f..d0ea8fddd 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -3367,7 +3367,9 @@ class ModelWriteTest extends BaseModelTest { array( 'comment' => 'Article comment', 'user_id' => 1 - ))); + ) + ) + ); $Article = new Article(); $result = $Article->saveAll($data); $this->assertFalse(empty($result)); @@ -3376,7 +3378,7 @@ class ModelWriteTest extends BaseModelTest { $this->assertEquals(2, count($result['Tag'])); $this->assertEquals('tag1', $result['Tag'][0]['tag']); $this->assertEquals(1, count($result['Comment'])); - $this->assertEquals(1, count($result['Comment'][0]['comment'])); + $this->assertEquals('Article comment', $result['Comment'][0]['comment']); } /** @@ -5647,7 +5649,9 @@ class ModelWriteTest extends BaseModelTest { array( 'comment' => 'Article comment', 'user_id' => 1 - ))); + ) + ) + ); $Article = new Article(); $result = $Article->saveAssociated($data); $this->assertFalse(empty($result)); @@ -5656,7 +5660,7 @@ class ModelWriteTest extends BaseModelTest { $this->assertEquals(2, count($result['Tag'])); $this->assertEquals('tag1', $result['Tag'][0]['tag']); $this->assertEquals(1, count($result['Comment'])); - $this->assertEquals(1, count($result['Comment'][0]['comment'])); + $this->assertEquals('Article comment', $result['Comment'][0]['comment']); } /** diff --git a/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php b/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php index f373218a7..5ff9737c6 100644 --- a/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php @@ -87,6 +87,7 @@ class SessionHelperTest extends CakeTestCase { public function tearDown() { $_SESSION = array(); unset($this->View, $this->Session); + CakeSession::destroy(); CakePlugin::unload(); parent::tearDown(); }