From cb7ce78e32411c2dec58e9039c066e646de9de96 Mon Sep 17 00:00:00 2001 From: Gabriel Felipe Soares Date: Tue, 5 Jul 2022 10:47:05 +0200 Subject: [PATCH 01/12] chore: remove php requirement --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index a1c014dc0..fa7757db7 100755 --- a/composer.json +++ b/composer.json @@ -54,7 +54,6 @@ "tao-extension-name": "generis" }, "require": { - "php": "^7.1", "clearfw/clearfw": "~1.2.0", "easyrdf/easyrdf": "^1.1", "doctrine/dbal": "^2.10.1", From fdca2fe7d95bfc8eabd10978f0ccdf09db06df48 Mon Sep 17 00:00:00 2001 From: Gabriel Felipe Soares Date: Tue, 5 Jul 2022 13:22:24 +0200 Subject: [PATCH 02/12] fix: update wrong validation bypassed by php 7.4 --- common/oatbox/log/VerboseLogger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/oatbox/log/VerboseLogger.php b/common/oatbox/log/VerboseLogger.php index 16120b0ef..55b820d05 100644 --- a/common/oatbox/log/VerboseLogger.php +++ b/common/oatbox/log/VerboseLogger.php @@ -53,7 +53,7 @@ class VerboseLogger extends AbstractLogger */ public function __construct($minimumLevel) { - if (! in_array($minimumLevel, array_keys($this->levels))) { + if (!in_array($minimumLevel, $this->levels, true)) { throw new \common_Exception('Level "' . $minimumLevel . '" is not managed by verbose logger'); } $this->levelPosition = array_search($minimumLevel, $this->levels); From 72a859da3120573d0473ff29e821a48936dde4bc Mon Sep 17 00:00:00 2001 From: Gabriel Felipe Soares Date: Tue, 5 Jul 2022 14:50:03 +0200 Subject: [PATCH 03/12] chore: update doctrine version --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index fa7757db7..2c1e04a3a 100755 --- a/composer.json +++ b/composer.json @@ -56,8 +56,8 @@ "require": { "clearfw/clearfw": "~1.2.0", "easyrdf/easyrdf": "^1.1", - "doctrine/dbal": "^2.10.1", - "doctrine/annotations": "^1.6.0", + "doctrine/dbal": "2.12.*", + "doctrine/annotations": "~1.6.0", "laminas/laminas-servicemanager": "~2.5.0", "league/flysystem": "~1.0", "league/flysystem-memory": "~1.0", From cfd448a7bddebed2805bed68db4fc778f593d92c Mon Sep 17 00:00:00 2001 From: Gabriel Felipe Soares Date: Fri, 8 Jul 2022 08:30:50 +0200 Subject: [PATCH 04/12] chore: remove static scope for callable using $this --- test/unit/core/Middleware/MiddlewareRequestHandlerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/core/Middleware/MiddlewareRequestHandlerTest.php b/test/unit/core/Middleware/MiddlewareRequestHandlerTest.php index 1d297326e..735c20dbd 100755 --- a/test/unit/core/Middleware/MiddlewareRequestHandlerTest.php +++ b/test/unit/core/Middleware/MiddlewareRequestHandlerTest.php @@ -94,7 +94,7 @@ public function testAssertRoute(string $path, string $httpMethod, array $middlew $queue = array_merge( array_values($middlewaresMocks), [ - static function ($request, $next): ResponseInterface { + function ($request, $next): ResponseInterface { return $this->originalResponse; } ] @@ -175,7 +175,7 @@ public function testAssertNoRoute(string $path, string $httpMethod): void { $queue = array_merge( [ - static function ($request, $next): ResponseInterface { + function ($request, $next): ResponseInterface { return $this->originalResponse; } ] From 90577264102a11489b66a6e438fafb339093fa8b Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Tue, 12 Jul 2022 14:32:14 +0000 Subject: [PATCH 05/12] refactor: fix php 8 compatibility --- common/cache/class.SingletonCache.php | 12 ++++++------ test/integration/mutex/test_action.php | 7 ++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/common/cache/class.SingletonCache.php b/common/cache/class.SingletonCache.php index 0a1dd76fd..ce33c2ad5 100755 --- a/common/cache/class.SingletonCache.php +++ b/common/cache/class.SingletonCache.php @@ -55,14 +55,14 @@ public static function singleton() { $returnValue = null; - + $cacheName = get_called_class(); if (!isset(self::$instances[$cacheName])) { self::$instances[$cacheName] = new $cacheName(); } - + $returnValue = self::$instances[$cacheName]; - + return $returnValue; } @@ -78,7 +78,7 @@ public static function getCached($function) { $returnValue = null; - + $args = func_get_args(); array_shift($args); if (!is_string($function)) { @@ -94,10 +94,10 @@ public static function getCached($function) if (static::singleton()->has($serial)) { $returnValue = static::singleton()->has($serial); } else { - $returnValue = call_user_func_array($fn, $args); + $returnValue = call_user_func_array($function, $args); static::singleton()->put($serial, $returnValue); } - + return $returnValue; } diff --git a/test/integration/mutex/test_action.php b/test/integration/mutex/test_action.php index cef85c12c..fc8c06439 100644 --- a/test/integration/mutex/test_action.php +++ b/test/integration/mutex/test_action.php @@ -10,17 +10,14 @@ $sleep = (int) $argv[1]; $timeout = (int) $argv[2]; -$service = getInstance(); +$service = getLockServiceInstance(); $factory = $service->getLockFactory(); $lock = $factory->createLock($actionId, $timeout); $lock->acquire(true); sleep($sleep); $lock->release(); -/** - * @return LockService - */ -function getInstance() +function getLockServiceInstance(): LockService { return ServiceManager::getServiceManager()->get(LockService::class); } From 39ea59a26e219a624f6406d91b4f5db3eb589c73 Mon Sep 17 00:00:00 2001 From: Gabriel Felipe Soares Date: Wed, 13 Jul 2022 10:15:07 +0200 Subject: [PATCH 06/12] chore: update doctrine version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2c1e04a3a..49ff02408 100755 --- a/composer.json +++ b/composer.json @@ -57,7 +57,7 @@ "clearfw/clearfw": "~1.2.0", "easyrdf/easyrdf": "^1.1", "doctrine/dbal": "2.12.*", - "doctrine/annotations": "~1.6.0", + "doctrine/annotations": "1.13.*", "laminas/laminas-servicemanager": "~2.5.0", "league/flysystem": "~1.0", "league/flysystem-memory": "~1.0", From 3c6317c32383500636a2eab9508223c989eef7d1 Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Mon, 18 Jul 2022 21:13:21 +0200 Subject: [PATCH 07/12] fix: relax a dependency on `mikey179/vfsstream` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 49ff02408..af1d9466e 100755 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "ext-pdo": "*" }, "require-dev": { - "mikey179/vfsstream": "1.4.0", + "mikey179/vfsstream": "~1", "phpunit/phpunit": "^8.5", "php-mock/php-mock": "^2.0" }, From bca3c3f001352d5d0ca8b8bcb87f9963c48cad6d Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Mon, 18 Jul 2022 21:20:38 +0200 Subject: [PATCH 08/12] fix: `ConfigurationTest` --- test/unit/ConfigurationTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unit/ConfigurationTest.php b/test/unit/ConfigurationTest.php index 9b450b46b..6f8efa6d8 100755 --- a/test/unit/ConfigurationTest.php +++ b/test/unit/ConfigurationTest.php @@ -99,7 +99,7 @@ function testPHPRuntime() $this->assertTrue($php->isOptional()); // max & min test. - $php = new \common_configuration_PHPRuntime('5.3', '7.4.x'); + $php = new \common_configuration_PHPRuntime('7.4', '8.1.x'); $report = $php->check(); $this->assertEquals($report->getStatus(), \common_configuration_Report::VALID); @@ -169,7 +169,7 @@ function testPHPExtension() $report = $ext->check(); $this->assertEquals($report->getStatus(), \common_configuration_Report::VALID); - $ext->setMax('7.5'); + $ext->setMax('8.2'); $report = $ext->check(); $this->assertEquals($report->getStatus(), \common_configuration_Report::VALID); @@ -310,7 +310,7 @@ public function testSimpleComponentCollection() public function testComponentFactory() { - $component = \common_configuration_ComponentFactory::buildPHPRuntime('5.0', '7.4.x', true); + $component = \common_configuration_ComponentFactory::buildPHPRuntime('5.0', '8.1.x', true); $this->assertInstanceOf(\common_configuration_PHPRuntime::class, $component); $this->assertEquals($component->getMin(), '5.0'); // 5.5.x will be replaced internally @@ -353,7 +353,7 @@ public function testComponentFactory() $this->assertInstanceOf(\common_configuration_Report::class, $report); $this->assertEquals($report->getStatus(), \common_configuration_Report::VALID); - $array = ['type' => 'PHPRuntime', 'value' => ['min' => '5.0', 'max' => '7.4.x', 'optional' => true]]; + $array = ['type' => 'PHPRuntime', 'value' => ['min' => '5.0', 'max' => '8.1.x', 'optional' => true]]; $component = \common_configuration_ComponentFactory::buildFromArray($array); $this->assertInstanceOf(\common_configuration_PHPRuntime::class, $component); $this->assertEquals($component->getMin(), '5.0'); From 9403158ae492fbd90dda54b1245b77230c5ec813 Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Mon, 18 Jul 2022 21:24:50 +0200 Subject: [PATCH 09/12] fix: `ComponentFactoryTest` --- test/unit/common/configuration/ComponentFactoryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/common/configuration/ComponentFactoryTest.php b/test/unit/common/configuration/ComponentFactoryTest.php index b4fa541d1..f30f5779b 100644 --- a/test/unit/common/configuration/ComponentFactoryTest.php +++ b/test/unit/common/configuration/ComponentFactoryTest.php @@ -98,11 +98,11 @@ public function testBuildFileSystemComponent() $this->assertTrue($output->isOptional()); $this->assertTrue($output->getRecursive()); $this->assertTrue($output->getMustCheckIfEmpty()); - $this->assertEquals('FileSystemComponentCheck_3', $output->getName()); + $this->assertStringStartsWith('FileSystemComponentCheck_', $output->getName()); $output2 = $this->subject->buildFileSystemComponent('/path2', 'rw'); - $this->assertEquals('FileSystemComponentCheck_4', $output2->getName()); + $this->assertStringStartsWith('FileSystemComponentCheck_', $output2->getName()); } public function testBuildCustomFailureOnNonExistingExtension() From 563961fb4ba84325a623488d9127c5ae35efe684 Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Mon, 18 Jul 2022 21:25:38 +0200 Subject: [PATCH 10/12] chore: exclude PHP 7.2 and 7.4 from the CI pipeline --- .github/workflows/continuous-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index c230671d0..7829b6f1f 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -14,9 +14,9 @@ jobs: fail-fast: false matrix: operating-system: [ ubuntu-latest ] - php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1' ] + php-version: [ '7.4', '8.0', '8.1' ] include: - - php-version: '7.2' + - php-version: '8.1' coverage: true steps: From 35ddb5ba2246020ef86d4589d5535fa7e8cfb89a Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Wed, 20 Jul 2022 12:38:29 +0200 Subject: [PATCH 11/12] fix: LockServiceTest --- test/unit/oatbox/mutex/test_action.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/unit/oatbox/mutex/test_action.php b/test/unit/oatbox/mutex/test_action.php index 81f2ed39f..19d080344 100644 --- a/test/unit/oatbox/mutex/test_action.php +++ b/test/unit/oatbox/mutex/test_action.php @@ -1,11 +1,6 @@ Date: Fri, 22 Jul 2022 10:30:26 +0200 Subject: [PATCH 12/12] fix: avoid trying to read unreadable file --- common/persistence/class.PhpFileDriver.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/common/persistence/class.PhpFileDriver.php b/common/persistence/class.PhpFileDriver.php index 9ad0b1da0..af4e7b12d 100755 --- a/common/persistence/class.PhpFileDriver.php +++ b/common/persistence/class.PhpFileDriver.php @@ -52,7 +52,7 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c * @var string */ private $directory; - + /** * Nr of subfolder levels in order to prevent filesystem bottlenecks * Only used in non human readable mode @@ -60,7 +60,7 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c * @var int */ private $levels; - + /** * Whenever or not the filenames should be human readable * FALSE by default for performance issues with many keys @@ -81,7 +81,7 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c * @var int */ const DEFAULT_LEVELS = 3; - + const DEFAULT_MASK = 0700; /** @@ -103,7 +103,7 @@ public function connect($id, array $params) return new common_persistence_KeyValuePersistence($params, $this); } - + /** * (non-PHPdoc) * @see common_persistence_KvDriver::set() @@ -239,7 +239,13 @@ public function get($id) */ private function readFile($id) { - return @include $this->getPath($id); + $path = $this->getPath($id); + + if (is_readable($path)) { + return @include $path; + } + + return false; } /** @@ -264,7 +270,7 @@ public function exists($id) return $this->get($id) !== false; } } - + /** * (non-PHPdoc) * @see common_persistence_KvDriver::del() @@ -386,7 +392,7 @@ protected function getPath($key) } return $this->directory . $path . '.php'; } - + /** * Cannot use helpers_File::sanitizeInjectively() because * of backwards compatibility @@ -402,7 +408,7 @@ protected function sanitizeReadableFileName($key) } return $path; } - + /** * Generate the php code that returns the provided value *