Problem/Motivation

This task will try to get Drupal 9 installable on PHP8.0 alpha so we can work out issues to address.

Proposed resolution

Make Drupal 9 testable on PHP 8 and PHP 7 at the same time.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#151 3156595-5-151.patch4.11 KBalexpott
#148 3156595-4-148.patch681 byteseffulgentsia
#146 3156595-4-146.patch1.73 KBalexpott
#143 interdiff.txt945 byteseffulgentsia
#143 3156595-4-143.patch2.17 KBeffulgentsia
#142 3156595-4-142.patch1.06 KBeffulgentsia
#140 3156595-4-140.patch2.51 KBalexpott
#135 3156595-4-135.patch10.79 KBalexpott
#135 133-135-interdiff.txt1.06 KBalexpott
#133 3156595-4-133.patch9.85 KBalexpott
#132 3156595-3-132.patch11.77 KBalexpott
#131 3156595-3-131.patch11.77 KBalexpott
#130 3156595-3-130.patch16.53 KBalexpott
#129 3156595-3-129.patch16.39 KBalexpott
#128 3156595-3-128.patch15.79 KBalexpott
#127 3156595-3-127.patch15.43 KBalexpott
#126 3156595-3-126.patch38.29 KBalexpott
#126 125-126-interdiff.txt3.55 KBalexpott
#125 3156595-3-125.patch38.16 KBalexpott
#125 123-125-interdiff.txt3.36 KBalexpott
#123 3156595-3-123.patch35.94 KBalexpott
#123 122-123-interdiff.txt2.49 KBalexpott
#122 3156595-3-122.patch36.1 KBalexpott
#122 120-122-interdiff.txt1.47 KBalexpott
#120 3156595-3-120.patch34.63 KBalexpott
#119 3156595-3-119.patch55.71 KBalexpott
#115 3156595-3-115.patch68.53 KBalexpott
#112 3156595-3-112.patch100.66 KBalexpott
#111 3156595-3-111.patch141.84 KBalexpott
#111 110-111-interdiff.txt757 bytesalexpott
#110 3156595-3-110.patch140.94 KBalexpott
#110 108-110-interdiff.txt3.41 KBalexpott
#108 3156595-3-108.patch137.03 KBalexpott
#108 107-108-interdiff.txt6.01 KBalexpott
#107 3156595-3-107.patch131.05 KBalexpott
#104 interdiff-102-104.txt1.75 KBhussainweb
#104 3156595-base-104.patch89.95 KBhussainweb
#102 3156595-base-102.patch91.25 KBhussainweb
#101 3156595-base-101.patch91.31 KBhussainweb
#101 interdiff-99-101.txt673 byteshussainweb
#99 interdiff-96-99.txt648 byteshussainweb
#99 3156595-base-99.patch91.31 KBhussainweb
#96 3156595-96-with-patches.patch165.68 KBhussainweb
#96 3156595-base-96.patch91.32 KBhussainweb
#96 interdiff-90-96.txt2.75 KBhussainweb
#90 3156595-90-with-patches.patch166.97 KBhussainweb
#90 3156595-base-90.patch92.61 KBhussainweb
#90 interdiff-89-90.txt3.61 KBhussainweb
#89 3156595-89-with-patches.patch164.34 KBhussainweb
#89 interdiff-88-89.txt744 byteshussainweb
#89 3156595-base-89.patch89.01 KBhussainweb
#88 3156595-base-88.patch89.11 KBhussainweb
#86 3156595-85.patch170.14 KBandypost
#86 interdiff.txt3.52 KBandypost
#84 3156595-84.patch136.91 KBandypost
#84 interdiff.txt3.52 KBandypost
#82 3156595-base2-82-with-patches.patch169.97 KBalexpott
#82 3156595-base-82.patch92.63 KBalexpott
#80 3156595-base-80-incuding-patches.patch164.83 KBalexpott
#78 3156595-78.patch139.44 KBandypost
#78 interdiff.txt1.64 KBandypost
#75 3156595-base-75-incuding-patches.patch137.8 KBalexpott
#75 73-75-interdiff.txt2.34 KBalexpott
#73 3156595-base-73-including-patches.patch134.87 KBalexpott
#72 3156595-base-72-including-patches-phpunit9.patch156.62 KBalexpott
#71 3156595-base-71-including-patches.patch116.14 KBalexpott
#71 3156595-base-71.patch77.93 KBalexpott
#62 3156595-62.patch100.91 KBhussainweb
#62 interdiff-60-62.txt1.81 KBhussainweb
#60 3156595-60.patch100.91 KBhussainweb
#57 3156595-57.patch101.33 KBandypost
#55 3156595-55.patch103.52 KBandypost
#53 3156595-53.patch103.51 KBalexpott
#53 51-53-interdiff.txt2 KBalexpott
#51 3156595-51.patch103.31 KBalexpott
#51 50-51-interdiff.txt1.24 KBalexpott
#50 3156595-50.patch103.3 KBalexpott
#50 49-50-interdiff.txt9.22 KBalexpott
#49 3156595-49.patch96.2 KBalexpott
#47 3156595-47.patch143.89 KBalexpott
#47 46-47-interdiff.txt3.28 KBalexpott
#46 3156595-46.patch143.56 KBalexpott
#46 44-46-interdiff.txt25.04 KBalexpott
#44 3156595-42.patch121.6 KBalexpott
#44 40-42-interdiff.txt2.81 KBalexpott
#40 3156595-40.patch120.81 KBalexpott
#40 39-40-interdiff.txt32.25 KBalexpott
#39 3156595-39.patch152.94 KBalexpott
#39 37-39-interdiff.txt1.31 KBalexpott
#37 3156595-37.patch152.81 KBalexpott
#37 32-37-interdiff.txt2.37 KBalexpott
#32 3156595-32.patch151.71 KBalexpott
#32 30-32-interdiff.txt2.54 KBalexpott
#30 3156595-30.patch151.75 KBalexpott
#30 27-30-interdiff.txt3.95 KBalexpott
#28 3156595-27.patch150.65 KBalexpott
#28 24-27-interdiff.txt1.13 KBalexpott
#24 3156595-24.patch150.2 KBalexpott
#24 23-24-interdiff.txt42.58 KBalexpott
#23 3156595-22.patch108.9 KBalexpott
#23 21-22-interdiff.txt12.77 KBalexpott
#21 3156595-21.patch108.9 KBalexpott
#21 17-21-interdiff.txt12.77 KBalexpott
#18 3156595-17.patch100.4 KBalexpott
#18 15-17-interdiff.txt838 bytesalexpott
#15 3156595-15.patch99.7 KBalexpott
#15 14-15-interdiff.txt21.97 KBalexpott
#14 3156595-14.patch77.35 KBalexpott
#14 12-14-interdiff.txt33.19 KBalexpott
#12 interdiff_6-12.txt592 bytesadityasingh
#12 3156595-12.patch44.08 KBadityasingh
#6 3156595-6.patch44.16 KBalexpott
#6 4-6-interdiff.txt3.97 KBalexpott
#4 3156595-4.patch40.92 KBalexpott
#4 3-4-interdiff.txt26.71 KBalexpott
#3 3156595-3.patch15.54 KBalexpott
#3 2-3-interdiff.txt904 bytesalexpott
#2 3156595-2.patch15.49 KBalexpott

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
StatusFileSize
new15.49 KB

