From 411e31c48cc98f50aeca621ed2fc95bfae663890 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 27 Sep 2017 09:33:19 +0200 Subject: [PATCH] build with php 7.2 --- .travis.yml | 1 + composer.json | 2 +- src/PHPCR/Util/Console/Helper/PhpcrHelper.php | 4 +++- src/PHPCR/Util/QOM/Sql1Generator.php | 4 +++- src/PHPCR/Util/QOM/Sql2Generator.php | 4 +++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b813824..c465361 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 env: - PACKAGE_VERSION=high diff --git a/composer.json b/composer.json index 71e3cd6..541e5d4 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ } ], "require": { - "php": "^5.6|7.0.x|7.1.x", + "php": "^5.6|^7.0", "phpcr/phpcr": "~2.1.0", "symfony/console": "~2.3|~3.0" }, diff --git a/src/PHPCR/Util/Console/Helper/PhpcrHelper.php b/src/PHPCR/Util/Console/Helper/PhpcrHelper.php index d0aea35..719d0e9 100644 --- a/src/PHPCR/Util/Console/Helper/PhpcrHelper.php +++ b/src/PHPCR/Util/Console/Helper/PhpcrHelper.php @@ -115,7 +115,9 @@ public function processNode(OutputInterface $output, NodeInterface $node, array ); } else { $closureString = $closure; - $closure = create_function('$session, $node', $closure); + $closure = function (SessionInterface $session, NodeInterface $node) use ($closureString) { + eval($closureString); + }; $output->writeln(sprintf( ' > Applying closure: %s', strlen($closureString) > 75 ? substr($closureString, 0, 72).'...' : $closureString diff --git a/src/PHPCR/Util/QOM/Sql1Generator.php b/src/PHPCR/Util/QOM/Sql1Generator.php index 2f9d6c4..1f1bfc3 100644 --- a/src/PHPCR/Util/QOM/Sql1Generator.php +++ b/src/PHPCR/Util/QOM/Sql1Generator.php @@ -120,7 +120,9 @@ public function evalFullTextSearch($selectorName, $searchExpression, $propertyNa */ public function evalColumns($columns) { - if (count($columns) === 0) { + if ((!is_array($columns) && !$columns instanceof \Countable) + || count($columns) === 0 + ) { return 's'; } diff --git a/src/PHPCR/Util/QOM/Sql2Generator.php b/src/PHPCR/Util/QOM/Sql2Generator.php index 21f29eb..95e2146 100644 --- a/src/PHPCR/Util/QOM/Sql2Generator.php +++ b/src/PHPCR/Util/QOM/Sql2Generator.php @@ -325,7 +325,9 @@ public function evalPropertyValue($propertyName, $selectorName = null) */ public function evalColumns($columns) { - if (count($columns) === 0) { + if ((!is_array($columns) && !$columns instanceof \Countable) + || count($columns) === 0 + ) { return '*'; }