Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig debug command is becoming flaky, sometimes somehow inoperable, or is misleading? #6055

Open
mlncn opened this issue Jul 2, 2024 · 6 comments

Comments

@mlncn
Copy link

mlncn commented Jul 2, 2024

Describe the bug

Twig debug output should start showing when Drush's twig:debug command is run.

To Reproduce
What did you do?

Ran drush twig:debug on and twig debug output did not come on.

Tried turning it on and off, removing and adding services.yml files, and pretty much everything to no avail— except looking in Drupal's UI, where turning twig debugging on at /admin/config/development/settings worked fine.

Expected behavior

Pretty much no matter what other settings are in place, running drush twig:debug on should begin showing twig template information in HTML comments— or at least indicate an error of why it cannot.

Actual behavior

Nothing but a message " [OK] Enabled twig debug. " which was not actually true.

Workaround

Go to /admin/config/development/settings and enable "Twig development mode" and inside that "Twig debug mode" and "Disable Twig cache".

Twig debugging / caching settings added to administrative user interface | Drupal.org

System Configuration

Q A
Drush version? 13.x/12.x/11.x/10.x/8.x (please be specific, and try latest release)
Drupal version? 10.3.0
PHP version 8.1
OS? Debian trixie running DDEV 1.23.2

Additional information

This site installs from config, in case that could be a factor somehow.

@gitressa
Copy link
Contributor

gitressa commented Jul 24, 2024

I am also seeing this. These Drush commands used to allow enabling and disabling Twig debugging, but now do nothing:

It can also be activated/deactivated with Drush:

drush state:set twig_debug 1 --input-format=integer && \
drush state:set twig_cache_disable 1 --input-format=integer && \
drush state:set disable_rendered_output_cache_bins 1 --input-format=integer && \
drush cache:rebuild

To disable debug mode in Drupal 10:

drush state:set twig_debug 0 --input-format=integer && \
drush state:set twig_cache_disable 0 --input-format=integer && \
drush state:set disable_rendered_output_cache_bins 0 --input-format=integer && \
drush cache:rebuild

From Disabling and debugging caching > Enabling Twig debugging via Drush.

I need to activate it via GUI at /admin/config/development/settings.

System Configuration

Q A
Drush version 12.5.2.0
Drupal version 10.3.1
PHP version 8.2.20
OS Debian 12 with DDEV 1.23.3

@occupant
Copy link

Same issue as gitressa, mlncn. The Drush commands to enable / disable twig debug are not working, either when using:

drush state:set twig_debug 0 --input-format=integer && \
drush state:set twig_cache_disable 0 --input-format=integer && \
drush state:set disable_rendered_output_cache_bins 0 --input-format=integer && \
drush cache:rebuild

or

drush twig:debug off

Disabling / enabling via the UI does work (/admin/config/development/settings).

System Configuration

Q A
Drush version 12.5.3.0
Drupal version 10.3.3
PHP version 8.3.11

@hudri
Copy link

hudri commented Oct 3, 2024

This commands no longer works for Drupal v10.3 and above. In version 10.3, the storage for these settings was changed from state to keyValue.

see https://www.drupal.org/project/drupal/issues/3437162 and https://www.drupal.org/node/3438802

@hudri
Copy link

hudri commented Oct 3, 2024

You can set it with eval in v10.3 above, see https://drupal.stackexchange.com/a/316894/72678

@gitressa
Copy link
Contributor

gitressa commented Oct 3, 2024

Thanks for clearing this up @hudri, I guess these files needs a PR then (maybe more?) for drush twig:debug on to work again:

@gitressa
Copy link
Contributor

gitressa commented Oct 3, 2024

I updated the documentation at https://www.drupal.org/docs/develop/development-tools/disabling-and-debugging-caching. Thanks again @hudri!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants