Unhandled Warning: Undefined array key "translatable"

Created on 13 May 2024, 6 months ago
Updated 16 June 2024, 5 months ago

Problem/Motivation

When enabling translation with Scheduler enabled, the site may throw an error:

Warning: Undefined array key "translatable" in _scheduler_translation_validate() (line 732 of .../docroot/modules/contrib/scheduler/scheduler.module)

This seems to be due to an assumption that the translatable option will exist when it may not. This seems identical to the issue in πŸ› Unhandled Warning: Undefined array key "translatable" Fixed .

Steps to reproduce

Enable translation on a site with Scheduler already installed:

- Add a new language: /admin/config/regional/language (take FR as example)
- Enable content translation for some content types and check "Show language selector on create and edit pages" on: /admin/config/regional/content-language
- Observe the changes are not saved and there is an error in the log.

Proposed resolution

Check if $options['translatable'] exists before using it.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States froboy Chicago, IL

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

Merge Requests

Comments & Activities

  • Issue created by @froboy
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    237 pass
  • Pipeline finished with Success
    6 months ago
    Total: 615s
    #171761
  • Status changed to Needs review 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States froboy Chicago, IL
  • Status changed to RTBC 6 months ago
  • πŸ‡ΊπŸ‡¦Ukraine podarok Ukraine

    can ne merged/tagged

  • First commit to issue fork.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    237 pass
  • This fix works for me. Thank you. :)

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    JSchref, did you mean to erase the issue summary?

    I need to check the steps to reproduce, and it would be good to have test coverage for this, as clearly there are some incorrect assumptions in the code.

  • Status changed to Needs work 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    I have reverted JSchref erasing of the issue summary.

    I followed the 'steps to reproduce' but could not get the error. Specifically what I did was

    1. Enable Scheduler
    2. Enable "Content Translation" core module
    3. Add a new language via /admin/config/regional/language (Config -> Region and Language -> Language )
    4. Enable a content type for translation content (via Content type -> edit -> language settings -> tick both chekcboxes "Show language selector on create and edit pages" and "enable translation"
    5. Save is OK, no error
    6. Or if you enable you enable translation on admin/config/regional/content-language (Config -> Region and Language -> Content language and translation) - there is still no problem and no error on save

    I am not saying that there is no problem, it is just that there must be something else in your set-up which is causing this error. I need to understand what is causing the problem and replicate it, before committing any fix.

Production build 0.71.5 2024