From 7b44fc7bce54fc6dca9161dda7d3def25a1be23e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 26 Oct 2016 14:31:45 +1300 Subject: [PATCH 1/4] FIX: Fix SSViewerTest in PHP7 PHP7 is a bit more picky about passing values by reference. --- tests/view/SSViewerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/view/SSViewerTest.php b/tests/view/SSViewerTest.php index c9f020a3b..ddf13feff 100644 --- a/tests/view/SSViewerTest.php +++ b/tests/view/SSViewerTest.php @@ -1551,7 +1551,7 @@ EOC; $parser = new SSTemplateParser(); $parser->addClosedBlock( 'test', - function (&$res) use (&$count) { + function ($res) use (&$count) { $count++; } ); @@ -1567,7 +1567,7 @@ EOC; $parser = new SSTemplateParser(); $parser->addOpenBlock( 'test', - function (&$res) use (&$count) { + function ($res) use (&$count) { $count++; } ); From c80417a949c7f2821ab4ce1f76ccbc5b6649fcaf Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 26 Oct 2016 14:37:58 +1300 Subject: [PATCH 2/4] FIX: Fix ViewableData::__isset() for getXXX() getters. PHP7 is stricter about this. --- View/ViewableData.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/View/ViewableData.php b/View/ViewableData.php index 48c542fd4..07af74020 100644 --- a/View/ViewableData.php +++ b/View/ViewableData.php @@ -81,12 +81,25 @@ class ViewableData extends Object implements IteratorAggregate { /** * Check if a field exists on this object or its failover. + * Note that, unlike the core isset() implementation, this will return true if the property is defined + * and set to null. * * @param string $property * @return bool */ public function __isset($property) { - return $this->hasField($property) || ($this->failover && $this->failover->hasField($property)); + // getField() isn't a field-specific getter and shouldn't be treated as such + if(strtolower($property) !== 'field' && $this->hasMethod($method = "get$property")) { + return true; + + } elseif($this->hasField($property)) { + return true; + + } elseif($this->failover) { + return isset($this->failover->$property); + } + + return false; } /** @@ -97,13 +110,17 @@ class ViewableData extends Object implements IteratorAggregate { * @return mixed */ public function __get($property) { - if($this->hasMethod($method = "get$property")) { + // getField() isn't a field-specific getter and shouldn't be treated as such + if(strtolower($property) !== 'field' && $this->hasMethod($method = "get$property")) { return $this->$method(); + } elseif($this->hasField($property)) { return $this->getField($property); + } elseif($this->failover) { return $this->failover->$property; } + return null; } From 015411307d7e9a6479914cfb8832da558188c4af Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 26 Oct 2016 14:48:58 +1300 Subject: [PATCH 3/4] FIX: Require php7 support. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5658bbfcb..0b7daa927 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,8 +41,6 @@ matrix: env: DB=MYSQL CMS_TEST=1 PHPUNIT_TEST=1 - php: 5.6 env: DB=MYSQL CMS_TEST=1 BEHAT_TEST=1 - - php: 7.0 - env: DB=MYSQL PDO=1 PHPUNIT_COVERAGE_TEST=1 before_script: - printf "\n" | pecl install imagick From c47a1d9091c4cba52109c7fa9d9a46ac57d4ea93 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 26 Oct 2016 16:16:35 +1300 Subject: [PATCH 4/4] NEW: Simplified test runs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don’t use SQLite in production and so it doesn’t need to be part of our build matrix. --- .travis.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b7daa927..a1dcb461f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,14 +18,12 @@ env: matrix: fast_finish: true include: - - php: 5.5 - env: DB=MYSQL PHPUNIT_TEST=1 - php: 5.5 env: DB=PGSQL PHPUNIT_TEST=1 - - php: 5.5 - env: DB=SQLITE PHPUNIT_TEST=1 - php: 5.6 - env: DB=MYSQL PDO=1 PHPUNIT_TEST=1 + env: DB=MYSQL PHPUNIT_TEST=1 + - php: 7.0 + env: DB=MYSQL PDO=1 PHPUNIT_COVERAGE_TEST=1 - php: 5.6 env: DB=MYSQL BEHAT_TEST=1 - php: 5.6 @@ -34,8 +32,6 @@ matrix: env: DB=MYSQL CMS_TEST=1 PHPUNIT_TEST=1 - php: 5.6 env: DB=MYSQL CMS_TEST=1 BEHAT_TEST=1 - - php: 7.0 - env: DB=MYSQL PDO=1 PHPUNIT_COVERAGE_TEST=1 allow_failures: - php: 5.6 env: DB=MYSQL CMS_TEST=1 PHPUNIT_TEST=1