This patch allows Drupal to install on PHP 8. Won't work on PHP 7 yet - that's going to require more fun.

alexpott’s picture

StatusFileSize
new904 bytes
new15.54 KB

Turns out making in PHP 7 installable wasn't too hard...

alexpott’s picture

StatusFileSize
new26.71 KB
new40.92 KB

Better way of doing the class aliasing and updating Symfony for less noise. That update will occur in #3156558: Upgrade dependencies prior to 9.1.0

alexpott’s picture

StatusFileSize
new3.97 KB
new44.16 KB

We need this fix in Twig... https://github.com/twigphp/Twig/commit/663b8fa83270ae53c3c6f41de684e0282... - updating to a dev release for now.

pfrenssen’s picture

Since current versions of Drupal are not compatible with PHP 8.x, wouldn't it be a good idea to update our PHP version requirement in this patch to explicitly say that we are currently not supporting PHP 8.x?

-       "php": ">=7.3",
+       "php": "^7.3",

There has been a discussion in the Symfony framework recently where they went the other way. They have recently adopted the ">=7" version constraint with the idea that this would make it easier for developers to install their Symfony projects on PHP8 and start to work on the compatibility problems. But this seems like a mistake, the correct way to develop compatibility fixes on a non-supported platform is by using the --ignore-platform-reqs flag in Composer like we are doing here.

