From 9d520ab56dba5346a88cbf9511e5edb6587d4e22 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sat, 18 Sep 2021 21:50:07 +1200 Subject: [PATCH] Don't check for magic quotes on PHP 8 or newer - functions removed. This fix removes complaints about trying to call non-existant functions as they have been removed from PHP 8. This closes #234. --- ChangeLog | 4 ++++ htdocs/setup.php | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index abf9f3f9..5c6aefbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2021-09-18 Andrew Ruthven + * Don't try and use get_magic_quotes_gpc or get_magic_quotes_runtime on PHP 8 + or newer. + 2021-03-01 Florian Schlichting * release davical 1.1.10 * Update carddav/2042-REPORT-addressbook-query together with df6ff3a in AWL diff --git a/htdocs/setup.php b/htdocs/setup.php index 2a82dbf3..cb42df65 100644 --- a/htdocs/setup.php +++ b/htdocs/setup.php @@ -151,11 +151,23 @@ function check_suhosin_server_strip() { } function check_magic_quotes_gpc() { - return new CheckResult( (get_magic_quotes_gpc() == 0) ); + # get_magic_quotes_gpc has been removed as of PHP 8, so our check that it + # is disabled should ways pass from PHP 8 onwards. + if (version_compare(phpversion(), '8.0.0', '>=')) { + return new CheckResult(true); + } else { + return new CheckResult( (get_magic_quotes_gpc() == 0) ); + } } function check_magic_quotes_runtime() { - return new CheckResult( (get_magic_quotes_runtime() == 0) ); + # get_magic_quotes_runtime has been removed as of PHP 8, so our check that it + # is disabled should ways pass from PHP 8 onwards. + if (version_compare(phpversion(), '8.0.0', '>=')) { + return new CheckResult(true); + } else { + return new CheckResult( (get_magic_quotes_runtime() == 0) ); + } } function check_curl() {