aboutsummaryrefslogtreecommitdiff
path: root/constants.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-05-07 10:47:09 +0200
committerGravatar GitHub <noreply@github.com> 2025-05-07 10:47:09 +0200
commit3f187395eaed8d6e455adb454a65f9e2503f390a (patch)
tree109bbcf264ee3386530e2333e1a8eb77ae8d5e0a /constants.php
parentb2f80ad00a19e408685618668625ab11227cf18f (diff)
Move PHP minimum version check (#7560)
It is too late to check for minimum version check in `lib_rss.php` because that file already contains some relatively new PHP language constructs, which will lead to a syntax error - when running with an old PHP version - instead of the expected error message. Moved to `constants.php` for now. Example of syntax error with PHP 7.4: ``` PHP Parse error: syntax error, unexpected '|', expecting '{' in /var/www/FreshRSS/lib/lib_rss.php on line 166 ``` Should help users like in: * https://github.com/FreshRSS/FreshRSS/discussions/7539 * https://github.com/FreshRSS/FreshRSS/issues/7557
Diffstat (limited to 'constants.php')
-rw-r--r--constants.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/constants.php b/constants.php
index 2b4f563c9..8e9d76160 100644
--- a/constants.php
+++ b/constants.php
@@ -35,6 +35,10 @@ const CORE_EXTENSIONS_PATH = LIB_PATH . '/core-extensions';
const TESTS_PATH = FRESHRSS_PATH . '/tests';
//</Not customisable>
+if (version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION, '<')) {
+ die(sprintf('Error: FreshRSS requires PHP %s+ but was invoked with PHP %s!', FRESHRSS_MIN_PHP_VERSION, PHP_VERSION));
+}
+
if (file_exists(__DIR__ . '/constants.local.php')) {
//Include custom / local settings:
include(__DIR__ . '/constants.local.php');