Problem
An error occurs when accessing any pages beyond page 1 in the admin interface of the Protected Pages module on Drupal 11.
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /app/web/modules/contrib/protected_pages/src/Controller/ProtectedPagesController.php on line 101 in Drupal\Component\Utility\Html::escape() (line 431 of /app/web/core/lib/Drupal/Component/Utility/Html.php).
Steps to reproduce
- Navigate to /admin/config/system/protected-pages.
- If the list spans multiple pages, attempt to go to page 2 or beyond.
The above error is triggered.
Proposed resolution
The controller attempts to pass a null value to Html::escape(), which expects a string.
Data model changes
Comments
Comment #2
chandraraj commentedComment #3
chandraraj commentedComment #4
kalpanajaiswal commentedThis issue does not appear in the Drupal 11 environment.
Comment #5
alexander tallqvist commentedRan into this bug today running Drupal 11.1.8 and Protected Pages 1.8. The patch provided in #2 seems to fix the issue.
Comment #6
saganakat commentedWorks for me patch in comment #2 D11.1 and protected_pages: v1.9.
Comment #8
pfrenssenLet's make a merge request so this can be merged by the maintainers.
Comment #10
pfrenssenAdded the MR, I applied the patch from @chandraraj and fixed an unrelated coding standards error that popped up in the latest version of Coder. Setting back to RTBC because I did not make a change to the fix, just made it available as an MR.
Comment #11
megachrizClosed as duplicates:
#3611623: A null title results in a PHP error
#3590045: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given
Comment #13
oksana-c commentedMerged. Thank you all!
Comment #15
oksana-c commented