From 4429acb6ecc893facc24e03b0431b4a50c371561 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 11 Jul 2018 14:03:00 +1200 Subject: [PATCH] Ensure that the version number has a major, minor and patch number --- code/extractors/TikaServerTextExtractor.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/extractors/TikaServerTextExtractor.php b/code/extractors/TikaServerTextExtractor.php index 5e42bc9..f3503f4 100644 --- a/code/extractors/TikaServerTextExtractor.php +++ b/code/extractors/TikaServerTextExtractor.php @@ -70,9 +70,17 @@ class TikaServerTextExtractor extends FileTextExtractor public function isAvailable() { + $version = $this->getVersion(); + // ensure that the version number has a major, minor and patch number + // reason being that version_compare('1.7', '1.7.0') will return -1 instead of 0 + for ($i = 0; $i < 2; $i++) { + if (substr_count($version, '.') < 2) { + $version .= '.0'; + } + } return $this->getServerEndpoint() && $this->getClient()->isAvailable() && - version_compare($this->getVersion(), '1.7.0') >= 0; + version_compare($version, '1.7.0') >= 0; } public function supportsExtension($extension)