2x: The "Symfony\Component\Debug\BufferingLogger" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\BufferingLogger" instead.
1x in EntityReferenceSettingsTest::testConfigTargetBundleDeletion from Drupal\Tests\field\Kernel\EntityReference
1x in EntityReferenceSettingsTest::testCustomTargetBundleDeletion from Drupal\Tests\field\Kernel\EntityReference

2x: The "entity_reference_settings_test.logger" service relies on the deprecated "Symfony\Component\Debug\BufferingLogger" class. It should either be deprecated or its implementation upgraded.
1x in EntityReferenceSettingsTest::testConfigTargetBundleDeletion from Drupal\Tests\field\Kernel\EntityReference
1x in EntityReferenceSettingsTest::testCustomTargetBundleDeletion from Drupal\Tests\field\Kernel\EntityReference

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review
FileSize
3.13 KB
Kristen Pol’s picture

Assigned: Unassigned » Kristen Pol
Kristen Pol’s picture

Assigned: Kristen Pol » Unassigned
Status: Needs review » Needs work

Thanks for the patch.

1) Found reference to BufferingLogger in 9.0 dev code in these files:

  • core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
  • core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
  • vendor/symfony/debug/BufferingLogger.php
  • vendor/symfony/debug/CHANGELOG.md
  • vendor/symfony/debug/Debug.php
  • vendor/symfony/debug/ErrorHandler.php
  • vendor/symfony/error-handler/BufferingLogger.php
  • vendor/symfony/error-handler/Debug.php
  • vendor/symfony/error-handler/ErrorHandler.php

2) The patch swaps:

Symfony\Component\Debug\BufferingLogger

with

Symfony\Component\ErrorHandler\BufferingLogger

and removes the deprecation warnings from DeprecationListenerTrait.php.

Looking at vendor/symfony/debug/BufferingLogger.php it has:

@deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\BufferingLogger instead.

so this looks correct.

3) The patch did not apply cleanly to 9.0 so moving back to "Needs work"

[mac:kristen:drupal-9.0.x-dev]$ patch -p1 < 3117857.patch 
patching file core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
patching file core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
Hunk #1 FAILED at 115.
Hunk #2 succeeded at 160 (offset -9 lines).
1 out of 2 hunks FAILED -- saving rejects to file core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php.rej
longwave’s picture

Status: Needs work » Needs review
FileSize
3.25 KB

Thanks for the review, rerolled.

Kristen Pol’s picture

Assigned: Unassigned » Kristen Pol
Kristen Pol’s picture

Assigned: Kristen Pol » Unassigned
Status: Needs review » Reviewed & tested by the community

Thanks for the reroll. The patch applied cleanly and not sure this can be manually tested, so marking RTBC.

[mac:kristen:drupal-9.0.x-dev]$ patch -p1 < 3117857-5.patch
patching file core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
patching file core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a re-roll.

piyuesh23’s picture

Issue tags: +DIACWApril2020
ashokrd2013’s picture

Assigned: Unassigned » ashokrd2013
govind.maloo’s picture

Status: Needs work » Needs review
FileSize
3.21 KB

Rerolled patch.

longwave’s picture

Assigned: ashokrd2013 » Unassigned
Issue tags: -Needs reroll
FileSize
3.38 KB
longwave’s picture

Do we need to explicitly add a dependency on symfony/error-handler with this change? And can we remove symfony/debug as well, as we don't seem to use it directly?

Kristen Pol’s picture

@longwave I don't understand your comment. Are you referring to this:

+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
@@ -9,7 +9,7 @@
 use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
-use Symfony\Component\Debug\BufferingLogger;
+use Symfony\Component\ErrorHandler\BufferingLogger;

?

BufferingLogger is used in core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php, here:

  public function register(ContainerBuilder $container) {
    parent::register($container);
    $container
      ->register($this->testLogServiceName, BufferingLogger::class)
      ->addTag('logger');
  }
longwave’s picture

I am referring to this in composer.json:

    "require-dev": {
        "symfony/debug": "^4.4",
    },

The only two references to Symfony\Component\Debug are being removed in this patch:

$ rg 'Symfony\\Component\\Debug' core
core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
162:      'The "Symfony\Component\Debug\BufferingLogger" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\BufferingLogger" instead.',

core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
12:use Symfony\Component\Debug\BufferingLogger;

Symfony\Component\ErrorHandler is a newly introduced dependency after this change, except one mention in a comment:

$ rg 'Symfony\\Component\\ErrorHandler' core
core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
162:      // testing using \Symfony\Component\ErrorHandler\DebugClassLoader.

core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
12:use Symfony\Component\ErrorHandler\BufferingLogger;

Therefore I wonder if we need to add symfony/error-handler to composer.json, and perhaps remove symfony/debug? Technically this makes no real difference because other Symfony dependencies already pull in both packages - but we should also be explicit about the code we rely on.

Kristen Pol’s picture

Oh! Of course, that make sense. Thanks for spelling that out for me. I agree with you on "we should also be explicit about the code we rely on".

catch’s picture

Status: Needs review » Needs work

Marking needs work for the dependency changes.

longwave’s picture

Status: Needs work » Needs review
FileSize
4.91 KB
1.53 KB
Kristen Pol’s picture

