From 669c98550c22bbe4b1a777c924cdae36c25bd939 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 6 Nov 2022 08:05:41 +0100 Subject: [PATCH] add a version check, the third argument in getopt requires PHP >= 7.1 --- bin/migrate | 4 ++++ tst/MigrateTest.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/bin/migrate b/bin/migrate index 4dbe052..515a5e8 100755 --- a/bin/migrate +++ b/bin/migrate @@ -10,6 +10,10 @@ require PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; use PrivateBin\Configuration; use PrivateBin\Model; +// third argument in getopt requires PHP >= 7.1 +if (version_compare(PHP_VERSION, '7.1.0') < 0) { + dieerr('migrate requires php 7.1 or above to work. Sorry.'); +} $longopts = array( "delete-after", diff --git a/tst/MigrateTest.php b/tst/MigrateTest.php index d1fbb30..eccca26 100644 --- a/tst/MigrateTest.php +++ b/tst/MigrateTest.php @@ -54,6 +54,10 @@ class MigrateTest extends PHPUnit_Framework_TestCase public function testMigrate() { + if (version_compare(PHP_VERSION, '7.1.0') < 0) { + return; // skip test on unsupported PHP versions + } + $this->_model_1->delete(Helper::getPasteId()); $this->_model_2->delete(Helper::getPasteId());