Since we are getting "near" the PHP 8.0 release which is planned in ~1 year time I think it would be a good idea to limit the current releases of Drupal to PHP "^7.3" only, and once we have a passing test suite we can change this to "^7.3 || ^8" to indicate that Drupal is now safe to install on both PHP 7 and 8.

This will prevent Composer from resolving versions of Drupal which do not yet support PHP 8 by accident. If we keep ">=7.3" then Composer will happily resolve e.g. Drupal 9.0.1 on a PHP 8 platform.

pfrenssen’s picture

--- a/core/lib/Drupal/Core/Render/Element/StatusReport.php
+++ b/core/lib/Drupal/Core/Render/Element/StatusReport.php
@@ -52,7 +52,7 @@ public static function preRenderGroupRequirements($element) {
     // Order the grouped requirements by a set order.
     $order = array_flip($element['#priorities']);
     uksort($grouped_requirements, function ($a, $b) use ($order) {
-      return $order[$a] > $order[$b];
+      return $order[$a] > $order[$b] ? 1 : -1;
     });
 
     $element['#grouped_requirements'] = $grouped_requirements;

This can be replaced with the spaceship operator:

-      return $order[$a] > $order[$b];
+      return $order[$a] <=> $order[$b];
pfrenssen’s picture

I was mistaken about the release date of PHP 8, I thought it was in a year or later but actually it is already planned for November 2020. I opened a separate issue for tightening the PHP version constraint in composer.json: #3156651: Prevent Drupal 8.9 and 9.0 from being installed on PHP 8.

adityasingh’s picture

Assigned: Unassigned » adityasingh
adityasingh’s picture

Assigned: adityasingh » Unassigned
Status: Needs work » Needs review
StatusFileSize
new44.08 KB
new592 bytes

Hi @pfrenssen
Updated patch please review.

alexpott’s picture

Status: Needs work » Needs review
Related issues: +#3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3
StatusFileSize
new33.19 KB
new77.35 KB

We're going to need the ability to upgrade to PHPUnit - merging in #3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3 and fixed another ::getClass() in proxy builder.

alexpott’s picture

StatusFileSize
new21.97 KB
new99.7 KB

phpdocumentor/reflection-dockblock and phpspec/prophecy need minor PHP8 fixes because of reflection deprecations. I've aliased the classes and fixed them. Will look for PRs later.

alexpott’s picture

Well that's fun. Upgrading to PHPUnit 9 is broken on PHP8 because the composer command fails!

00:03:37.375 Script @composer update phpunit/phpunit symfony/phpunit-bridge phpspec/prophecy symfony/yaml --with-dependencies --no-progress handling the drupal-phpunit-upgrade event returned with error code 2
00:03:37.375 Script Drupal\Core\Composer\Composer::upgradePHPUnit handling the drupal-phpunit-upgrade-check event terminated with an exception
00:03:37.674   ERROR: PHPUnit testing framework version 9 or greater is required when running on PHP 7.4 or greater. Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.

:D

Might need to upgrade composer first... drupalci.yml might be needed.

alexpott’s picture

StatusFileSize
new838 bytes
new100.4 KB

Oh of course we need to ignore platform reqs...

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new12.77 KB
new108.9 KB

Another round of fixes...

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new12.77 KB
new108.9 KB

Fun with ZipArchive not supporting empty files anymore - we'll need to file an issue for behat\mink-selenium2-driver.

alexpott’s picture

StatusFileSize
new42.58 KB
new150.2 KB

Here's the proper behat\mink-selenium2-driver fix and some more tweaks. I think we're very close to a total scope of work necessary to be PHP 8 compatible for Drupal 9. I think Drupal 8 is going to have a slightly harder time because it still supports PHP 7.0.

andypost’s picture

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB
new150.65 KB

Let's finesse the hack :)

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new3.95 KB
new151.75 KB

The JS tests pass locally... let's try a different way.

alexpott’s picture

Spin off issues

I think all of the above issue can proceed without worrying about the how and if vendor support works for PHP 8 since the changes are all PHP 7 compatible. And hopefully we can keep the changes PHP 7.0 compatible to make things easy for Drupal 8.

Spin off issue to create that needs PHP 8 to be largely working.

alexpott’s picture

StatusFileSize
new2.54 KB
new151.71 KB

Maybe 3rd time lucky.

andypost’s picture

Only 6 tests broken, and all if them about scaffolding

alexpott’s picture

Yay! So 3rd time was lucky.

Test Result (6 failures / +3)
#slow.Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest.Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest
Build.Drupal\BuildTests\Framework\Tests\HtRouterTest.Drupal\BuildTests\Framework\Tests\HtRouterTest
System.Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest.Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest
Composer.Drupal\Tests\ComposerIntegrationTest.Drupal\Tests\ComposerIntegrationTest
Drupal.Drupal\Tests\Component\Serialization\YamlPeclTest.Drupal\Tests\Component\Serialization\YamlPeclTest
Scaffold.Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest.Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest

All these fails explainable - the composer ones due to deps incompatible with PHP 8 in their composer.json, missing pecl yaml extension. Apart from Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest - need to look into that one.

The PHP 7 fails are due to the mucking about with composer to use dev version of Twig and PHPUnit 9.

All the issues from this have been split into separately scoped issues - see #31 and the parent issue.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new2.37 KB
new152.81 KB

Fixing a couple of the PHP 8 failing tests hopefully.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new1.31 KB
new152.94 KB

Fixing htroutertest

alexpott’s picture

StatusFileSize
new32.25 KB
new120.81 KB

Backing out #3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3 to see if it is required. I was kind of throwing the kitchen sink at the problem when I added that one in.

alexpott’s picture

So yep #3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3 is needed. \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldTest will fail with deprecations like

  62x: Method ReflectionParameter::getClass() is deprecated
    62x in FieldTest::testSource from Drupal\Tests\field\Kernel\Plugin\migrate\source\d7

  50x: Method ReflectionParameter::isArray() is deprecated
    50x in FieldTest::testSource from Drupal\Tests\field\Kernel\Plugin\migrate\source\d7

  36x: Method ReflectionParameter::isCallable() is deprecated
    36x in FieldTest::testSource from Drupal\Tests\field\Kernel\Plugin\migrate\source\d7

due to code in PHPUnit.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new2.81 KB
new121.6 KB

Hmmm #41 was wrong. The change in #39 causes that.

So fixing that a different way and fixing the composer hash test too.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new25.04 KB
new143.56 KB

Lol - so we need to upgrade to PHPUnit 9 for one test - \Drupal\Tests\Core\Database\ConnectionTest. And there's a very simple workaround for it. So I'm going to do that. Also one of the composer tests is fixable by updating composer. The composer update is done in #3156558: Upgrade dependencies prior to 9.1.0

So we should be down to 1 fail on 7.4 and 2 fails on PHP 8.0. The common fail is due to twig as a dev dependency - I'll try and ping fabpot for a release - and one because we don't have the pecl yaml extension on PHP 8.

The pecl yaml fail is interesting because it shouldn't be happening. The * @requires extension yaml is causing a because of our event listeners...

OK, but incomplete, skipped, or risky tests!
Tests: 6, Assertions: 0, Skipped: 7.

THE ERROR HANDLER HAS CHANGED!

Other deprecation notices (3)

  1x: The "PHPUnit\TextUI\ResultPrinter" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from "Drupal\Tests\Listeners\HtmlOutputPrinter".

  1x: The "Drupal\Tests\Listeners\DrupalListener" class implements "PHPUnit\Framework\TestListener" that is deprecated Use the `TestHook` interfaces instead.

  1x: The "Drupal\Tests\Listeners\DrupalListener" class uses "PHPUnit\Framework\TestListenerDefaultImplementation" that is deprecated The `TestListener` interface is deprecated.

The important thing is that the Symfony deprecations handler is triggering an error due to THE ERROR HANDLER HAS CHANGED!. This issue happens on PHP 7.4 too when a unit test has a @requires extension_that_does_not_exist. See I'll create another bug issue for that.

alexpott’s picture

StatusFileSize
new3.28 KB
new143.89 KB

Twig 2.13.0 was released. Nice.

alexpott’s picture

StatusFileSize
new96.2 KB

Rebase on 9.1.x now that we've updated our dependencies.

alexpott’s picture

StatusFileSize
new9.22 KB
new103.3 KB
alexpott’s picture

StatusFileSize
new1.24 KB
new103.31 KB

Whoops.

alexpott’s picture

andypost’s picture

Finally both green! Yay!

andypost’s picture

StatusFileSize
new103.52 KB

re-roll

Mixologic’s picture

rather than advance to alpha2 and *not* have pecl yaml, I rolled the container back to alpha1 until yaml can be used with alpha2

andypost’s picture

StatusFileSize
new101.33 KB

Re-roll and it works on alpha 3 with https://github.com/andypost/pecl-file_formats-yaml/archive/php8.zip
Maintainers still not replied https://github.com/php/pecl-file_formats-yaml/pull/53

This changes already in

core/lib/Drupal/Core/Render/Element/StatusReport.php.rej
core/lib/Drupal/Core/Url.php.rej
core/modules/user/src/PermissionHandler.php.rej
Mixologic’s picture

FYI : I updated the php8 container to beta1 yesterday as we now have a pecl yaml version we can use.

Mixologic’s picture

beta 3 is now available.

hussainweb’s picture

StatusFileSize
new100.91 KB

I wanted to try this out and noticed it doesn't apply on latest 9.1.x. So, here's a reroll.

hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new1.81 KB
new100.91 KB

The error is due to the line number in the error assertion text. Fixing that.

hussainweb’s picture

I'm also facing problems while trying to manually install this. I'm not sure if this is recent with PHP 8 beta3 or it happened before as well. I can't find any references to that in this issue.

First, I faced problems with incompatible method declarations in doctrine/reflection. I'm on the latest 1.2.1 release and see an error with methods getConstants and newInstance. I manually fixed both those instances (it was trivial) and it moved ahead.

After I entered the database details, I got an error with PDO and I have not tried working around it yet (because the method definition is in the interface as well). This is the error I see:

Fatal error: Declaration of Drupal\Core\Database\Statement::fetchAll($mode = null, $column_index = null, $constructor_arguments = null) must be compatible with PDOStatement::fetchAll(int $fetch_style = PDO::FETCH_BOTH, mixed ...$fetch_args) in /var/www/html/web/core/lib/Drupal/Core/Database/Statement.php on line 169

Now, this class extends the \PDOStatement and also implements \Drupal\Core\Database\StatementInterface. I'll have to change the method signature in both the places which seems like a big change. The funny thing is I couldn't find any information about this online. I'm not sure if I'm just missing something here. I did verify I am running PHP 8.0.0beta3 with build date on Sep 10 2020 13:18:12.

hussainweb’s picture

After some digging, I found the change in PDOStatement here: https://github.com/php/php-src/commit/cfaa270da5b511e2821aa0a5e036ef5879...

hussainweb’s picture

I figured out how to introduce the changes and got it working on PHP 8. The changes are ready to create a patch but I need to fix the docblocks. I'll do it tomorrow. Meanwhile, there's a screenshot here: https://twitter.com/hussainweb/status/1304629804805783552

alexpott’s picture

@hussainweb please see all the sub issues of #3109885: [meta] Ensure compatibility of Drupal 9 with PHP 8.0 (as it evolves) before filing any issues and comment on the correct issue for each thing. The PDO typehinting is dealt with in #3156881: Various methods of \Drupal\Core\Database\StatementInterface have changed their signature for PHP 8

hussainweb’s picture

Thanks @alexpott. It seems like the patch here is a collection of issues from those issues. Is that correct? If so, is the order documented somewhere so that I can recreate the patch here from those patches.

alexpott’s picture

@hussainweb there's no order documented - they shouldn't overlap so there's no order to apply. This patch does have upstream fixes. It fixes the doctrine issue using a class alias - you have to run composer install to get these changes (i.e. there's no need to hack Doctrine code).

