Problem/Motivation
After creating a new content type and adding that content type to twig templates, the page completely crashed for logged out users, but did not give any useful information. Instead the screen displayed:
Error: Maximum function nesting level of 512 reached, aborting! in Drupal/Core/Render/Renderer.php
The problem was discovered to be that the new content type was not added to the anonymous user role permissions.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | afterpatch.png | 827.4 KB | skt-001 |
| #30 | beforepatch.png | 792.93 KB | skt-001 |
| #19 | Screen Shot 2023-02-06 at 4.44.12 PM.png | 46.76 KB | smustgrave |
| #19 | Screen Shot 2023-02-06 at 4.46.18 PM.png | 32.55 KB | smustgrave |
| #17 | add-content-type-reminder-msg-3155953-17.patch | 2.29 KB | joaopauloc.dev |
Issue fork drupal-3155953
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:
- 3155953-add-reminder-message
changes, plain diff MR !3434
Comments
Comment #2
ethomas08 commentedHere is my patch for the reminder message after a user adds a new content type.
Comment #3
ethomas08 commentedPatch file without the word patch at the end of it
Comment #4
cilefen commented@ethomas08
Thank you for this. Translatable string changes are always pushed to minor releases, so I've moved this to 9.1.x.
In my opinion, it would be preferable to fix the root problem:
Drupal could perhaps handle that better. We need a major-priority issue for that. Could you please report that with steps to reproduce, if no such issue exists?
Thank you!
-Chris
Comment #5
ethomas08 commentedHi Chris, thank you so much for your very speedy response time! I was not able to get exact steps to reproduce this error. My team says it is a special case situation, and it would not likely impact many other users.
Comment #6
ethomas08 commentedUploading patch that contains a link to the permissions page, as requested by team members.
Comment #7
ethomas08 commentedRe-rolled patch for 9.1.x branch
Comment #9
abhijith s commentedApplied the patch #7 on 9.2.x and it works fine .But found CS error.
After patch:

Comment #10
abhijith s commentedFixed the CS error in patch #7.Please check it
Comment #15
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
YES!! This feature would be absolutely amazing to have
Patch #10 still applies to D10
Tagging for before/after screenshots to be added to the issue summary (would be a good time to update to regular templates)
This will need test coverage but we should be able to extend existing tests already for when a content type is created, should be a good novice task.
Comment #16
joaopauloc.dev commentedAdding unit tests.
Comment #17
joaopauloc.dev commentedAdding full patch
Comment #18
joaopauloc.dev commentedComment #19
smustgrave commentedWent ahead and added screenshots.
Testing locally on Drupal 10 creating a new content type and seeing the link.
Good job with the test!
Comment #20
quietone commentedReading the Issue Summary I see that the proposed resolution is not following the Drupal user interface text standard, specifically the use of 'please'.
This is changing the UI so needs the usability tag, per the Usability gate. I am adding the tag. Having said I think the text should also be reviewed, adding tag for a usability review.
The issue summary states that this solution is 'for the time-being'. What is the long term solution?
Thank you for having up to date screen shots available in the Issue Summary! That has saved me searching for them.
I looked at the patch as well.
This should be sorted.
Since this is being changed, the message can be removed.
s/@permission/:permission/
That is, according to protected static function FormattableMarkup::placeholderFormat
Finally, un-assigning because that person hasn't worked on this in 3 years.
Comment #21
sourabhjainI am working on #20.
Comment #23
sourabhjainI have fixed the issue mentioned in #20 and created the MR for that. Please review.
Comment #24
smustgrave commentedComment #25
joaopauloc.dev commentedComment #26
smustgrave commentedFrom comment #20
This needs to be addressed for the committers
Comment #27
joaopauloc.dev commentedUpdating issue summary, I couldn't reproduce the crash mentioned, this issue is old and Drupal probably handle this in a best way than when the issue was created.
Comment #28
lauriiiComment #29
skt-001 commentedapplying the patch #17 works as remainder message.
Comment #30
skt-001 commentedComment #31
bnjmnmI think I'm missing something here. If I create a new content type, then create content of that type without making any permission changes, an anonymous user can see that content just fine. There's a 'View published content' permission that if disabled would restrict anonymous access to content overall - there's no Content-Type-Specific setting that requires changing. Either the site lets anonymous users see published content or it doesn't. Perhaps the user that reported this was using the Node View Permissions module?
The permissions system is designed to gracefully block access to something vs. dumping someone into a recursion vortex, so that's a bit confusing too.
Is there a setting/use case I'm missing. I like better info, but I'm concerned this alerting users to a situation that they don't have to attend to.
Comment #32
bnjmnmComment #33
smustgrave commentedThink it's just a helper comment. To remind the developer to set up their permissions. As a developer is building with admin role they may forget to setup the content type for the other roles.
Comment #34
lauriiiTo keep our options open, let's reframe this issue to focus on the problem. I agree that one potential solution is to add a reminder message for users to configure permissions properly, but there could be other solutions to the problem.
To evaluate the alternative solutions, let's take a step back and ask why we need to add this reminder message. It appears that an error occurred because the author did not grant anonymous users access to the content type. It sounds totally reasonable to not configure permissions for a content type after it has been created. This certainly shouldn't result in PHP errors, so we need to investigate further and come up with a solution to that. This way I believe we wouldn't need the message in the first place.
I am keeping this issue as postponed until we have reproducible steps for the bug.
Comment #36
ethomas08 commentedHi everyone, so interesting to see all the comments after I originally created this issue 3 years ago!
I cannot remember the specifics, since I no longer have access to the project. I believe bnjmnm is correct in that there was most likely a contrib module enabled to handle permissions on a more granular level.
It is very possible that this is no longer a bug since Drupal core has progressed from Drupal 8 (at the time of this issue's creation) to Drupal 11.
Comment #37
acbramley commentedClosing as there is nothing in core that would cause this bug after creating a new content type.
Feel free to reopen with clear steps to reproduce, or open a new feature request for the addition of the permissions message.