From 0f395dad43bb0ab7c2e7ac5751776e9aeeb42036 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 9 Jul 2024 15:57:26 +0200 Subject: [PATCH] Initial support for PHP 8.4 (#6615) * Initial support for PHP 8.4 Sole fix needed so far seems to be related to https://wiki.php.net/rfc/deprecate-implicitly-nullable-types See also upstream PR https://github.com/PhpGt/CssXPath/pull/227 We are also hitting was seems to be a PHP bug https://github.com/php/php-src/issues/14873 * Fix return type * Disable OPCache while waiting for PHP fix --- Docker/Dockerfile-Newest | 13 +++++++------ cli/CliOptionsParser.php | 2 +- cli/i18n/I18nData.php | 2 +- tests/app/Models/FeedDAOTest.php | 11 +++++++++++ 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 tests/app/Models/FeedDAOTest.php diff --git a/Docker/Dockerfile-Newest b/Docker/Dockerfile-Newest index 68a23e5535b..bea22ec9fc7 100644 --- a/Docker/Dockerfile-Newest +++ b/Docker/Dockerfile-Newest @@ -5,11 +5,12 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"] RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \ apk add --no-cache \ tzdata \ - apache2 php83-apache2 \ + apache2 php84-apache2 \ apache-mod-auth-openidc \ - php83 php83-curl php83-gmp php83-intl php83-mbstring php83-xml php83-zip \ - php83-ctype php83-dom php83-fileinfo php83-iconv php83-json php83-opcache php83-openssl php83-phar php83-session php83-simplexml php83-xmlreader php83-xmlwriter php83-xml php83-tokenizer php83-zlib \ - php83-pdo_sqlite php83-pdo_mysql php83-pdo_pgsql + php84 php84-curl php84-gmp php84-intl php84-mbstring php84-xml php84-zip \ + php84-ctype php84-dom php84-fileinfo php84-iconv php84-json php84-openssl php84-phar php84-session php84-simplexml php84-xmlreader php84-xmlwriter php84-xml php84-tokenizer php84-zlib \ + # TODO: Re-add php84-opcache with PHP > 8.4.0alpha1. See https://github.com/php/php-src/issues/14873 + php84-pdo_sqlite php84-pdo_mysql php84-pdo_pgsql RUN mkdir -p /var/www/FreshRSS /run/apache2/ WORKDIR /var/www/FreshRSS @@ -41,8 +42,8 @@ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \ sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" \ /etc/apache2/httpd.conf && \ mv /etc/apache2/conf.d/mod-auth-openidc.conf /etc/apache2/conf.d/mod-auth-openidc.conf.bak && \ - if [ ! -f /usr/bin/php ]; then ln -s /usr/bin/php83 /usr/bin/php; else true; fi && \ - echo 'memory_limit = 256M' > /etc/php83/conf.d/10_memory.ini && \ + if [ ! -f /usr/bin/php ]; then ln -s /usr/bin/php84 /usr/bin/php; else true; fi && \ + echo 'memory_limit = 256M' > /etc/php84/conf.d/10_memory.ini && \ # Disable built-in updates when using Docker, as the full image is supposed to be updated instead. sed -r -i "\\#disable_update#s#^.*#\t'disable_update' => true,#" ./config.default.php && \ touch /var/www/FreshRSS/Docker/env.txt && \ diff --git a/cli/CliOptionsParser.php b/cli/CliOptionsParser.php index f75f6c19ac1..9fb50a4ff4b 100644 --- a/cli/CliOptionsParser.php +++ b/cli/CliOptionsParser.php @@ -43,7 +43,7 @@ protected function addRequiredOption(string $name, CliOption $option): void { * @param string $defaultInput If not null this value is received as input in all cases where no * user input is present. e.g. set this if you want an option to always return a value. */ - protected function addOption(string $name, CliOption $option, string $defaultInput = null): void { + protected function addOption(string $name, CliOption $option, ?string $defaultInput = null): void { $this->inputs[$name] = [ 'defaultInput' => is_string($defaultInput) ? [$defaultInput] : $defaultInput, 'required' => null, diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php index 4142c92d18b..6d5730a08d4 100644 --- a/cli/i18n/I18nData.php +++ b/cli/i18n/I18nData.php @@ -101,7 +101,7 @@ private function getNonReferenceLanguages(): array { * Add a new language. It’s a copy of the reference language. * @throws Exception */ - public function addLanguage(string $language, string $reference = null): void { + public function addLanguage(string $language, ?string $reference = null): void { if (array_key_exists($language, $this->data)) { throw new Exception('The selected language already exist.'); } diff --git a/tests/app/Models/FeedDAOTest.php b/tests/app/Models/FeedDAOTest.php new file mode 100644 index 00000000000..e69b7c392dc --- /dev/null +++ b/tests/app/Models/FeedDAOTest.php @@ -0,0 +1,11 @@ +_ttl(-5); + self::assertEquals(-5, $feed->ttl(true)); + self::assertEquals(true, $feed->mute()); + } +}