Problem/Motivation
Checking access to /admin/structure/comment/manage/comment/display logs the warning message
Entity view display 'node.article.default': Component 'comment' was disabled because its settings depend on removed dependencies.
Using Drupal 10.3 and the contrib admin_toolbar module, the access check and the warning message are triggered on every page load for an admin user.
Here is a partial stack trace for the warning message:
Drupal\Core\Entity\EntityDisplayBase->onDependencyRemoval()
Drupal\Core\Config\ConfigManager->callOnDependencyRemoval()
Drupal\Core\Config\ConfigManager->getConfigEntitiesToChangeOnDependencyRemoval()
Drupal\user\Form\EntityPermissionsForm->permissionsByProvider()
Drupal\user\Form\EntityPermissionsForm->access()
Steps to reproduce
These steps trigger the warning once, since Drupal 9.4.0:
- Install Drupal with the
standardprofile. - Browse to Administration > Structure > Comment types > Default comments > Manage display:
/admin/structure/comment/manage/comment/display - Check error logs:
/admin/reports/dblog
These steps trigger the warning on every page load:
- Install Drupal 10.3 with the
standardprofile. - Add the Admin Toolbar module.
- Enable the
admin_toolbarandadmin_toolbar_toolsmodules. - Log in as an admin user.
- Visit
/admin/reports/dblogand reload the page a few times.
This only happens on Drupal 10.3 (and 11.x) thanks to #2463753: [regression] Do not bypass route access with 'link to any page' permissions for menu links.
Proposed resolution
In Drupal\user\Form\EntityPermissionsForm::permissionsByProvider(), call Drupal\Core\Config\ConfigManager::findConfigEntityDependencies() or Drupal\Core\Config\ConfigManager::findConfigEntityDependenciesAsEntities() instead of Drupal\Core\Config\ConfigManager::getConfigEntitiesToChangeOnDependencyRemoval().
Remaining tasks
We might want to add follow-up issues for the following:
- Update
Drupal\Core\Entity\EntityDisplayBase::onDependencyRemoval()so that it does not log warning messages, or find a way to suppress those messages. See Comment #66. - Update
Drupal\comment\Tests\CommentTestTrait::addDefaultCommentField()to use the'default'view mode by default, not'full'. See Comment #61.
User interface changes
None
API changes
None, unless (2) from the Remaining tasks is done as part of this issue.
Data model changes
None
Release notes snippet
N/A
Original report by DYdave
Initial investigation
After doing an initial investigation, the error message would seem to come from the following piece of code:
https://git.drupalcode.org/project/drupal/-/blob/9.4.5/core/lib/Drupal/C...
// If there are unresolved deleted dependencies left, disable this
// component to avoid the removal of the entire display entity.
if ($this->getPluginRemovedDependencies($renderer->calculateDependencies(), $dependencies)) {
$this->removeComponent($name);
$arguments = [
'@display' => (string) $this->getEntityType()->getLabel(),
'@id' => $this->id(),
'@name' => $name,
];
$this->getLogger()->warning("@display '@id': Component '@name' was disabled because its settings depend on removed dependencies.", $arguments);
$changed = TRUE;
}
It would seem a lot of this code relates to issue: #2562107-77: EntityDisplayBase should react on removal of its components dependencies.
After doing some basic debugging, breaking at this point in code resulted in the following stack trace:
array:55 [▼
0 => array:7 [▼
"file" => "/web/core/lib/Drupal/Core/Config/ConfigManager.php"
"line" => 497
"function" => "onDependencyRemoval"
"class" => "Drupal\Core\Entity\EntityDisplayBase"
"object" => Drupal\Core\Entity\Entity\EntityViewDisplay {#2650 ▶}
"type" => "->"
"args" => array:1 [▶]
]
1 => array:7 [▼
"file" => "/web/core/lib/Drupal/Core/Config/ConfigManager.php"
"line" => 360
"function" => "callOnDependencyRemoval"
"class" => "Drupal\Core\Config\ConfigManager"
"object" => Drupal\Core\Config\ConfigManager {#857 ▶}
"type" => "->"
"args" => array:4 [▶]
]
2 => array:7 [▼
"file" => "/web/core/modules/user/src/Form/EntityPermissionsForm.php"
"line" => 88
"function" => "getConfigEntitiesToChangeOnDependencyRemoval"
"class" => "Drupal\Core\Config\ConfigManager"
"object" => Drupal\Core\Config\ConfigManager {#857 ▶}
"type" => "->"
"args" => array:2 [▶]
]
3 => array:7 [▼
"file" => "/web/core/modules/user/src/Form/EntityPermissionsForm.php"
"line" => 173
"function" => "permissionsByProvider"
"class" => "Drupal\user\Form\EntityPermissionsForm"
"object" => Drupal\user\Form\EntityPermissionsForm {#2057 ▶}
"type" => "->"
"args" => []
]
4 => array:5 [▼
"function" => "access"
"class" => "Drupal\user\Form\EntityPermissionsForm"
"object" => Drupal\user\Form\EntityPermissionsForm {#2057 ▶}
"type" => "->"
"args" => array:3 [▶]
...
Mostly, with this chain of calls:
[... Multiple calls before ...] Drupal\user\Form\EntityPermissionsForm:permissionsByProvider Drupal\Core\Config\ConfigManager:getConfigEntitiesToChangeOnDependencyRemoval Drupal\Core\Config\ConfigManager:callOnDependencyRemoval Drupal\Core\Entity\EntityDisplayBase:onDependencyRemoval
The code of these functions seems to be related to #2850973: ConfigEntityInterface::onDependencyRemoval() called with incorrect dependency list.
In short, the reason the problem happens is because:
When the Manage Display Comment page is displayed, a list of all config depending on 'comment.type.comment' is created.
Since the default display of comments 'core.entity_view_display.comment.comment.default' depends on 'comment.type.comment' and since 'core.entity_view_display.node.article.default' depends on 'core.entity_view_display.comment.comment.default' it is also added to the list of dependencies.
core.entity_view_display.node.article.default > core.entity_view_display.comment.comment.default > comment.type.comment
The affected "cross" dependency is due to the fact the Node, type Article, default display 'core.entity_view_display.node.article.default' uses the default comment formatter (to display the Comment field), which points to the default display of the Comment, type Comment 'core.entity_view_display.comment.comment.default', see:
https://git.drupalcode.org/project/drupal/-/blob/9.4.5/core/modules/comm...
In particular lines around 270:
if ($display = EntityViewDisplay::load("comment.$bundle.$mode")) {
$dependencies[$display->getConfigDependencyKey()][] = $display->getConfigDependencyName();
}
From a logic perspective it certainly makes sense to allow the default comment formatter, and Plugins in general to react to configuration changes on Entity Displays.
For example, it would probably make sense adding a specific handling case for the default comment formatter: Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter:onDependencyRemoval, to check whether the referenced display still exists and capture any changes to the settings, much like it's currently done for the 'ImageFormatter', see:
https://git.drupalcode.org/project/drupal/-/blob/9.4.5/core/modules/imag...
Work-around/Temporary solution
Note the problem can be fixed temporarily by removing the config dependency either programmatically, or by importing the modified config through the backend (at '/admin/config/development/configuration/single/import/') or from its file (edit file 'config/sync/core.entity_view_display.node.article.default.yml', remove the line 'core.entity_view_display.comment.comment.default' under 'config' and import).
But of course the config is added back the next time the Node Article display 'core.entity_view_display.node.article.default' is saved.
Lastly, since we're really unsure how to approach the problem and the config dependency system seems to have a lot of moving parts, we found the following issues that could potentially be related or where some work is carried around Plugins 'getPluginRemovedDependencies' and 'getPluginRemovedDependencies':
- #2786841: Entity reference fields should add selection handler config dependencies
- #2865710: Dependencies from only one instance of a widget are used in display modes
- #2579743: Config entities implementing EntityWithPluginCollectionInterface should ask the plugins to react when their dependencies are removed
We would greatly appreciate to have your feedback and more particularly, if anyone would have any pointers or guidance on what could be the best approach to finding a solution to the problem.
Feel free to let us know if you have any questions, if anything is unclear or if more information would be needed, we would surely be glad to help.
Thanks in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | recursive component comment was disabled on dblog.png | 239.93 KB | kopeboy |
Issue fork drupal-3306434
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3306434-config-warning-entity
changes, plain diff MR !8487
Comments
Comment #2
dydave commentedComment #3
quietone commented@DYdave, thanks for the detailed issue summary.
I followed the steps to reproduce and get the same behavior and error. Since the workaround is temporary, changing to Major.
Comment #4
quietone commentedUsing git bisect, it looks like this started with 91fdb8a #2934995: Add a "Manage permissions" tab for each bundle that has associated permissions. That was initially committed to 9.3.x and then reverted.
I did some minimal searching but did not find a duplicate.
Comment #5
youkho commentedSame problem here
Comment #6
aleixSame here. Disabling the comment field in failing view mode and enabling it again doesn't solve the problem. Just disabling the comment in view mode hides the problem, I end up doing so as I don't need comments. So sorry, I cannot help...
Comment #8
socialnicheguru commentedI am not sure how to deal with this.
This is causing a major performance slow down.
I do not know what dependency no longer exists or how to check for it.
The config for all of the view mode displays look fine
The config for core comments looks fine
Any thoughts on how to debug?
Comment #9
socialnicheguru commentedComment #10
aharown07 commentedI'm afflicted with this one now also, in 9.5.1. Anyone aware of a fix yet?
Comment #11
socialnicheguru commented1) How can you find out what dependencies are missing?
2) Is there something specific to the comment type? if I create my own comment type and use it, will the dependency issue still show up? is the issue specifc to the default comment view mode, 'core.entity_view_display.comment.comment.default', or all comment view modes?
3. what happens if you use another view mode other than default will this error still happen?
Comment #12
socialnicheguru commented[WORK AROUND]
I ended up creating my own comment type and replacing the core comment type in my fields. I no longer see the errors.
Comment #13
tsotoodeh commentedHey guys
Same issue observed in 9.5.3 and 10.0.3 versions. Any workaround yet?
Comment #14
larowlanThis is a warning coming from access checking of comment-types for the 'permissions' tab.
If you don't really want permissions tab for comment-types, you can add this to a custom module.
You will lose the 'Permissions' tab for comment types, but its probably not an issue.
Comment #15
fenstratIn theory #3344789: Return early in EntityPermissionsForm::access if the user does not have "administer permissions" could fix this. Also being discussed there is the potential for removing the whole dynamic hiding of the permission local task all together (which is what triggers this issue).
Comment #16
berdirI was going to comment that removing the call there should still result in the same problem in other (although rarer) cases, but only in expected scenarios.
What's happening is that the permission access stuff is asking for config that needs to be updated or deleted if the comment type were to be deleted. That includes its view and form displays, then removing those will result in following that trail to the node type display and it's rendering of comments, which depends on that comment view display, it can't reconfigure it self to something else, so it gets disabled. The UI doesn't even allow you to delete a comment type while there are still fields using it, so you can't generate the same error there, not in the UI anyway. And while there are other situations where this could happen with other formatters, as long as it's called only on the delete confirm form, it's a much, muss less severe problem, the only possible thing to improve would be how this is presented.
Comment #18
very_random_man commentedJust here to say that I was getting this issue on Drupal 10.2.4 and the workaround in #14 still does the job. Thanks!
Comment #19
Anonymous (not verified) commentedDrupal 10.2.7 is ok but this problem is still observed in version 10.3.
#15 doesn't work for 10.3. It could not apply patch.
Comment #20
amanire commentedNoting that the workaround in #14 also resolved this for me. But that it took me a while to figure out how to reproduce and confirm because I was not creating watchdog entries with the warning when logged in with the "Administrator" role. Once I realized that this was happening, I tried logging in with another user account with fewer permissions and successfully reproduced the warnings in the description.
Comment #21
kopeboyThis is a very annoying error considering it happens on a fresh install of Drupal core only (10.3.0-rc1), ie. on ANY website, for the site builder.
After adding a few modules you can even easily get out of memory errors (>1GB) for doing a Flush all caches from the Admin toolbar link (with the site still being blank!).
Comment #22
kopeboyIt gets even worse if you add coffee module, cause the config calculation and dblog are triggered everywhere!

Comment #23
kaszarobertJust updated to 10.3.0 and suddenly this error fills the logs.
Comment #24
arx-e commentedAlso updated to 10.3.0 today and I have white screens on the main theme and lots of entries of this error.
EDIT: White screens on certain pages seems unrelated to this issue.
Comment #25
butch.coolidgeSame here on several installations after upgrading to 10.3,
Comment #26
aitala commentedAnother instance of this message popping up on a 10.3 update...
Whee!
Eric
Comment #27
idflorin commentedDrupal 10.2.7 is okay, but this problem reappeared after updating to 10.3.
Entity view display 'node.story.default': Component 'comment' was disabled because its settings depend on removed dependencies.Comment #28
bobburns commentedSame issue after upgrade to 10.3 of as 23, 24, 25, 26, 27
Comment #29
catchGiven this bug is two years old but lots of people are just hitting it now, it feels like it's being triggered by something. The mention of router access makes me wonder if it's #3413508: Admin page access denied even when access is given to child items - could someone try reverting the commit from that issue to see if it helps?
Bumping this to critical - even if the original bug maybe isn't, the side effects combined with whatever is triggering it more in 10.3 are.
Comment #30
bobburns commentedThat patch is committed to core and is already applied to 10.3 - I checked the code
I built a mini custom module with the function from #14 and called it "comment_block" with just an info file an module with the function and it has removed the errors - but of course does not answer what is causing it
comment_block (in modules - a directory)
comment_block.info.yml (file)
name: 'Comment Block'
description: 'Blocks comment dependency error'
core_version_requirement: ">=8"
type: module
comment_block.module (file)
<?php
// https://www.drupal.org/project/drupal/issues/3306434 (#14)
function comment_block_entity_type_alter(array &$entity_types): void {
if (isset($entity_types['comment_type'])) {
assert($entity_types['comment_type'] instanceof \Drupal\Core\Config\Entity\ConfigEntityTypeInterface);
$route_providers = $entity_types['comment_type']->getRouteProviderClasses();
unset($route_providers['permissions']);
$entity_types['comment_type']->setHandlerClass('route_provider', $route_providers);
}
}
install it and the errors are gone
Comment #31
catchYes I know, I'm wondering if it caused the problem here, and asked if someone could test reverting it.
Comment #32
quietone commentedI tested by reverting the commit for #3413508: Admin page access denied even when access is given to child items, doing a standard install and following the steps in the issue summary. The failure persists.
Bit did you see comment #4? That used git bisect, to track this to 91fdb8a #2934995: Add a "Manage permissions" tab for each bundle that has associated permissions.
Comment #34
berdirI think there are two different issues here.
a) That we attempt to change config like that at runtime just to check if there are permissions. This is using the config API in a way that's not intended and really bad for performance. That's cased by the manage permissions issue, and #3384600: [backport] Don't hide permissions local tasks on bundles when no permissions are defined would "fix" that I believe. It stalled out unfortunately.
b) The fact that this view display does have invalid config that causes it to trigger an automated change. That's something that we should/could fix here.
I didn't look into what the problem exactly is, but it could also be triggered in another scenario so it makes sense to make both changes, a) for performance and b) for consistency.
Comment #35
quietone commentedAh, thanks. I applied the diff from #3384600: [backport] Don't hide permissions local tasks on bundles when no permissions are defined locally and the test here now passes. Maybe close this in favor of that? It is too late here to think about that.
Comment #36
kmv commentedNB: the workaround in #12 does not work for me, the warning moves to the new comment.
Comment #37
davidwhthomas commentedJust noting I also hit this issue after the Drupal core 10.3.0 upgrade today. It caused significant noticeable site slowdown with many similar log entries.
The workaround approach in #14 helped to fix the issue for now, with thanks.
edit: noting the preventative fix in https://www.drupal.org/project/drupal/issues/3384600 works and is preferable, it helps prevent the issue in the first place.
Using both patches seems best to avoid any expensive access check though.
Comment #38
adrianm6254 commentedI tried #14 and that did not resolve my issue that only started when I upgraded to 10.3.0-rc1.
I am getting this same error on every site I have upgraded from 10.2x
Comment #39
agoradesign commentedhappened to me in 10.3.0 too, #14 didn't help though.
I had a look at the stack trace, it is related to comment_type's route access checking. admin_toolbar is calling the menu link tree's transform():
#3456128: Dynamic Page Cache uncachable on Drupal 10.3 with Admin Toolbar Tools and Update modules is definitely related imho. A comment there is pointing to #2463753: [regression] Do not bypass route access with 'link to any page' permissions for menu links as the root - looking at the changes made there, compared with the calls in the stack trace, this seems very realistic to me
Comment #40
cprofessionals commentedsame issue here 10.2.5 > 10.3.0
Comment #41
berdirThe correct issue that fixes this is #3384600: [backport] Don't hide permissions local tasks on bundles when no permissions are defined, admin_toolbar isn't the problem, it just exposes this.
I orignally thought that there's an issue on how the config for comment formatter is defined, but no, everything is fine here. That referenced issue is the only thing we need to fix. It specifically asks the config management system what it needs to do if the comment.type.comment config gets deleted, which bubbles up and results in removing the config for the comment formatter.
As mentioned over there, this API is just not meant to be used like this, it's slow and actively does way too much stuff way too much for this to be used as an access check.
Comment #42
sjhuskey commentedForgive me for being dim, but the issue cited by #41 has to do with Drupal core 11.x-dev, doesn't it? Those who have posted earlier in this thread have been concerned about 10.3 and previous versions.
I implemented the custom module solution as suggested by #30 on my 10.3 site. It seems to have resolved the issue.
Comment #43
mortona2k commentedI was able to apply the patch from #3384600 to 10.3.
but now I see a deprecation message instead of the warning:I cleared the cache and now have no warnings/messages at /admin/structure/comment/manage/comment/display.
Comment #44
frankied3Applying the patch from #3384600 on my 10.3.0 install has resolved the issue for me as well.
Comment #45
anybodyI can also confirm that the patch from #3384600: [backport] Don't hide permissions local tasks on bundles when no permissions are defined solved the issue for us. We had this for forum nodes.
Comment #46
klemendev commentedHappening since updating to 10.3 from 10.2. Site is super slow due to all of logging for all comment types and display modes of nodes that contain those comment types for every node visit
Comment #47
klemendev commentedPatch #5 from https://www.drupal.org/project/drupal/issues/3384600 fixes the problem described in https://www.drupal.org/project/drupal/issues/3306434 that started happening when updating from 10.2 to 10.3
Comment #48
bobburns commentedI installed the 3384600 patch and then uninstalled the custom module I made and no errors have returned
It threw user notices into the log one time
Since this is a core patch, I keep a directory in the modules directory with patches because on the next core upgrade if this is not committed to core the issue will return, and I do not want to dig like a pig for truffels to find the patch again
Comment #49
gjleger commentedI just wanted to mention that Bob Burns step by step comment #30 was so easy a dead jellyfish could do it, so I didn't have any problems.
Thank you for taking the time.
Comment #50
klemendev commentedI hope #3384600 lands soon as this prevents 10.3 from being "usable" due to the amount of logging that happens with this bug
Comment #51
subir_ghoshI got this on a fresh install of 10.3.0.
Update: Uninstalling the Admin Toolbar removes the issue.
Comment #53
benjifisherFrom Comment #35:
It looks to me as though the change from #3384600 that is relevant to this issue is out of scope for that issue. I suggest that we revert that change (+2/-2) in that issue and apply it here. I have updated the MR here with that change. The test in the MR now passes locally.
One advantage to making the change as part of this issue is that it can be done in the next patch release. Since #3384600 adds a deprecation, it can only be done in the next minor.
I am not sure what the difference is between
findConfigEntityDependencies()andfindConfigEntityDependenciesAsEntities(). I use the second, since that is what was used in #3384600, but I think the first is simpler and gives the same result here, since we extract the config dependency name from the entity/dependency object.Comment #54
benjifisherTests are now passing, but NW for Berdir's comment on the MR.
I can work on this after my day job, unless someone else wants to update the test.
I have read most of the comments on this issue, and I think it is still a mystery why this bug seems to be more of a problem on 10.3 than on earlier versions. Has anyone checked the effect of the PHP version?
Comment #55
anybody@Berdir thanks! I can only tell that we didn't switch the PHP version when upgrading to 10.3.0 where the issue appeared. So it's indeed still a mystery.
Comment #56
benjifisherI made the requested change to the test, so back to NR.
This bug was first reported in 2022, with Drupal 9.4.5 and PHP 7.4. I have tested with 10.3.x and 10.2.0, and @quietone (Comment #4) used
git bisectto determine that the bug was introduced with #2934995: Add a "Manage permissions" tab for each bundle that has associated permissions. (I am adding that as a related issue.)Why, then, are people reporting that their logs are being flooded with this error after upgrading to 10.3.0?
Here are some ideas. Probably some are silly.
Maybe what we really need are better steps to reproduce (STR). The issue summary has STR a few warnings in the logs, but we need STR a flood of warning messages. Can we reproduce that with just Drupal core, or with just Drupal core and the
admin_toolbarmodule? Does the behavior change when upgrading from Drupal 10.2.7 to 10.3.0?Comment #57
alisonMR #8487 fixes the dblog warning flood for me on 10.3.0! (PHP 8.1, in case it matters) I don't see any side effects.
(Setting to RTBC in hopes of getting it into 10.3.1 tomorrow -- apologies if this is bad form because it's not 11.x-dev as the issue is tagged.)
Comment #58
larowlanComment #59
benjifisher@larowlan:
Thanks for keeping me honest. I was being sloppy with the test.
I spent some time just now looking at it. Among other things, I tried enabling the
nodemodule, adding a content type, and (withCommentTestTrait) adding a comment field to the content type. That was not enough to reproduce the error.@Berdir discussed the inconsistent configuration in Comments #16, #34, #41. I need more detail before I can figure out how to reproduce the problem without installing the
standardprofile. So I reverted my last commit, restoring the original test provided by @quietone.The test is slow: running locally, about 8s for the inconclusive test and 25s for the one hat installs the
standardprofile. So @Berdir's comment on the MR is valid. We should try not to install thestandardprofile in a test. But that is the best I can do for now.BTW, if you run the "Test-only changes" job in GitLab CI, expect
EntityPermissionsFormTestto fail since the methods mocked in that test have to match the methods called in the code.Comment #60
benjifisherComment #61
berdirLets have a quick look before going to bed, I thought. That test shouldn't be too hard to resolve, I thought.
I added all the obvious things, node type, comment type with a field through the two creation traits, a proper user with the necessary permissions, but still nothing.
After a considerable amount of debugging, I tracked it down to an inconsistency between CommentDefaultFormatter (which defaults to view mode "default"), and addDefaultCommentField(), which defaults to the view mode "full". Combined with the unusual behavior of \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::calculateDependencies() to only add a dependency on the view display if it exists. full didn't exist, so it couldn't load it, didn't add a dependency, then the node.article.default view display didn't depend on that and it didn't need to try and remove it from the dependency chain.
I also added a few additional asserts, but the test is fragile by design and I don't see how we could change that. There is no positive outcome to look for here, the manage permissions tab isn't accessible, nothing must happen, that's the whole point of this issue. I did write it so that it will fail in #3384600: [backport] Don't hide permissions local tasks on bundles when no permissions are defined, so we can extend it a bit there and check the empty message and stuff instead of a 403 on the permission page. I do hope we still agree on doing that, the performance issues are at best partially resolved with this.
Comment #62
benjifisher@Berdir:
Thanks for improving the test. I feel better that you agree it was not easy to do. In addition to being faster than installing the
standardprofile, your version shows that the view mode (default, notfull) is involved.I made some minor changes to the test, including some changes to the comments.
The test passes when I run it locally. If I revert the changes to
EntityPermissionsForm, then it fails as expected:Looking at the version of
/admin/reports/dblogsaved by the test, I see the full text of the warning message in thetitleattribute of the link:Personally, I am in favor of using named parameters, and this is a perfect example of when they are useful:
But I am not sure whether Drupal coding standards allow them. I think @alexpott pointed out that our BC policy allows us to rename parameters, which means we cannot rely on named parameters. On the other hand, this line is in a test, so if the parameter is renamed, the test will fail and be easy to fix.
I cannot set the issue status to RTBC since I worked on this issue, but it looks good to me.
Comment #63
berdir> But I am not sure whether Drupal coding standards allow them. I think @alexpott pointed out that our BC policy allows us to rename parameters, which means we cannot rely on named parameters. On the other hand, this line is in a test, so if the parameter is renamed, the test will fail and be easy to fix.
Yes, I wasn't sure either, but it indeed felt like such a perfect use case for it, we'd need several arguments including long constants otherwise.
Comment #64
bsuttis commentedI also hit this bug after upgrading to 10.3.0 and I found https://www.drupal.org/project/drupal/issues/3384600 to be closely related. I have an Article node type with a Comments field.
I found that the main cause of the "Entity view display 'node.article.default': Component..." log was using
getConfigEntitiesToChangeOnDependencyRemovalinstead offindConfigEntityDependenciesAsEntitiesinEntityPermissionsForm::permissionsByProvider.After applying the MR patch here and running
EntityViewDisplayCommentArticleTestthe test passes locally for me. Reverting the MR patch, the test fails as expected due to the "Entity view display 'node.article.default" log.I also notice odd behaviour depending on the
$comment_view_modeused in the test before the MR patch is applied.- 'default' calls
CommentDefaultFormatter::calculateDependencies()3 times and the "Entity view display 'node.article.default" log occurs (bad)- 'full' calls
CommentDefaultFormatter::calculateDependencies()1 time and the log does not occur (good)Is there some specialness to 'default' that I haven't tracked down yet? The MR patch solves this too.
Comment #65
berdirdefault vs full is explained in #61, CommentDefaultFormatter only adds a dependency if that config exists, otherwise it doesn't. This is inconsistent and weird, likely because of the described discrepancy between the default config and the test trait. But it's mostly a test-only thing, on a real site, you can't chose a view mode/display that doesn't exist as config, because only those are presented as options and it's not in scope of this issue.
Comment #66
benjifisherI did some more investigation.
First of all, I was under the impression that the warning message indicated some sort of problem with the configuration in the
standardprofile, perhaps a circular dependency. As @Berdir said in #41,There is a problem with
CommentTestTrait::addDefaultCommentField(): by default, it uses the view mode'full'without defining it. That is why @Berdir’s test addscomment_view_mode: 'default'.Second, I realized that the warning is bogus.
ConfigManager::getConfigEntitiesToChangeOnDependencyRemoval()has the optional parameter$dry_run, which defaults toTRUE. By default, that method clones the config entities (such ascore.entity_view_display...) so that changes to them are harmless. The cloned entity is passed toConfigManager::callOnDependencyRemoval()and then toEntityDisplayBase::onDependencyRemoval(). But that method does not know that the entity is cloned, so it logs a warning message when disabling a field.Third, I want to update the issue summary, and maybe make some tweaks to the tests, so I am setting the status to NW.
Fourth, I figured out why this issue is more of a problem on 10.3 than on 10.2:
Steps to reproduce
standardprofile.admin_toolbarandadmin_toolbar_toolsmodules./admin/reports/dblogand reload the page a few times.With Drupal 10.2, nothing much happens. You can check that
/admin/structure/comment/manage/comment/permissionsis shown in the admin menu, even though you get a 403 response if you try to visit it.With Drupal 10.3, each time you load the page you get another copy of the warning message described in this issue. The permissions page is not shown in the admin menu.
With some help from
git bisect, I found that the change is caused by #2463753: [regression] Do not bypass route access with 'link to any page' permissions for menu links. I am adding that as a related issue. I confirmed that reverting the commit for that issue makes 10.3.x act like 10.2.x (as described above). There were some conflicts when I reverted the commit, but only in test classes.Comment #67
benjifisherI decided to make some non-test changes as well. The biggest change is to use
findConfigEntityDependencies()instead offindConfigEntityDependenciesAsEntities().I am updating the issue summary. I am removing the line
I tested that, and did not find this problem. As I said in Comment #66, only a clone of the
core.entity_view_displayconfig object is modified.Comment #68
benjifisherI apologize for continuing to tweak, but I think the new test belongs in the
usermodule. There is already a test class that covers per-bundle and per-module permissions forms, so I added it there.Comment #69
bsuttis commentedConfirming @benjifisher's updates to the IS match the bug I encountered after the 10.3.0 upgrade and the latest MR passes testing locally for me.
Thanks for the explanation in #66 too.
Comment #70
adrianm6254 commentedAn FYI, I applied MR8487 to 2 of my sites (so far) and the error is gone.
Thanks!
Comment #71
andreic commentedSame here, after applying the MR patch, the error is gone.
Comment #72
mellowtothemax commentedWorked for me too. Thanks
Comment #73
berdir#66 and later all makes sense to me, the MR looks good to me as well. I wrote most of that test, so I don't think I can RTBC myself, but +1 from me.
Plenty of people confirmed that it fixes their issue, all it takes now is someone confident enough to set it to RTBC ;)
Comment #74
jamesoakleyMeanwhile, while we wait for RTBC, please could someone link to the exact patch that works. I get that we're using a merge record for this, but for all my site deployments I'm simply using cweagans composer patches to apply any patches I need to core or contrib, and I'm not clear reading this history as to what patch I need to add to my composer.json file.
Comment #75
berdirSee https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... and make sure you read those warnings carefully. Do *not* use the URL directly in comnposer patches.
Comment #76
senzaesclusiva commentedSame here on D 10.3.1 just upgraded from 10.2.x
Comment #77
senzaesclusiva commented[SOLVED] Well, i can confirm that this patch 3385600-5.patch seem to solve the issue. No more system message on D 10.3.1, Php 8.3.8 related about Comment module or permissions
Comment #78
catchThis looks like a good fix for the problem. Moving to RTBC - would be good to get this into 11.0.0 as well the next 10..3 patch release.
Comment #79
quietone commentedRegarding the question about named arguments. There is an open issue for that in the coding standards project, #3337834: Standards for PHP named arguments. Core has the following in the BC policy.
Comment #80
catchTrying a re-title.
Comment #85
larowlanCommitted to 11.x and backported to 11.0.x, 10.4.x and 10.3.x
Thanks everyone!