Fatal error: Maximum function nesting level of '200' reached, aborting! in /Users/gordon/Sites/demo8/core/includes/bootstrap.inc on line 2422

I have set up a minumal version of Drupal 8.x, and disabled the node module. I have then attached a comment field to the user.

The comment field displays on the /user/1 without issue, and then I get the above error if I create a comment.

I have my nesting level set to 200, so that should be much more than is required.

Here is the error backtrace.

( ! ) Fatal error: Maximum function nesting level of '200' reached, aborting! in /Users/gordon/Sites/demo8/core/includes/bootstrap.inc on line 2422
Call Stack
# Time Memory Function Location
1 0.0001 641584 {main}( ) ../index.php:0
2 0.0222 1544472 drupal_handle_request( ) ../index.php:15
3 0.2428 13495584 Drupal\Core\DrupalKernel->handle( ) ../bootstrap.inc:1865
4 0.2491 13631856 Drupal\Core\HttpKernel->handle( ) ../DrupalKernel.php:281
5 0.2492 13633032 Symfony\Component\HttpKernel\HttpKernel->handle( ) ../HttpKernel.php:52
6 0.2492 13633032 Symfony\Component\HttpKernel\HttpKernel->handleRaw( ) ../HttpKernel.php:61
7 0.5052 19061736 call_user_func_array ( ) ../HttpKernel.php:117
8 0.5052 19062160 Drupal\Core\Controller\HtmlPageController->content( ) ../HttpKernel.php:117
9 0.8039 23781560 drupal_render_page( ) ../HtmlPageController.php:100
10 0.8473 24456032 drupal_render( ) ../common.inc:3669
11 0.8473 24458264 theme( ) ../common.inc:3855
12 1.0034 26351336 twig_render_template( ) ../theme.inc:1136
13 1.0116 26771584 Twig_Template->render( ) ../twig.engine:54
14 1.0116 26812656 Twig_Template->display( ) ../Template.php:249
15 1.0117 26813088 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
16 1.0117 26813088 __TwigTemplate_115c4c692dbe3fb9d3f96150b63648be->doDisplay( ) ../Template.php:264
17 1.0268 26954680 twig_render_var( ) ../becb348e71f03d45b98c5beca0168a5d592664651241f4db07102aff827b74b5.php:272
18 1.0268 26954680 render( ) ../twig.engine:130
19 1.0268 26954824 drupal_render( ) ../common.inc:3989
20 1.0268 26956592 drupal_render( ) ../common.inc:3868
21 1.0282 26958736 theme( ) ../common.inc:3855
22 1.0292 26971072 twig_render_template( ) ../theme.inc:1136
23 1.0323 27011984 Twig_Template->render( ) ../twig.engine:54
24 1.0323 27053680 Twig_Template->display( ) ../Template.php:249
25 1.0323 27053896 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
26 1.0323 27053896 __TwigTemplate_feb088292fb80b7a159db4877ecff3ec->doDisplay( ) ../Template.php:264
27 1.0325 27059088 twig_render_var( ) ../ea86bba60799fe2c003b553245b6fffcf34795f1ef4729d3d5cbf29fd3b68837.php:27
28 1.0325 27059088 render( ) ../twig.engine:130
29 1.0325 27059232 drupal_render( ) ../common.inc:3989
30 1.0326 27062096 drupal_render( ) ../common.inc:3868
31 1.0327 27064936 theme( ) ../common.inc:3855
32 1.0333 27076104 theme_field( ) ../theme.inc:1070
33 1.0333 27077088 drupal_render( ) ../field.module:775
34 1.0333 27078688 theme( ) ../common.inc:3855
35 1.0339 27087240 twig_render_template( ) ../theme.inc:1136
36 1.0378 27144832 Twig_Template->render( ) ../twig.engine:54
37 1.0379 27186000 Twig_Template->display( ) ../Template.php:249
38 1.0379 27186216 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
39 1.0379 27186216 __TwigTemplate_dcc4d6a42609a04c8bc42f166e120ac4->doDisplay( ) ../Template.php:264
40 1.0386 27208960 twig_render_var( ) ../5b9744e731661bee9b67b7867a5de866ce73b242447652ff3a19d9d5c3179749.php:45
41 1.0386 27208960 render( ) ../twig.engine:130
42 1.0386 27209104 drupal_render( ) ../common.inc:3989
43 1.0387 27211128 drupal_render( ) ../common.inc:3868
44 1.0388 27213528 theme( ) ../common.inc:3855
45 1.0866 27557672 twig_render_template( ) ../theme.inc:1136
46 1.0921 27640056 Twig_Template->render( ) ../twig.engine:54
47 1.0921 27681224 Twig_Template->display( ) ../Template.php:249
48 1.0921 27681440 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
49 1.0922 27681440 __TwigTemplate_f50e4632d33c43dca1e7ababe980137d->doDisplay( ) ../Template.php:264
50 1.0925 27690064 twig_render_var( ) ../9f5a4cb771417edcc37c8c7c329b8dcac7b4c3b709eb85ee37c67cde951e5710.php:29
51 1.0926 27690064 render( ) ../twig.engine:130
52 1.0926 27690208 drupal_render( ) ../common.inc:3989
53 1.0939 27692352 theme( ) ../common.inc:3855
54 1.0944 27699528 twig_render_template( ) ../theme.inc:1136
55 1.0945 27702440 Twig_Template->render( ) ../twig.engine:54
56 1.0946 27743608 Twig_Template->display( ) ../Template.php:249
57 1.0946 27743824 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
58 1.0946 27743824 __TwigTemplate_feb088292fb80b7a159db4877ecff3ec->doDisplay( ) ../Template.php:264
59 1.0947 27747528 twig_render_var( ) ../ea86bba60799fe2c003b553245b6fffcf34795f1ef4729d3d5cbf29fd3b68837.php:27
60 1.0947 27747528 render( ) ../twig.engine:130
61 1.0947 27747672 drupal_render( ) ../common.inc:3989
62 1.0948 27750536 drupal_render( ) ../common.inc:3868
63 1.0949 27753376 theme( ) ../common.inc:3855
64 1.0952 27762936 theme_field( ) ../theme.inc:1070
65 1.0952 27763920 drupal_render( ) ../field.module:775
66 1.0953 27765520 theme( ) ../common.inc:3855
67 1.0956 27772936 twig_render_template( ) ../theme.inc:1136
68 1.0956 27776040 Twig_Template->render( ) ../twig.engine:54
69 1.0956 27817208 Twig_Template->display( ) ../Template.php:249
70 1.0956 27817424 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
71 1.0956 27817424 __TwigTemplate_dcc4d6a42609a04c8bc42f166e120ac4->doDisplay( ) ../Template.php:264
72 1.0959 27821720 twig_render_var( ) ../5b9744e731661bee9b67b7867a5de866ce73b242447652ff3a19d9d5c3179749.php:45
73 1.0959 27821720 render( ) ../twig.engine:130
74 1.0960 27821864 drupal_render( ) ../common.inc:3989
75 1.0960 27823888 drupal_render( ) ../common.inc:3868
76 1.0961 27826288 theme( ) ../common.inc:3855
77 1.1371 28114136 twig_render_template( ) ../theme.inc:1136
78 1.1371 28119232 Twig_Template->render( ) ../twig.engine:54
79 1.1372 28160400 Twig_Template->display( ) ../Template.php:249
80 1.1372 28160616 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
81 1.1372 28160616 __TwigTemplate_f50e4632d33c43dca1e7ababe980137d->doDisplay( ) ../Template.php:264
82 1.1374 28167744 twig_render_var( ) ../9f5a4cb771417edcc37c8c7c329b8dcac7b4c3b709eb85ee37c67cde951e5710.php:29
83 1.1374 28167744 render( ) ../twig.engine:130
84 1.1374 28167888 drupal_render( ) ../common.inc:3989
85 1.1383 28170032 theme( ) ../common.inc:3855
86 1.1387 28177208 twig_render_template( ) ../theme.inc:1136
87 1.1388 28180120 Twig_Template->render( ) ../twig.engine:54
88 1.1388 28221288 Twig_Template->display( ) ../Template.php:249
89 1.1388 28221504 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
90 1.1388 28221504 __TwigTemplate_feb088292fb80b7a159db4877ecff3ec->doDisplay( ) ../Template.php:264
91 1.1389 28225208 twig_render_var( ) ../ea86bba60799fe2c003b553245b6fffcf34795f1ef4729d3d5cbf29fd3b68837.php:27
92 1.1389 28225208 render( ) ../twig.engine:130
93 1.1389 28225352 drupal_render( ) ../common.inc:3989
94 1.1389 28228216 drupal_render( ) ../common.inc:3868
95 1.1390 28231056 theme( ) ../common.inc:3855
96 1.1393 28240616 theme_field( ) ../theme.inc:1070
97 1.1394 28241600 drupal_render( ) ../field.module:775
98 1.1394 28243200 theme( ) ../common.inc:3855
99 1.1396 28250616 twig_render_template( ) ../theme.inc:1136
100 1.1397 28253720 Twig_Template->render( ) ../twig.engine:54
101 1.1398 28294888 Twig_Template->display( ) ../Template.php:249
102 1.1398 28295104 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
103 1.1398 28295104 __TwigTemplate_dcc4d6a42609a04c8bc42f166e120ac4->doDisplay( ) ../Template.php:264
104 1.1401 28299400 twig_render_var( ) ../5b9744e731661bee9b67b7867a5de866ce73b242447652ff3a19d9d5c3179749.php:45
105 1.1401 28299400 render( ) ../twig.engine:130
106 1.1401 28299544 drupal_render( ) ../common.inc:3989
107 1.1401 28301568 drupal_render( ) ../common.inc:3868
108 1.1402 28303968 theme( ) ../common.inc:3855
109 1.1822 28591816 twig_render_template( ) ../theme.inc:1136
110 1.1822 28596912 Twig_Template->render( ) ../twig.engine:54
111 1.1823 28638080 Twig_Template->display( ) ../Template.php:249
112 1.1823 28638296 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
113 1.1823 28638296 __TwigTemplate_f50e4632d33c43dca1e7ababe980137d->doDisplay( ) ../Template.php:264
114 1.1825 28645424 twig_render_var( ) ../9f5a4cb771417edcc37c8c7c329b8dcac7b4c3b709eb85ee37c67cde951e5710.php:29
115 1.1825 28645424 render( ) ../twig.engine:130
116 1.1825 28645568 drupal_render( ) ../common.inc:3989
117 1.1835 28647712 theme( ) ../common.inc:3855
118 1.1839 28654888 twig_render_template( ) ../theme.inc:1136
119 1.1839 28657800 Twig_Template->render( ) ../twig.engine:54
120 1.1840 28698968 Twig_Template->display( ) ../Template.php:249
121 1.1840 28699184 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
122 1.1840 28699184 __TwigTemplate_feb088292fb80b7a159db4877ecff3ec->doDisplay( ) ../Template.php:264
123 1.1841 28702888 twig_render_var( ) ../ea86bba60799fe2c003b553245b6fffcf34795f1ef4729d3d5cbf29fd3b68837.php:27
124 1.1841 28702888 render( ) ../twig.engine:130
125 1.1841 28703032 drupal_render( ) ../common.inc:3989
126 1.1841 28705896 drupal_render( ) ../common.inc:3868
127 1.1842 28708736 theme( ) ../common.inc:3855
128 1.1845 28718296 theme_field( ) ../theme.inc:1070
129 1.1845 28719280 drupal_render( ) ../field.module:775
130 1.1845 28720880 theme( ) ../common.inc:3855
131 1.1848 28728296 twig_render_template( ) ../theme.inc:1136
132 1.1849 28731400 Twig_Template->render( ) ../twig.engine:54
133 1.1849 28772568 Twig_Template->display( ) ../Template.php:249
134 1.1849 28772784 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
135 1.1849 28772784 __TwigTemplate_dcc4d6a42609a04c8bc42f166e120ac4->doDisplay( ) ../Template.php:264
136 1.1852 28777080 twig_render_var( ) ../5b9744e731661bee9b67b7867a5de866ce73b242447652ff3a19d9d5c3179749.php:45
137 1.1852 28777080 render( ) ../twig.engine:130
138 1.1852 28777224 drupal_render( ) ../common.inc:3989
139 1.1852 28779248 drupal_render( ) ../common.inc:3868
140 1.1853 28781648 theme( ) ../common.inc:3855
141 1.2262 29069496 twig_render_template( ) ../theme.inc:1136
142 1.2263 29074592 Twig_Template->render( ) ../twig.engine:54
143 1.2263 29115760 Twig_Template->display( ) ../Template.php:249
144 1.2263 29115976 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
145 1.2263 29115976 __TwigTemplate_f50e4632d33c43dca1e7ababe980137d->doDisplay( ) ../Template.php:264
146 1.2265 29123104 twig_render_var( ) ../9f5a4cb771417edcc37c8c7c329b8dcac7b4c3b709eb85ee37c67cde951e5710.php:29
147 1.2265 29123104 render( ) ../twig.engine:130
148 1.2265 29123248 drupal_render( ) ../common.inc:3989
149 1.2275 29125392 theme( ) ../common.inc:3855
150 1.2279 29132568 twig_render_template( ) ../theme.inc:1136
151 1.2280 29135480 Twig_Template->render( ) ../twig.engine:54
152 1.2280 29176648 Twig_Template->display( ) ../Template.php:249
153 1.2280 29176864 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
154 1.2280 29176864 __TwigTemplate_feb088292fb80b7a159db4877ecff3ec->doDisplay( ) ../Template.php:264
155 1.2281 29180568 twig_render_var( ) ../ea86bba60799fe2c003b553245b6fffcf34795f1ef4729d3d5cbf29fd3b68837.php:27
156 1.2281 29180568 render( ) ../twig.engine:130
157 1.2281 29180712 drupal_render( ) ../common.inc:3989
158 1.2281 29183576 drupal_render( ) ../common.inc:3868
159 1.2282 29186416 theme( ) ../common.inc:3855
160 1.2285 29195976 theme_field( ) ../theme.inc:1070
161 1.2285 29196960 drupal_render( ) ../field.module:775
162 1.2286 29198560 theme( ) ../common.inc:3855
163 1.2288 29205976 twig_render_template( ) ../theme.inc:1136
164 1.2289 29209080 Twig_Template->render( ) ../twig.engine:54
165 1.2289 29250248 Twig_Template->display( ) ../Template.php:249
166 1.2289 29250464 Twig_Template->displayWithErrorHandling( ) ../Template.php:238
167 1.2289 29250464 __TwigTemplate_dcc4d6a42609a04c8bc42f166e120ac4->doDisplay( ) ../Template.php:264
168 1.2292 29254760 twig_render_var( ) ../5b9744e731661bee9b67b7867a5de866ce73b242447652ff3a19d9d5c3179749.php:45
169 1.2292 29254760 render( ) ../twig.engine:130
170 1.2292 29254904 drupal_render( ) ../common.inc:3989
171 1.2292 29256928 drupal_render( ) ../common.inc:3868
172 1.2293 29259328 theme( ) ../common.inc:3855
173 1.2295 29263088 template_preprocess_comment( ) ../theme.inc:1061
174 1.2316 29263536 user_view( ) ../comment.module:1489
175 1.2316 29263584 entity_view( ) ../user.module:1376
176 1.2316 29263632 Drupal\Core\Entity\EntityRenderController->view( ) ../entity.inc:592
177 1.2316 29263936 Drupal\Core\Entity\EntityRenderController->viewMultiple( ) ../EntityRenderController.php:154
178 1.2331 29268224 Drupal\Core\Entity\EntityRenderController->buildContent( ) ../EntityRenderController.php:197
179 1.2338 29272992 field_attach_view( ) ../EntityRenderController.php:88
180 1.2339 29274776 field_invoke_method( ) ../field.deprecated.inc:767
181 1.2340 29276672 Drupal\field\Plugin\Type\Formatter\FormatterBase->view( ) ../field.attach.inc:126
182 1.2341 29276888 Drupal\comment\Plugin\field\formatter\CommentDefaultFormatter->viewElements( ) ../FormatterBase.php:78
183 1.2413 29294312 comment_add( ) ../CommentDefaultFormatter.php:141
184 1.2480 29362632 Drupal\Core\Entity\EntityManager->getForm( ) ../comment.module:635
185 1.2481 29363944 drupal_build_form( ) ../EntityManager.php:387
186 1.2481 29366688 drupal_retrieve_form( ) ../form.inc:397
187 1.2482 29892536 call_user_func_array ( ) ../form.inc:882
188 1.2482 29892960 Drupal\Core\Entity\EntityFormController->buildForm( ) ../form.inc:882
189 1.2483 29892960 Drupal\Core\Entity\ContentEntityFormController->init( ) ../EntityFormController.php:95
190 1.2483 29894528 Drupal\Core\Entity\ContentEntityFormController->getTranslatedEntity( ) ../ContentEntityFormController.php:76
191 1.2483 29894528 Drupal\Core\Entity\ContentEntityFormController->getFormLangcode( ) ../ContentEntityFormController.php:87
192 1.2483 29894528 Drupal\Core\Entity\ContentEntityBase->getTranslationLanguages( ) ../ContentEntityFormController.php:105
193 1.2483 29894792 Drupal\Core\Entity\ContentEntityBase->getDefaultLanguage( ) ../ContentEntityBase.php:743
194 1.2483 29895168 Drupal\Core\Entity\Field\FieldItemList->__isset( ) ../ContentEntityBase.php:542
195 1.2483 29895168 Drupal\Core\Entity\Field\FieldItemBase->__isset( ) ../FieldItemList.php:187
196 1.2483 29895168 Drupal\Core\TypedData\DataReferenceBase->getValue( ) ../FieldItemBase.php:162
197 1.2484 29895168 Drupal\Core\TypedData\Plugin\DataType\Language->getValue( ) ../DataReferenceBase.php:38
198 1.2484 29895168 language_load( ) ../Language.php:49
199 1.2484 29895216 language_list( ) ../bootstrap.inc:2523

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

