Array error when trying to open settings tab for url aliases

Created on 4 August 2023, over 1 year ago
Updated 31 August 2023, about 1 year ago

Automatic URL Aliases have re entry suddenly stopped working correctly. the tile is turned into the url, but without any spaces or hyphens. It used to have a hyphen as separator, and this all worked perfect. It now also doesn't autocreate a url anymore when you have a manually entered one, then switch on auto url.

The problem seems to be that the 'settings' (where separator and punctuation etc is set) cannot be accessed anymore. The log gives this error when trying to enter the settings tab:

TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 153 of /.../.../public_html/modules/contrib/pathauto/src/Form/PathautoSettingsForm.php)

Any help really appreciated, do let me know if you need more info (it's a D9.5.10 site)

💬 Support request
Status

Active

Version

1.11

Component

Code

Created by

🇬🇧United Kingdom xax London, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @xax
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    48 pass
  • 🇮🇳India sidharth_soman Bangalore

    Attaching a fix. Please test.

  • Status changed to Active over 1 year ago
  • 🇬🇧United Kingdom xax London, UK

    Thanks for the suggestion.. Try the fix, still get white screen with 'unexpected error', and log now says:

    TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 256 of /home/eucitize/public_html/modules/contrib/pathauto/src/Form/PathautoSettingsForm.php)

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    48 pass
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India keshavv India

    Save the module's configuration form and try again. I noticed that the module configuration is missing in the system.
    The fix added in #2 patch will not work.

  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update about 1 year ago
    Not currently mergeable.
  • @tyler36 opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update about 1 year ago
    48 pass
  • 🇯🇵Japan tyler36 Osaka

    - Re-wrote patch #2 as MR.
    - Updated to catch missing `safe_tokens`

    Tested on Drupal 10.1.0 with Pathauto 1.11.0

  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany marcoliver Neuss, NRW, Germany

    Tested the feature branch. It does prevent the error from occurring in case the config is initially missing.

    Marking as RTBC.

  • Status changed to Active about 1 year ago
  • 🇬🇧United Kingdom xax London, UK

    thanks @keshavv and @marcoliver, but I'm afraid this is not the solution to my issue?

    I have no files missing, so there's nothing I can save or add.. I've tried to remove the entire pathauto/config folder and to reinstall those files, but it makes no difference at all.

    The entire module works fine, just at the 'settings' tab I get this array error.

    To give a bit more detail: the pathauto module on this site used to work fine until recently. There are patterns for all content types, and these work fine to this day.

    It's just that a little while ago (about a week before I raised this issue) the module stopped replacing spaces with hyphens, so suddenly newly created pages got a alias with everything written together (so /thisisfourwords instead of the desired /this-is-four-words). As the site is live and very active, this is a major problem and not an environment I can just crash at will to find a solution.. On all my other sites, including several with near identical set-ups, the module works fine.

    And further suggestions would be extremely welcome!

Production build 0.71.5 2024