gábor hojtsy’s picture

@hussainweb: it would be great if you could help push the individual patches forward, we need all the help at this point. Thanks a lot for tinkering with this!

hussainweb’s picture

Thanks @alexpott.

@Gábor Hojtsy, I see what you mean. I will work with that approach: creating patches for individual issues and then combine them to test them in this issue. I have added a few patches in couple of issues so far. One of them (related to ckeditor) could be simple enough to commit soon.

alexpott’s picture

alexpott’s picture

StatusFileSize
new134.87 KB

Our override of PHPSpec's ClassMirror is not necessary anymore. So removed that. And swapped out the PHPUnit 9 patch for #3127141-84: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new2.34 KB
new137.8 KB

Fixing some more issues - we need two more issues about named arguments and passing by reference incorrectly.

andypost’s picture

1) Aggregator tests fail because Laminas using deprecated function, filed https://github.com/laminas/laminas-feed/issues/24

Exception: Deprecated function: Function libxml_disable_entity_loader() is deprecated
Laminas\Feed\Reader\Reader::importString()() (Line: 318)

2) \Drupal\Tests\field\Unit\FieldStorageConfigEntityUnitTest::testInvalidEnforcedCardinality() needs own issue https://3v4l.org/bQN0U for \Drupal\field\Entity\FieldStorageConfig::getCardinality()

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB
new139.44 KB

