Issue #3255350 by alexpott, longwave: Remove PHP 7 code from Drupal 10
parent
87fc0a7d04
commit
94ee839741
|
@ -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>
|
||||
|
|
|
@ -74,9 +74,6 @@ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
|
|||
</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>
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
|
@ -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');
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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 @@ class StaticReflectionClass extends ReflectionClass
|
|||
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}
|
||||
*/
|
||||
|
|
|
@ -72,9 +72,6 @@ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
|
|||
</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>
|
||||
|
|
|
@ -279,8 +279,6 @@ abstract class Tasks {
|
|||
];
|
||||
|
||||
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'] = [
|
||||
|
|
|
@ -107,19 +107,7 @@ class Router extends UrlMatcher implements RequestMatcherInterface, RouterInterf
|
|||
* {@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()));
|
||||
}
|
||||
|
|
|
@ -94,9 +94,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
|
|||
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 @@ class UncaughtExceptionTest extends BrowserTestBase {
|
|||
$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);
|
||||
|
||||
|
|
|
@ -264,9 +264,7 @@ class TransactionTest extends DatabaseTestBase {
|
|||
// 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());
|
||||
|
|
|
@ -6,7 +6,6 @@ use Drupal\Component\Render\FormattableMarkup;
|
|||
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 @@ class MarkupInterfaceComparatorTest extends KernelTestBase {
|
|||
new FormattableMarkup('goldfinger', []),
|
||||
['goldfinger'],
|
||||
FALSE,
|
||||
PHP_VERSION_ID >= 80000 ? Warning::class : Notice::class,
|
||||
Warning::class,
|
||||
],
|
||||
'stdClass vs TranslatableMarkup' => [
|
||||
(object) ['goldfinger'],
|
||||
|
|
|
@ -180,7 +180,7 @@ trait BrowserHtmlDebugTrait {
|
|||
$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();
|
||||
|
|
|
@ -1189,30 +1189,6 @@ DOCBLOCK;
|
|||
$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');
|
||||
|
|
|
@ -269,12 +269,7 @@ class ConfigTest extends UnitTestCase {
|
|||
$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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue