Problem/Motivation

Modules that use the getCountNewComments function (for example, Forum) give an error

TypeError: trigger_error(): Argument #2 ($error_level) must be of type int, string given in trigger_error()

Steps to reproduce

Install Forum (for example), navigate to default forum (general discussion). See WSOD.

Proposed resolution

Fix $error_level type from string to int

Issue fork drupal-3563876

Command icon 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:

Comments

ivnish created an issue. See original summary.

ivnish’s picture

Assigned: ivnish » Unassigned
Status: Active » Needs review
ivnish’s picture

Also link in trigger is broken. I can fix it here or create a new issue

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Nice find! Searched for other mistakes but this appears to be the only one.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks! Let's open a separate issue for the link.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • catch committed 6a164398 on 11.3.x
    fix: #3563876 TypeError: trigger_error(): Argument #2 () must be of type...

  • catch committed 1982e851 on 11.x
    fix: #3563876 TypeError: trigger_error(): Argument #2 () must be of type...
mstrelan’s picture

Fwiw this would also have been fixed in #3557514: Fix "expects int, string given" issues detected by phpstan. The phpstan param in that issue/meta is what we need in order to detect these in advance, and would be the best way to find others.

Status: Fixed » Closed (fixed)

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