diff --git a/.htaccess b/.htaccess index 4d19147cc464d3c2c1e79eb3b4d9195e226d0253..7e38f73369cb6ac1461c27427b63f3466e5a85fb 100644 --- a/.htaccess +++ b/.htaccess @@ -26,13 +26,6 @@ AddEncoding gzip svgz # sites/default/default.settings.php and # Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be # changed at runtime. - -# PHP 7, Apache 1 and 2. -<IfModule mod_php7.c> - php_value assert.active 0 -</IfModule> - -# PHP 8, Apache 1 and 2. <IfModule mod_php.c> php_value assert.active 0 </IfModule> diff --git a/composer/Plugin/VendorHardening/FileSecurity.php b/composer/Plugin/VendorHardening/FileSecurity.php index 3d168cca925c350a47aa816284cc832d11208b42..cea0685fb35800ea68092e6aa1a160d2229bf767 100644 --- a/composer/Plugin/VendorHardening/FileSecurity.php +++ b/composer/Plugin/VendorHardening/FileSecurity.php @@ -74,9 +74,6 @@ protected static function htaccessPreventExecution() { </Files> # If we know how to do it safely, disable the PHP engine entirely. -<IfModule mod_php7.c> - php_flag engine off -</IfModule> <IfModule mod_php.c> php_flag engine off </IfModule> diff --git a/core/assets/scaffold/files/example.settings.local.php b/core/assets/scaffold/files/example.settings.local.php index 73671ab164bf72cd65bf925d8bad7172320bb4d7..1397e9ddf4d7b37cd341f271bb747c9c18989cc0 100644 --- a/core/assets/scaffold/files/example.settings.local.php +++ b/core/assets/scaffold/files/example.settings.local.php @@ -26,9 +26,9 @@ * @see http://php.net/assert * @see https://www.drupal.org/node/2492225 * - * If you are using PHP 7.0 it is strongly recommended that you set - * zend.assertions=1 in the PHP.ini file (It cannot be changed from .htaccess - * or runtime) on development machines and to 0 in production. + * It is strongly recommended that you set zend.assertions=1 in the PHP.ini file + * (It cannot be changed from .htaccess or runtime) on development machines and + * to 0 or -1 in production. * * @see https://wiki.php.net/rfc/expectations */ diff --git a/core/assets/scaffold/files/htaccess b/core/assets/scaffold/files/htaccess index 4d19147cc464d3c2c1e79eb3b4d9195e226d0253..7e38f73369cb6ac1461c27427b63f3466e5a85fb 100644 --- a/core/assets/scaffold/files/htaccess +++ b/core/assets/scaffold/files/htaccess @@ -26,13 +26,6 @@ AddEncoding gzip svgz # sites/default/default.settings.php and # Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be # changed at runtime. - -# PHP 7, Apache 1 and 2. -<IfModule mod_php7.c> - php_value assert.active 0 -</IfModule> - -# PHP 8, Apache 1 and 2. <IfModule mod_php.c> php_value assert.active 0 </IfModule> diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php7/ReflectionClass.php b/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php7/ReflectionClass.php deleted file mode 100644 index 8ae2a6750458bf49947cac5ccf343b74371802c5..0000000000000000000000000000000000000000 --- a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php7/ReflectionClass.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -// phpcs:ignoreFile - -/** - * @file - * - * This class is a near-copy of - * Doctrine\Common\Reflection\Compatibility\Php7\ReflectionClass, which is part - * of the Doctrine project: <http://www.doctrine-project.org>. It was copied - * from version 1.2.2. - * - * Original copyright: - * - * Copyright (c) 2006-2015 Doctrine Project - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - */ - -namespace Drupal\Component\Annotation\Doctrine\Compatibility\Php7; - -use ReflectionException; - -trait ReflectionClass -{ - /** - * {@inheritDoc} - */ - public function getConstants() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstance($args) - { - throw new ReflectionException('Method not implemented'); - } -} diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php b/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php deleted file mode 100644 index 8781320628577547605fdb21a024a32f83a18d1a..0000000000000000000000000000000000000000 --- a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -// phpcs:ignoreFile - -/** - * @file - * - * This class is a near-copy of - * Doctrine\Common\Reflection\Compatibility\Php8\ReflectionClass, which is part - * of the Doctrine project: <http://www.doctrine-project.org>. It was copied - * from version 1.2.2. - * - * Original copyright: - * - * Copyright (c) 2006-2015 Doctrine Project - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - */ - -namespace Drupal\Component\Annotation\Doctrine\Compatibility\Php8; - -use ReflectionException; - -trait ReflectionClass -{ - /** - * {@inheritDoc} - */ - #[\ReturnTypeWillChange] - public function getConstants(?int $filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - #[\ReturnTypeWillChange] - public function newInstance(mixed ...$args) - { - throw new ReflectionException('Method not implemented'); - } -} diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/ReflectionClass.php b/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/ReflectionClass.php deleted file mode 100644 index acb5887a72b053293169d3f0d70c5cadee3a3de5..0000000000000000000000000000000000000000 --- a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/ReflectionClass.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -// phpcs:ignoreFile - -/** - * @file - * - * This class is a near-copy of - * Doctrine\Common\Reflection\Compatibility\ReflectionClass, which is part of - * the Doctrine project: <http://www.doctrine-project.org>. It was copied from - * version 1.2.2. - * - * Original copyright: - * - * Copyright (c) 2006-2015 Doctrine Project - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - */ - -namespace Drupal\Component\Annotation\Doctrine\Compatibility; - -use const PHP_VERSION_ID; -use function class_alias; - -if (PHP_VERSION_ID >= 80000) { - class_alias('Drupal\Component\Annotation\Doctrine\Compatibility\Php8\ReflectionClass', 'Drupal\Component\Annotation\Doctrine\Compatibility\ReflectionClass'); -} else { - class_alias('Drupal\Component\Annotation\Doctrine\Compatibility\Php7\ReflectionClass', 'Drupal\Component\Annotation\Doctrine\Compatibility\ReflectionClass'); -} - -if (false) { - class ReflectionClass - { - } -} diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php b/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php index 7abdc86b012c993f54d4715bf6bed55086081824..ff8d67f062d15c0970b30db14c99b7c2381b2f05 100644 --- a/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php +++ b/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php @@ -26,13 +26,11 @@ namespace Drupal\Component\Annotation\Doctrine; -use Drupal\Component\Annotation\Doctrine\Compatibility\ReflectionClass as CompatibilityReflectionClass; use ReflectionClass; use ReflectionException; class StaticReflectionClass extends ReflectionClass { - use CompatibilityReflectionClass; /** * The static reflection parser object. @@ -458,6 +456,24 @@ public function setStaticPropertyValue($name, $value) throw new ReflectionException('Method not implemented'); } + /** + * {@inheritDoc} + */ + #[\ReturnTypeWillChange] + public function getConstants(?int $filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + #[\ReturnTypeWillChange] + public function newInstance(mixed ...$args) + { + throw new ReflectionException('Method not implemented'); + } + /** * {@inheritDoc} */ diff --git a/core/lib/Drupal/Component/FileSecurity/FileSecurity.php b/core/lib/Drupal/Component/FileSecurity/FileSecurity.php index aaebcca68024ba315575fc8ead978c44b52a43ac..c21937a8de4fd0ab50e0cb7d845de1e10bb8f503 100644 --- a/core/lib/Drupal/Component/FileSecurity/FileSecurity.php +++ b/core/lib/Drupal/Component/FileSecurity/FileSecurity.php @@ -72,9 +72,6 @@ protected static function htaccessPreventExecution() { </Files> # If we know how to do it safely, disable the PHP engine entirely. -<IfModule mod_php7.c> - php_flag engine off -</IfModule> <IfModule mod_php.c> php_flag engine off </IfModule> diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php index b7fceace1196398a97356007d835a9adf2573a9b..abb90e500b3fa80ae2b8f8372269e40592d36b03 100644 --- a/core/lib/Drupal/Core/Database/Install/Tasks.php +++ b/core/lib/Drupal/Core/Database/Install/Tasks.php @@ -279,8 +279,6 @@ public function getFormOptions(array $database) { ]; global $install_state; - // @todo https://www.drupal.org/project/drupal/issues/3110839 remove PHP 7.4 - // work around and add a better message for the migrate UI. $profile = $install_state['parameters']['profile'] ?? NULL; $db_prefix = ($profile == 'standard') ? 'drupal_' : $profile . '_'; $form['advanced_options']['prefix'] = [ diff --git a/core/lib/Drupal/Core/Routing/Router.php b/core/lib/Drupal/Core/Routing/Router.php index 87324a68a5b192766d044346485a1c131999861f..23d6ebb66fba18e40daae8d3ecd47d231e11a687 100644 --- a/core/lib/Drupal/Core/Routing/Router.php +++ b/core/lib/Drupal/Core/Routing/Router.php @@ -107,19 +107,7 @@ public function match($pathinfo): array { * {@inheritdoc} */ public function matchRequest(Request $request): array { - try { - $collection = $this->getInitialRouteCollection($request); - } - // PHP 7.4 introduces changes to its serialization format, which mean that - // older versions of PHP are unable to unserialize data that is serialized - // in PHP 7.4. If the site's version of PHP has been downgraded, then - // attempting to unserialize routes from the database will fail, and so the - // router needs to be rebuilt on the current PHP version. - // See https://www.php.net/manual/en/migration74.incompatible.php. - catch (\TypeError $e) { - \Drupal::service('router.builder')->rebuild(); - $collection = $this->getInitialRouteCollection($request); - } + $collection = $this->getInitialRouteCollection($request); if ($collection->count() === 0) { throw new ResourceNotFoundException(sprintf('No routes found for "%s".', $this->currentPath->getPath())); } diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php index 06dde6ce8d09c29c31b6f5ddb23b22be8252ab08..a65210607c0a6fb9a734467451a083d9bf5d427b 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -94,9 +94,7 @@ public function testUncaughtException() { public function testUncaughtFatalError() { $fatal_error = [ '%type' => 'TypeError', - '@message' => PHP_VERSION_ID >= 80000 ? - 'Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}(): Argument #1 ($test) must be of type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 65' : - 'Argument 1 passed to Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}() must be of the type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 65', + '@message' => 'Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}(): Argument #1 ($test) must be of type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 65', '%function' => 'Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()', ]; $this->drupalGet('error-test/generate-fatals'); @@ -178,9 +176,7 @@ public function testErrorContainer() { $this->writeSettings($settings); \Drupal::service('kernel')->invalidateContainer(); - $this->expectedExceptionMessage = PHP_VERSION_ID >= 80000 ? - 'Drupal\FunctionalTests\Bootstrap\ErrorContainer::Drupal\FunctionalTests\Bootstrap\{closure}(): Argument #1 ($container) must be of type Drupal\FunctionalTests\Bootstrap\ErrorContainer' : - 'Argument 1 passed to Drupal\FunctionalTests\Bootstrap\ErrorContainer::Drupal\FunctionalTests\Bootstrap\{closur'; + $this->expectedExceptionMessage = 'Drupal\FunctionalTests\Bootstrap\ErrorContainer::Drupal\FunctionalTests\Bootstrap\{closure}(): Argument #1 ($container) must be of type Drupal\FunctionalTests\Bootstrap\ErrorContainer'; $this->drupalGet(''); $this->assertSession()->statusCodeEquals(500); diff --git a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php index e76618152a627892623c8a7960f0c05e51272f5a..7aa37c70ef8b9d49a3820980b57d742323dbe07b 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php @@ -264,9 +264,7 @@ public function testTransactionWithDdlStatement() { // Rollback the outer transaction. $transaction->rollBack(); // @see \Drupal\Core\Database\Driver\mysql\Connection::rollBack() - if (PHP_VERSION_ID >= 80000) { - $this->fail('Rolling back a transaction containing DDL should produce a warning.'); - } + $this->fail('Rolling back a transaction containing DDL should produce a warning.'); } catch (Warning $warning) { $this->assertSame('Rollback attempted when there is no active transaction. This can cause data integrity issues.', $warning->getMessage()); diff --git a/core/tests/Drupal/KernelTests/Core/Test/Comparator/MarkupInterfaceComparatorTest.php b/core/tests/Drupal/KernelTests/Core/Test/Comparator/MarkupInterfaceComparatorTest.php index bc8685db01f2db39736af1574e89684fd01a57b6..f3008e694e4ec258b5b41c2554667d361ecc048f 100644 --- a/core/tests/Drupal/KernelTests/Core/Test/Comparator/MarkupInterfaceComparatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Test/Comparator/MarkupInterfaceComparatorTest.php @@ -6,7 +6,6 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\KernelTests\KernelTestBase; use Drupal\TestTools\Comparator\MarkupInterfaceComparator; -use PHPUnit\Framework\Error\Notice; use PHPUnit\Framework\Error\Warning; use SebastianBergmann\Comparator\Factory; use SebastianBergmann\Comparator\ComparisonFailure; @@ -109,7 +108,7 @@ public function dataSetProvider() { new FormattableMarkup('goldfinger', []), ['goldfinger'], FALSE, - PHP_VERSION_ID >= 80000 ? Warning::class : Notice::class, + Warning::class, ], 'stdClass vs TranslatableMarkup' => [ (object) ['goldfinger'], diff --git a/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php b/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php index 4288598a592a7e99927b8645d40b5d7f34a552c3..e0b85ef5460fc0ef84592758a1cff51b48c36b26 100644 --- a/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php +++ b/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php @@ -180,7 +180,7 @@ protected function getResponseLogHandler() { $html_output .= '<hr />' . $request->getMethod() . ' request to: ' . $request->getUri(); // Get the response body as a string. Any errors are silenced as - // tests should not fail if there is a problem. On PHP 7.4 + // tests should not fail if there is a problem. // \Drupal\Tests\migrate\Functional\process\DownloadFunctionalTest // fails without the usage of a silence operator. $body = @(string) $response->getBody(); diff --git a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php index 5a028bcb4ffedc76e82d38742b376900009deb67..d05e4658567799c4e7833603c12b69ee72d0c4d4 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php @@ -1189,30 +1189,6 @@ public function testCastNegativeFloat() $this->assertIsFloat($annot->value); } - public function testReservedKeywordsInAnnotations() - { - if (PHP_VERSION_ID >= 70000) { - $this->markTestSkipped('This test requires PHP 5.6 or lower.'); - } - require 'ReservedKeywordsClasses.php'; - - $parser = $this->createTestParser(); - - $result = $parser->parse('@Drupal\Tests\Component\Annotation\Doctrine\True'); - $this->assertInstanceOf(True::class, $result[0]); - $result = $parser->parse('@Drupal\Tests\Component\Annotation\Doctrine\False'); - $this->assertInstanceOf(False::class, $result[0]); - $result = $parser->parse('@Drupal\Tests\Component\Annotation\Doctrine\Null'); - $this->assertInstanceOf(Null::class, $result[0]); - - $result = $parser->parse('@True'); - $this->assertInstanceOf(True::class, $result[0]); - $result = $parser->parse('@False'); - $this->assertInstanceOf(False::class, $result[0]); - $result = $parser->parse('@Null'); - $this->assertInstanceOf(Null::class, $result[0]); - } - public function testSetValuesException() { $this->expectException('\Doctrine\Common\Annotations\AnnotationException'); diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php index d7b6ee5f0e800c24182ef2537b2d4b0e28832b2d..51f3c2d9a85c3a521ef7fd9e5f808eefbe400c87 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php @@ -269,12 +269,7 @@ public function testSetIllegalOffsetValue() { $this->config->set('testData', 1); // Attempt to treat the single value as a nested item. - if (PHP_VERSION_ID >= 80000) { - $this->expectError(); - } - else { - $this->expectWarning(); - } + $this->expectError(); $this->config->set('testData.illegalOffset', 1); } diff --git a/core/tests/README.md b/core/tests/README.md index f88289f48ccc27d996333e0b9ddb1b88aa1d5d2e..36655e3f123d927b7a656c942148e5cf2526d78d 100644 --- a/core/tests/README.md +++ b/core/tests/README.md @@ -42,7 +42,6 @@ to install the following additional software: * Google Chrome or Chromium browser * chromedriver (tested with version 2.45) -- see https://sites.google.com/chromium.org/driver/ -* PHP 7.1 or higher ## Running tests diff --git a/sites/example.settings.local.php b/sites/example.settings.local.php index 73671ab164bf72cd65bf925d8bad7172320bb4d7..1397e9ddf4d7b37cd341f271bb747c9c18989cc0 100644 --- a/sites/example.settings.local.php +++ b/sites/example.settings.local.php @@ -26,9 +26,9 @@ * @see http://php.net/assert * @see https://www.drupal.org/node/2492225 * - * If you are using PHP 7.0 it is strongly recommended that you set - * zend.assertions=1 in the PHP.ini file (It cannot be changed from .htaccess - * or runtime) on development machines and to 0 in production. + * It is strongly recommended that you set zend.assertions=1 in the PHP.ini file + * (It cannot be changed from .htaccess or runtime) on development machines and + * to 0 or -1 in production. * * @see https://wiki.php.net/rfc/expectations */