As you see, the pattern of function calls don't repeat on 200, so you might have to increase the limit.

gordon’s picture

I already have my nesting limit set to 200, by default this is set to 100 when XDebug installed. Drupal should not need you to set this limit to 200, it should work ok at 100.

dawehner’s picture

It is a clear sign that the page render array is a bad idea.

gordon’s picture

Actually I have done some more digging and it is not the render array.

Basically what happens is that when you add the comment field on the user it creates an infinite loop on the following templates:-

user.html.twig
comment.html.twig
comment-wrapper.twig

I have taken a look at the templates and I can't quite see it. I have followed it and it seems to be in the comment rendering, as I get above the error message the following.

Primary tabs

View(active tab)
Edit

Comments
Comments
Comments
Comments
Comments

which is comming from the comment-wrapper.html.twig template.

larowlan’s picture

bah we had a test for this and it got changed to use entity_test.

larowlan’s picture

Firstly, how did you disable the node module? Did you create a new profile?

So the issue here is that template_preprocess_comment calls user_view($account, 'compact');
for the user who created the comment (in order to render their user picture).
By default the 'compact' view mode for the user entity is not any different to the 'default'.
If you head to 'manage display' and choose 'compact' in the 'custom formatter settings' and then view the 'compact' display mode - you can see it is set to show user comments.
So if you then hide the comments on the compact view mode, all is well again.