Fix few more tests

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new164.83 KB

Aliasing the Reader class so we can concentrate on the Drupal issues.

andypost’s picture

andypost’s picture

StatusFileSize
new3.52 KB
new136.91 KB

Fixed few more tests, needs issue to file and checking remaining

andypost’s picture

StatusFileSize
new3.52 KB
new170.14 KB

interdiff vs #82

andypost’s picture

Just build RC1 and got new failure
Fatal error: Declaration of Drupal\Core\Php8\Doctrine\Reflection\StaticReflectionClass::getConstants(int $filter = ) must be compatible with ReflectionClass::getConstants(?int $filter = null) in /var/www/html/web/core/lib/Drupal/Core/Php8/Doctrine/Reflection/StaticReflectionClass.php on line 91

/srv # php -v
PHP 8.0.0rc1 (cli) (built: Oct  1 2020 05:09:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0rc1, Copyright (c), by Zend Technologies
/srv # php --rf ReflectionClass::getConstants
Method [ <internal:Reflection> public method getConstants ] {

  - Parameters [1] {
    Parameter #0 [ <optional> ?int $filter = null ]
  }
}

After changing, core works

--- a/core/lib/Drupal/Core/Php8/Doctrine/Reflection/StaticReflectionClass.php
+++ b/core/lib/Drupal/Core/Php8/Doctrine/Reflection/StaticReflectionClass.php
@@ -88,7 +88,7 @@ public function getConstant($name)
     /**
      * {@inheritDoc}
      */
-    public function getConstants(int $filter = \ReflectionClassConstant::IS_PUBLIC | \ReflectionClassConstant::IS_PROTECTED | \ReflectionClassConstant::IS_PRIVATE)
+    public function getConstants(?int $filter = null)
     {
         throw new ReflectionException('Method not implemented');
     }
hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new89.11 KB

First rerolling the base patch in #82.

hussainweb’s picture

StatusFileSize
new3.61 KB
new92.61 KB
new166.97 KB

Oops... I missed some of the changes while rebasing. Here are all the patches again (as described in #89).

hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new2.75 KB
new91.32 KB
new165.68 KB

I'm updating \Drupal\Core\Php8\Behat\MinkSelenium2Driver\Selenium2Driver from the changes upstream. Accordingly, I'm also reverting the change in \Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver::uploadFileAndGetRemoteFilePath made in #24.

hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new91.31 KB
new648 bytes

Going to just try to get the base patch working first. I'm reverting one of the changes from upstream.

hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new673 bytes
new91.31 KB

Reverting the other change as well. I didn't think that that would fail.

hussainweb’s picture

StatusFileSize
new91.25 KB

Rerolling

Status: Needs review » Needs work

The last submitted patch, 102: 3156595-base-102.patch, failed testing. View results

hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new89.95 KB
new1.75 KB

That's weird. `composer validate` didn't report this after resolving the merge conflict. Anyway, fixing it.

Also, in #46, there is a comment as to how the change in ConnectionTest.php is a workaround for PHPUnit 9. Since PHPUnit 9 is now used in core (#3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3), I'm going to try reverting that change. I'm doing that mainly because that is conflicting with a change in #3174662: Encapsulate \PDOStatement instead of extending from it which seems like a fix.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

alexpott’s picture

@hussainweb please include the full patch as well as the base patch - otherwise we're not identify new PHP 8 errors - which is the point of this issue.

alexpott’s picture

alexpott’s picture

StatusFileSize
new3.41 KB
new140.94 KB

Now just the views filter thing to fix. That one looks funky. This includes #3177557-2: \Drupal\error_test\Controller\ErrorTestController::generateWarnings() notice is not a notice in PHP 8

alexpott’s picture

StatusFileSize
new757 bytes
new141.84 KB

Yep funky indeed. The current code is only working because of a != instead of a !==. I need to open another issue about this on it's own so we can discuss it further.

alexpott’s picture

StatusFileSize
new100.66 KB

Rebased #111 on HEAD - a lot PHP 8 compatibility patches have been committed. I think we now need to open issues for the rest of the test stuff that's in this.

andypost’s picture

alexpott’s picture

I'm waiting for the rtbc PHP 8.0 issues to be committed before re-rolling this. Patch will be smaller :)

alexpott’s picture

StatusFileSize
new68.53 KB

This removes the doctrine upstream fix and moves us to the dev version of the selenium2 driver and applies #3174928: Improve the stability of core JS testing and prepare for update of MinkSelenium2Driver

andypost’s picture

I think instead of pinning on master-dev better to pin on commit, meantime building 8.0rc3

alexpott’s picture

@andypost why does it matter? this is all temporary.

Status: Needs review » Needs work

The last submitted patch, 115: 3156595-3-115.patch, failed testing. View results

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new55.71 KB

I think the phpdocumentor stuff might have been fixed upstream - let's see. Let's ignore the composer test stuff for now... it's not relevant till we have stable packages to build against...

alexpott’s picture

StatusFileSize
new34.63 KB

Rerolling now the last 2 core blockers are in... all we have now are external dependencies and #3176655: Deprecate GoutteDriver use in core and use Behat\Mink\Driver\BrowserKitDriver directly instead - which is an external dep but solved by getting rid of it.

Status: Needs review » Needs work

The last submitted patch, 120: 3156595-3-120.patch, failed testing. View results

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB
new36.1 KB

There are change to MySQL that seems to be affecting us to do with the way transactions are handled. I'm pretty sure that the change is https://github.com/php/php-src/commit/990bb34891c83d12c5129fd781893704f9...

It's to do with the fact that MySQL doesn't support DDL statements in transactions. And if there is a DDL statement then it's going to auto-commit and close the transaction. We've had code to handle this forever but I think the change above no reports errors where before it didn't. So before we were trying to commit when there was no transaction but it didn't matter. Now it's throwing an exception.

alexpott’s picture

StatusFileSize
new2.49 KB
new35.94 KB

Fun. Atm in HEAD our transactional processing is a little bit faked for MySQL when there is DDL statements.

andypost’s picture

alexpott’s picture

StatusFileSize
new3.36 KB
new38.16 KB

Thanks for digging @andypost yep #2736777: MySQL on PHP 8 now errors when committing or rolling back when there is no active transaction is exactly what we facing. It's a pretty major behaviour change in PHP's MySQL but it is one that makes sense.

Points to a better fix here too... I'm going to add and retitle #2736777: MySQL on PHP 8 now errors when committing or rolling back when there is no active transaction to #3109885: [meta] Ensure compatibility of Drupal 9 with PHP 8.0 (as it evolves)

alexpott’s picture

alexpott’s picture

StatusFileSize
new15.43 KB

Updating to the dev version of laminas-feed since that supports PHP 8 and removing unnecessary changes.

alexpott’s picture

alexpott’s picture

alexpott’s picture

alexpott’s picture

StatusFileSize
new11.77 KB

Is in #2736777: MySQL on PHP 8 now errors when committing or rolling back when there is no active transaction... so a nice small patch here - that only concerns dependencies - yay.

alexpott’s picture

StatusFileSize
new11.77 KB

Rerolled - fixed conflicts in composer.lock

alexpott’s picture

StatusFileSize
new9.85 KB

The laminas releases are out and I worked out a way to fix \Behat\Mink\Driver\Selenium2Driver in \Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver

So we should now be able to test without the ignore platform reqs...

andypost’s picture

Something weird with 8.0 composer test

alexpott’s picture

StatusFileSize
new1.06 KB
new10.79 KB

We can fix the platform in the root composer.json. There's an issue for this. Now we've got the composer projects this feel completely okay to add now.

The last submitted patch, 133: 3156595-4-133.patch, failed testing. View results

andypost’s picture

Strange one test failure

alexpott’s picture

@andypost I think it is happening because DrupalCI is using Composer v1 and that is not PHP 8 compatible. it is using phar:///usr/local/bin/composer

alexpott’s picture

@andypost nope I'm wrong... Running 2.0.3 (2020-10-28 15:50:55) with PHP 8.0.0RC3 on Linux / 4.9.0-0.bpo.6-amd64

alexpott’s picture

StatusFileSize
new2.51 KB

The laminas dependency update has landed...

effulgentsia’s picture

StatusFileSize
new1.06 KB

I committed #3183420: Override \Behat\Mink\Driver\Selenium2Driver::uploadFile() in DrupalSelenium2Driver to 9.2. This patch removes that corresponding hunk from #140.

effulgentsia’s picture

StatusFileSize
new2.17 KB
new945 bytes

Uploading this to make DrupalCI output on PHP 7 the same composer output that is failing on PHP 8.

Status: Needs review » Needs work

The last submitted patch, 143: 3156595-4-143.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

effulgentsia’s picture

On PHP 7:
Running 1.10.13 (2020-09-09 11:46:34) with PHP 7.3.23 on Linux / 4.9.0-0.bpo.6-amd64

On PHP 8:
Running 2.0.3 (2020-10-28 15:50:55) with PHP 8.0.0RC3 on Linux / 4.9.0-0.bpo.6-amd64

Perhaps the failure is less about PHP 8 than it is about Composer 2? Also, DrupalCI is using Composer 2.0.3, but 2.0.7 is already out and includes fixes, such as "Fixed regression in 2.0.5 dealing with custom installers which do not pass absolute paths", which might not be related (if the regression wasn't present in 2.0.3), but probably still worth updating to rule it out.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new1.73 KB

@effulgentsia I'm pretty sure this about Composer 2 - and how we define path repos in \Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest::makeVendorPackage()

In that method we define them with relative paths so it would not surprise me if upgrade composer 2 on Drupal CI did fix this.

That said I wonder if the patch attached fixes this.

effulgentsia’s picture

Nice!

+++ b/composer.json
@@ -46,7 +46,10 @@
+        "platform": {
+            "php": "7.4.99"
+        }

Is there any downside to this for people on PHP 7.3? Tests pass on #146, but I'm wondering if there's any potential problem that isn't caught by our tests.

effulgentsia’s picture

StatusFileSize
new681 bytes

Curious if just this much works with --ignore-platform-reqs

effulgentsia’s picture

Moved #148 to #3183825: Use absolute instead of relative paths within the packages.json created in ComposerProjectTemplatesTest.

Once that's in, I'm not clear on whether we still want discussion on #142.

alexpott’s picture

Re setting platform php in composer - there is a much wider debate of the topic in #3098281: Ensure that 'composer update' evaluates dependencies using the correct PHP version - also an RTBC patch that fixes this - also it sets it to our minimum PHP and tests for this. I meant to link this in #141 but added a link to this issue - ho hum.

alexpott’s picture

StatusFileSize
new4.11 KB

Patch attached is #3098281: Ensure that 'composer update' evaluates dependencies using the correct PHP version + #3183825: Use absolute instead of relative paths within the packages.json created in ComposerProjectTemplatesTest

I guess it might be worth explaining why we need #3183825: Use absolute instead of relative paths within the packages.json created in ComposerProjectTemplatesTest - this is because on PHP 8 our ROOT composer.lock does contain a set of installable packages on PHP 8 - as PHPUnit is locked v8. So we need to use the platform setting to run install as though we're on PHP 7. The ability to do this isn one of a number of reasons why I think constraining the maximum PHP version in composer.json is wrong. Another very important point to note is the root composer.json file is core development's alone. No site uses this. You are not supposed to start a site from checking out Drupal and if you composer will tell you are doing it wrong. All this and more is discussed on #3183825: Use absolute instead of relative paths within the packages.json created in ComposerProjectTemplatesTest.

There is another solution and one that we should consider for 9.2.x. We can lock to PHPUnit 9. PHPUnit 9 is compatible with Drupal 9's minimum PHP version and also is the first PHPUnit to get life support. The the root composer.lock would be compatible with both PHP 7.3 and PHP 8. I'm going to open an issue to discuss making this change. That said I think #3183825: Use absolute instead of relative paths within the packages.json created in ComposerProjectTemplatesTest is viable solution for 9.1 and has other benefits for the core dev community.

Mixologic’s picture

re #145 I have recently set all containers to use composer 1 until we can get core to not be testing system local composer: https://www.drupal.org/project/drupal/issues/3182188

alexpott’s picture

Status: Needs review » Fixed

Going to mark this issue as fixed because Drupal 9.2.x is currently installable on PHP 8.0 and it's part of the automated test suite. Crediting everyone who commented on the issue for posterity.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

djg_tram’s picture

What is exactly the situation with this? I've just tried to upgrade a site that was running on 9.0.latest to 9.1.3 and all I get is the error message mentioned in #63. This isn't a live site, just a dev one, using Docker, the Drupal 9.1.3 image is referencing PHP 8 all right. Is this supposed to be working or shall I postpone the upgrade?

voleger’s picture

See https://www.drupal.org/docs/system-requirements/php-requirements
The recommendation is to upgrade the core before actually upgrading the PHP version.

djg_tram’s picture

Unfortunately, that's not how Docker works, as far as I can tell. I know it's a third party as far as Drupal itself is concerned, but being one of the major vehicles of deployment these days... :-)