Assigned: Unassigned » Kristen Pol
Kristen Pol’s picture

Assigned: Kristen Pol » Unassigned
Status: Needs review » Reviewed & tested by the community

Thanks for the update.

1) Reviewed the changes and they look fine.

2) Compared patches in #12 and #18 to confirm the composer changes were the only ones.

3) Re-checked the whole patch.

4) Applies cleanly:

[mac:kristen:drupal-9.0.x-dev]$ patch -p1 < 3117857-18.patch 
patching file composer.json
patching file composer.lock
patching file composer/Metapackage/DevDependencies/composer.json
patching file core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
patching file core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php

5) Searched for symfony/debug after applying patch and it's referenced in:

a) composer.lock - autogenerated

b) composer/Metapackage/CoreRecommended/composer.json - ok

c) core/lib/Drupal/Core/Composer/Composer.php - $packageToCleanup

Should symfony/error-handler be added here? I don't understand what this is used for. The list in there doesn't match up with composer.json.

6) Searched for symfony/error-handler after applying patch and it's referenced in:

a) composer.lock - autogenerated

b) composer.json - added via patch

7) Searched for BufferingLogger after applying patch and it's only referenced in the code handled by the patch.

8) I'm going to assume 5c isn't a thing and that there is no good way to test manually. Since tests pass, marking this RTBC.

jungle’s picture

@Kristen Pol, thanks for your great review!

Core is directly dependent upon prophecy, we should always declare dependents that we are using and not rely on the fact that they are pulled in transitively. Everywhere that we have use Prophecy\Argument; for example. If phpunit decides to replace prophecy with something else, or bumps the version of it to something incompatible with our usage, our code breaks.

-- @mixologic

Re #20.5c, As @mixologic said on slack on Mar 20, 2020, "we should always declare dependents that we are using and not rely on the fact that they are pulled in transitively", So it's good to add symfony/error-handler .

Queued the testing against 9.0.x, RTBC+1

Kristen Pol’s picture

Thanks @jungle. I'm a bit confused. You have RTBC+1 but you also have:

Re #20.5c, As @mixologic said on slack on Mar 20, 2020, "we should always declare dependents that we are using and not rely on the fact that they are pulled in transitively", So it's good to add symfony/error-handler .

Do you mean to add it to core/lib/Drupal/Core/Composer/Composer.php? As noted in #20.5c, it's missing from that. If it needs to be added, this issue should go back to "Needs work".

jungle’s picture

+++ b/composer.json
@@ -25,7 +25,7 @@
+        "symfony/error-handler": "^4.4",

I meant adding symfony/error-handler to composer.json from my understanding of what @mixologic said which is good,

c) core/lib/Drupal/Core/Composer/Composer.php - $packageToCleanup

Should symfony/error-handler be added here?

At first glance, I thought it's talking about adding to composer.json. The comment in #15 was in my mind . My bad. Apologize.

Back to the question. \Drupal\Core\Composer\Composer::$packageToCleanup is to make packages smaller by removing unnecessary tests/docs files etc.

+++ b/composer.json
@@ -25,7 +25,7 @@
-        "symfony/debug": "^4.4",
+        "symfony/error-handler": "^4.4",

symfony/debug was removed, symfony/error-handler was added, so yes, I think it's good to add ['symfony/error-handler'] => ['Tests'], to there.

jungle’s picture

Assigned: Unassigned » jungle
Status: Reviewed & tested by the community » Needs work
jungle’s picture

Assigned: jungle » Unassigned
Status: Needs work » Needs review
FileSize
5.46 KB
562 bytes

Adding ['symfony/error-handler'] => ['Tests'], to \Drupal\Core\Composer\Composer::$packageToCleanup

jungle’s picture

To make it more clear

Kristen Pol’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the update.

1) Confirmed the only change was to core/lib/Drupal/Core/Composer/Composer.php.

+++ b/core/lib/Drupal/Core/Composer/Composer.php
@@ -75,6 +75,7 @@ class Composer {
     'symfony/dom-crawler' => ['Tests'],
     'symfony/filesystem' => ['Tests'],
     'symfony/finder' => ['Tests'],
+    'symfony/error-handler' => ['Tests'],
     'symfony/event-dispatcher' => ['Tests'],

Nitpick: Not alphabetical, but it was already like that with filesystem and finder before event-dispatcher, so not marking "Needs work".

2) Patch applies cleanly:

[mac:kristen:drupal-9.0.x-dev]$ patch -p1 < 3117857-25.patch
patching file composer.json
patching file composer.lock
patching file composer/Metapackage/DevDependencies/composer.json
patching file core/lib/Drupal/Core/Composer/Composer.php
patching file core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
patching file core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php

3) Marking RTBC! Thanks!

longwave’s picture

Thanks @Kristen Pol for the detailed reviews, and thanks @jungle for picking up that change in the test cleanup code that I missed.

  • catch committed 0956869 on 9.1.x
    Issue #3117857 by longwave, jungle, govind.maloo, Kristen Pol: [Symfony...

  • catch committed 232a363 on 9.0.x
    Issue #3117857 by longwave, jungle, govind.maloo, Kristen Pol: [Symfony...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.1.x and 9.0.x, thanks!

Status: Fixed » Closed (fixed)

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