The reason this doesn't happen in standard is that standard_install() calls user_install_picture_field() which sets up the compact entity display mode. So if you're making your own profile, I suggest either adding user_install_picture_field() to it's hook_install or ensuring that the compact view mode is created (borrow the salient bits from user_install_picture_field()).

There is an issue to move the user picture fields to config #2124619: Stop creating user_picture field programatically, which would hopefully resolve this - will mark this as closed (works as designed) and crosslink that to this.

gordon’s picture

Firstly, how did you disable the node module? Did you create a new profile?

Basically I installed the minimal profile, and then I was able to uninstall the node module.

From my investigation I found that I may need the compact mode, but I was unable to change the configuartion. I was able to do this today.

I know that you have said that it works as designed, but the compact mode is not enabled by default, and if the comment is added it will cause an infinite loop which will cause some issues.

I think the resolution here is that we need to add some checks in to make sure that we are not embedding a comment form in a comment.

It is not very nice that you can crash the system in about 30 seconds of setting up a brand new system.

Thanks
Gordon.

alexpott’s picture

Status: Closed (works as designed) » Needs work

I don't think there use be a dependency on the standard profile configuration in the comment module. Somehow comment needs to protect itself from this occurring. I don't think it is enough to move entity.display.user.user.compact.yml to the user module as people can delete this or add the comment field to be display on it and cause the issue again.

