Trying to access settings page and i keep getting fatal error

TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in implode() (line 56 of /opt/drupal/web/modules/contrib/anonymous_login/src/Form/AnonymousLoginSettings.php).

also no redirection now for anonymous users

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

aya.y created an issue. See original summary.

rajdip_755’s picture

Hi @aya.y, I'm trying to replicate this issue with the 8.2.2 version of this module in a Drupal 10.4 setup but the issue is not replicated.
Can you please mention the module version and the Drupal core versions, that will be helpful for replicating this issue and solve accordingly.

aya.y’s picture

Thank you for your replay , this issue happens after i used composer update and i used the older version 8.x-2.1 and it has configuration already added.

  • Drupal Version is 10.4.0
  • Database Version 10.5.17-12-MariaDB-enterprise-log
  • PHP Version 8.2.22
  • anonymous_login 8.x-2.2

anonymous_login.settings.yml

_core:
  default_config_hash: ZKVq7lpyGFQf-SCuj_Ng2yLPD24rKHxz-TzGQxBjLl4
langcode: ar
paths: "*\r\n~/*/user/reset/*\r\n~/*/shs-term-data/*\r\n~/*/user-confirmation/*\r\n~/*/print/pdf/*\r\n~/print/pdf/*\r\n~/*/user/signin\r\n~/*/user/signup\r\n~/*/cstm_sso/verify\r\n~/cstm_sso/verify\r\n~/openid-connect/sso\r\n~/login/sso\r\n~/*/login/sso\r\n~/login/redirect/sso\r\n~/*/login/redirect/sso"
login_path: /login/sso
message: ''
mullzk’s picture

I can confirm the issue, with drupal 10.4.1 and php 8.3.15

It happens only on Anonymous login 8.x-2.2, reverting to drupal/anonymous_login:2.1.0 solves the issue

We only have one path, so our `anonymous_login.settings.yml` (as exported on anonymous_login:2.1.0, but not changed when updated to 2.2.0) is:

_core:
  default_config_hash: xyz
langcode: de
paths: /somepath/
login_path: /user/login
message: 'A nice message.'

But when I manually change to

paths: 
  - /somepath/
login_path: /user/login

then the issue disappears.

So i guess it's somethin about the config-schema, which does not change to a sequence when coming from an older version, perhaps only on Drupal 10, perhaps only when having a single entry (like me) or a config with windows-style-line-endings (like aya.y)

My workaround: changing the config-file to a sequence

I guess its related to #3495893: Warning: foreach() argument must be of type array|object, string given, which occurs under the same circumstances (2.2.0, but not 2.1.0, paths-config in single line instead of list) and is triggered on the same object.

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

anton4uk’s picture

Status: Active » Needs review

Since 8.x-2.2, paths are stored as a list, but sites can still store them as strings.

MR !26:

  • The settings form and the subscriber accept both formats; a string is split into lines.
  • A new post update converts a stored string to a list.
  • Unit and functional tests; the functional test fails without the fix.

  • anton4uk committed b29ea548 on 8.x-2.x
    Issue #3495568: Handle paths stored as a string
    
anton4uk’s picture

Status: Needs review » Fixed

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.