After core commit 11.x-dev#7e27c7f can no longer save field definitions

Created on 1 August 2025, 6 months ago

Problem/Motivation

Creating/editing a field and clicking save appears to do nothing. The log contains a php error.

Steps to reproduce

1. Upgrade core to 11.x-dev, up to commit 7e27c7f or later.
2. Create a webform. Add a textfield.
3. Just give it a name and click save.
4. Nothing happens and the log has an error - Error: Call to undefined function Drupal\webform\Hook\_webform_token_render_more() in Drupal\webform\Hook\WebformTokensHooks->tokenInfo() (line 205 of ...\web\modules\contrib\webform\src\Hook\WebformTokensHooks.php).

Proposed resolution

If I add require_once __DIR__ . '/webform.tokens.inc'; near the top of webform.module, it fixes it, but it doesn't feel like the right solution. If somebody understands better what's going on in https://www.drupal.org/project/drupal/issues/3494908 πŸ“Œ [pp-1] Mark several more modules as converted Active maybe they have a better idea of what to do.

My guess is that before that commit, it somehow magically loaded webform.tokens.inc, but since that commit maybe changes how scanning works it now needs to be told about it, probably in the hook implementation somehow?

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

6.3

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @demeritcowboy
  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    I cannot find commit 7e27c7f in the repo. Please check the commit hash.

  • Because of the subtree split, Github commit hashes are different than Gitlab commit hashes.

  • πŸ‡¨πŸ‡¦Canada karing πŸ‡¨πŸ‡¦

    Bisected it down to:

    `COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core:11.x-dev#7e27c7fdd465c62004d2355bcc6a38f52d91b176 drupal/core-dev-pinned:${{ matrix.drupal }}`

    https://github.com/colemanw/webform_civicrm/compare/KarinG-D11-2-2?expand=1

  • πŸ“Œ [pp-1] Mark several more modules as converted Active and this change record β†’ indicate that adding `skip_procedural_hook_scan: false` to the services file is the correct way. Can someone test that and get a merge request started?

  • Thanks I tried it but it makes no difference. Cleared cache too.

    Specifically this change

    index 97fce5da1..a234ca1ee 100644
    --- a/webform.services.yml
    +++ b/webform.services.yml
    @@ -1,3 +1,6 @@
    +parameters:
    +  webform.skip_procedural_hook_scan: false
    +
     services:
    
       # Plugins.

    I get the impression that that parameter is false by default. I'm thinking because the hook HAS been converted to new style, there is some other way you are supposed to tell it about the resources it needs loaded.

    Or would a simpler fix be to just move the "render_more" function somewhere else that is always loaded? Or, since it's only used in two files, move it directly into the hook file?

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Thanks!

    This is because we set system to skip, but system has system_hook_info which needs to still execute.

    πŸ“Œ Remove skip procedural for modules implementing hook_hook_info Active

  • Thanks. I can confirm that core patch fixes it locally and also in the tests mentioned in comment 5.

  • Ok, I am marking this as a pending duplicate but I am leaving it open so we don't forget it.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Yeah this issue is 100% core.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    While I agree that this is a bug in core, webform is still unnecessarily relying on automatic .inc file loading for helper functions called by that hook.

    This is deprecated for removal in D12, while legacy hooks are supported until D13 (and not even formally deprecated yet), so you likely want to keep them around longer to support D10.

    That means eventually, all functions in tokens.inc must move to .module and there is no reason to not do it now. that would fix this particular error but the token system is going to be extremely broken due to all non-converted hooks that are still in tokens.inc, such as the ones in token module.

    So, changing this to a normal task to move that.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    In that case, perhaps the existing proposed resolution is the right solution. That is a smaller change than moving all the functions to the module file.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    I really would recommend moving the functions, it's the expected resolution we planned for in core.

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    This feels like a release blocker. I am tempted to suggest we look for a simple temporary workaround or fix.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    The functions in the tokens.inc files just need to move to .module files

    To be safe we should also move views.inc functions

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    Can we not add a require statement?

  • Merge request !678Move autoloaded tokens files to module β†’ (Open) created by nicxvan
  • Pipeline finished with Canceled
    5 months ago
    Total: 116s
    #577605
  • Pipeline finished with Canceled
    5 months ago
    Total: 79s
    #577606
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Those includes are deprecated in 11.2 anyway so moving them is the right fix.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Failure was:

    Webform Element Address (Drupal\Tests\webform\Functional\Element\WebformElementAddress)
         ✘ Address
           ┐
           β”œ UnexpectedValueException: RecursiveDirectoryIterator::__construct(/builds/issue/webform-3539377/web/sites/simpletest/91902458/files/php/twig/68a5fc15c268d_page-title.html.twig_KxozsPVNro9Qk3xuL_VXDnfQA): Failed to open directory: No such file or directory

    I am rerunning, I'm not sure that is related.

  • Pipeline finished with Success
    5 months ago
    Total: 1112s
    #577607
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    #20 the failure is unrelated and it is a random failure.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Yep, it passed with a rerun!

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    > This feels like a release blocker. I am tempted to suggest we look for a simple temporary workaround or fix.

    It is a release blocker, yes. For Drupal core. This only happens in the core development version that will become 11.3, and the token system is currently very broken there. All token.module tokens simply do not exist.

    Tests pass because they dont run against next minor.

    It will and must be fixed in core. The core issue is RTBC and critical.

    This is a useful change but it's just a D12 preparation task, nothing more.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦
  • πŸ‡¨πŸ‡¦Canada karing πŸ‡¨πŸ‡¦

    Confirming that all is well with Drupal 11.2.* and Webform 6.3.x-dev - we only caught this because one of our iterations in the webform civicrm test matrix is with Drupal 11.x-dev, Webform 6.3.x-dev and CiviCRM dev-master.

  • πŸ‡¨πŸ‡¦Canada karing πŸ‡¨πŸ‡¦
  • Pipeline finished with Success
    5 months ago
    Total: 142s
    #582907
  • Pipeline finished with Success
    5 months ago
    #582911
  • Pipeline finished with Failed
    2 months ago
    Total: 1174s
    #659549
  • Pipeline finished with Failed
    2 months ago
    Total: 1720s
    #659566
  • Pipeline finished with Failed
    2 months ago
    Total: 1161s
    #659587
  • Pipeline finished with Failed
    2 months ago
    Total: 2191s
    #659592
  • Pipeline finished with Failed
    2 months ago
    Total: 3895s
    #660106
  • Pipeline finished with Failed
    2 months ago
    Total: 3036s
    #660291
  • Pipeline finished with Failed
    2 months ago
    Total: 2375s
    #660417
  • Pipeline finished with Failed
    2 months ago
    Total: 1192s
    #660466
  • Pipeline finished with Failed
    2 months ago
    Total: 1386s
    #660485
  • Pipeline finished with Canceled
    2 months ago
    Total: 1945s
    #660526
  • Pipeline finished with Success
    2 months ago
    Total: 2814s
    #660555
  • Pipeline finished with Failed
    2 months ago
    Total: 2270s
    #660760
Production build 0.71.5 2024