Problem/Motivation

Protected Pages module crashes in projects using Canvas.

Steps to reproduce

  • versions used here: Drupal core 11.3.8, canvas 1.3.3, protected_pages 8.x-1.9
  • install and enable Protected Pages module in a Drupal project already using Canvas
  • try to add a protected page (-> /admin/config/system/protected_pages/add)
  • results in TypeError

TypeError: Drupal\protected_pages\Form\ProtectedPagesAddForm::__construct(): Argument #4 ($messenger) must be of type Drupal\Core\Messenger\Messenger, Drupal\canvas\Messenger given, called in /var/www/html/web/modules/contrib/protected_pages/src/Form/ProtectedPagesAddForm.php on line 81 in Drupal\protected_pages\Form\ProtectedPagesAddForm->__construct() (line 69 of modules/contrib/protected_pages/src/Form/ProtectedPagesAddForm.php).

Similar problem for Edit, DeleteConfirm and SendEmail functionality.

Proposed resolution

Use Drupal\Core\Messenger\MessengerInterface instead of Drupal\Core\Messenger\Messenger.

Remaining tasks

User interface changes

API changes

Data model changes

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

silke created an issue. See original summary.

revathi.b’s picture

Assigned: Unassigned » revathi.b
revathi.b’s picture

Assigned: revathi.b » Unassigned

I am not able to replicate this issue

cmarrufo made their first commit to this issue’s fork.

cmarrufo’s picture

Assigned: Unassigned » cmarrufo

I'm be able to reproduce the issue, but putting that aside, from an OOP perspective it's better to use interfaces whenever possible, as this helps us avoid hard coupling.

Working in the MR.

cmarrufo’s picture

Status: Active » Needs review

Done.

PD: I also fix a phpcs error in the ProtectedPagesSettingForm class (line 93 double dot on comment).

cmarrufo’s picture

Assigned: cmarrufo » Unassigned
gordonio’s picture

Status: Needs review » Reviewed & tested by the community

The patch looks good to me. I ran into this issue with 11.3.9 and it fixed it just fine.

  • oksana-c committed e747c1f4 on 8.x-1.x authored by cmarrufo
    Issue #3588956: Use MessengerInterface instead of Messenger
    
oksana-c’s picture

Status: Reviewed & tested by the community » Fixed

merged. thank you all.

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.

Status: Fixed » Closed (fixed)

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