larowlan’s picture

star-szr’s picture

Possibly related, but it sounds like this is more legitimate…

andypost’s picture

Is this still an issue? we need to add this to requirements

larowlan’s picture

Yes this is still an issue, comment needs a new user but mode for user pictures that always exists and doesn't contain the comment field. When we render user pictures, we use compact view nice, but if that doesn't exist it falls back to default. The compact view mode is part of standard I think.

jhedstrom’s picture

The latest xdebug has a default of 256 for maximum nesting. I haven't seen this error since upping the limit to 256, whereas I would frequently see this with a setting of 100 or even 200.

andypost’s picture

so maybe just ship special compact view mode or use more twig to render picture?
I find strange that comment module depends on a field that shipped with install profile

larowlan’s picture

Assigned: Unassigned » larowlan
larowlan’s picture

Status: Needs work » Needs review
FileSize
6.29 KB

failing test

larowlan’s picture

larowlan’s picture

Assigned: larowlan » Unassigned

The last submitted patch, 17: comment-nesting-user-2114887.fail_.patch, failed testing.

The last submitted patch, 17: comment-nesting-user-2114887.fail_.patch, failed testing.

jibran’s picture

+++ b/core/modules/comment/src/Tests/CommentUserTest.php
@@ -0,0 +1,89 @@
+class CommentUserTest extends WebTestBase {

Do you think we can use it BTB here?

larowlan’s picture

We are using ->config and ->drupalPlaceBlock which don't exist in BTB yet

larowlan’s picture

Title: Maximum nesting level when attaching comment file to User. » Maximum nesting level when attaching comment field to User.
jibran’s picture

larowlan’s picture

Move to BTB.

We don't need the trait, because we can't use the field trait because it is wired to WebTestBase and we only need to place the block so its breadcrumb passes.

So here it is with BTB.

larowlan’s picture

should probably add these too

The last submitted patch, 26: comment-nesting-user-2114887.26.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 27: comment-nesting-user-2114887.27.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
FileSize
1.89 KB
9.14 KB

Status: Needs review » Needs work

The last submitted patch, 30: comment-nesting-user-2114887.30.patch, failed testing.

The last submitted patch, 30: comment-nesting-user-2114887.30.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
FileSize
911 bytes
9.14 KB
larowlan’s picture

Ci is green, waiting for pifr

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Looks perfect now.

+++ b/core/modules/simpletest/src/BrowserTestBase.php
@@ -234,7 +241,7 @@ protected function setUp() {
-    $path = isset($parsed_url['path']) ? rtrim(rtrim($parsed_url['path']), '/') : '';
+    $path = $this->basePath = isset($parsed_url['path']) ? rtrim(rtrim($parsed_url['path']), '/') : '';

This is why I asked for BTB. :)

alexpott’s picture

  1. +++ b/core/modules/comment/comment.module
    @@ -179,6 +179,12 @@ function comment_field_storage_config_insert(FieldStorageConfigInterface $field_
    +    if ($entity_type_id === 'user') {
    +      // Make sure that we don't enable the comment field formatter by default
    +      // on the compact view mode, as this can lead to recursion.
    +      $display = entity_get_display('user', 'user', 'compact');
    +      $display->removeComponent($field_storage->getName())->save();
    +    }
    

    Are we sure this is not a more generic issue. This is happening because by default when you add a field it is added to all view modes - maybe views modes should be able to opt out from this behaviour?

  2. +++ b/core/modules/comment/comment.module
    @@ -179,6 +179,12 @@ function comment_field_storage_config_insert(FieldStorageConfigInterface $field_
    +      $display = entity_get_display('user', 'user', 'compact');
    

    entity_get_display() is deprecated - let's not add usages.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Berdir’s picture

alexpott is probably going to write a comment too, but we just discussed this a bit here.

The fix isn't really fixing anything and the comment there is very confusing and isn't doing what it says at all. What it *does* is, by loading and saving the compact *display*, is automatically creating it without any configuration. It's not removing anything ever, because we do not ever add any fields automatically to displays other than the default.

See also #2551959: Hardcoded usage of compact view mode in template_preprocess_node() and template_preprocess_comment() is problematic which would probably fix this in a better way, by not using the compact view mode if it doesn't exist (assuming we implement my suggestion). It would however be still possible to manually configure your site to break, which this patch doesn't fix either.

While testing this, I also noticed that the recursion prevention in the entity reference entity formatter is broken because of lazy rendering.. we no longer render within the formatter, we do later, so the count never goes above 1.

larowlan’s picture

jibran’s picture

andypost’s picture

Any reason to postpone on issue that inaccessible?
Comments on users should be prevented from recursion

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

larowlan’s picture

Status: Needs review » Needs work

NW for #36

Couldn't see why the other issue was unpublished, so published it

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.