Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updating Core to 8.6.11 is breaking devel_breakpoint().
There I am getting the following error:
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Twig\Node\Expression\ArrayExpression::addElement() must be an instance of Twig\Node\Expression\AbstractExpression, instance of Twig\Node\CheckToStringNode given
Seems to be a follow up after the changes in core/lib/Drupal/Core/Template/TwigNodeTrans.php
(As a temporary workaround: drupal/twig_xdebug module is only partially working - $argument output is missing)
Comment | File | Size | Author |
---|---|---|---|
#26 | interdiff.3040310.16-26.txt | 784 bytes | mikelutz |
#26 | 3040310-26.devel_.develbreakpoint-and-kint-are-broken-with-twigtwig--1384.patch | 539 bytes | mikelutz |
| |||
#19 | twig_breaks_kint_3040310-19.patch | 245 bytes | Spokje |
Comments
Comment #2
pcambraComment #3
scott_euser CreditAttribution: scott_euser as a volunteer and at Soapbox Communications Ltd commentedI can also reproduce this with the following code using kint, wondering if we should expand the title as likely the same underlying issue:
Drop this in `node.html.twig` for instance.
Same issue occurs in 8.6.12
Comment #4
ErwanMaire CreditAttribution: ErwanMaire commentedSame issue for me after a migration from 8.6.10 to 8.6.12
Comment #5
kalmanos CreditAttribution: kalmanos commentedhas anyone found a fix or a workaround or vardumper() till the end of time? :D
Comment #6
heyehren CreditAttribution: heyehren as a volunteer commentedSame issue here after update from 8.6.5 to 8.6.12.
Comment #7
ErwanMaire CreditAttribution: ErwanMaire commentedComment #8
joville CreditAttribution: joville commentedComment #9
PCate CreditAttribution: PCate as a volunteer commentedSame issue after updating to 8.6.12.
Comment #10
vjkaran CreditAttribution: vjkaran commentedThe same issue after updating to 8.6.12
Comment #11
afeijoSame here with 8.6.12
I started to read the twig module code, but its quite complex and many files involved. I doubt I will figure this out :)
Comment #12
scott_euser CreditAttribution: scott_euser as a volunteer and at Soapbox Communications Ltd commentedThe issue is here in Twig:
In vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php there is:
Both NameExpression and GetAttrExpression extend AbstractExpression.
CheckToStringNode does not extend AbstractExpression.
A solution would be to update Twig like so (which solves the problem):
I am not confident that this is a Twig is or whether it is our Drupal implementation of Twig.
Comment #13
scott_euser CreditAttribution: scott_euser as a volunteer and at Soapbox Communications Ltd commentedI have created an issue in github for Twig, hoping someone can shed some light whether patching Twig is the solution or whether this is our implementation of Twig in Drupal.
Github issue:
https://github.com/twigphp/Twig/issues/2908
Comment #14
afeijoYour suggested change didn't work for me, there is no Twig\Node\Node\AbstractExpression
but there is Twig\Node\Expression\AbstractExpression
With that, another error pops up:
Error: Class 'Twig\Node\Node' not found in include() (line 22 of twig/twig/src/Node/Expression/AbstractExpression.php).
Comment #15
ryrye CreditAttribution: ryrye as a volunteer and commentedThis is still broken in D8.6.13
Comment #16
scott_euser CreditAttribution: scott_euser as a volunteer and at Soapbox Communications Ltd commentedFix now committed to Twig itself:
https://github.com/twigphp/Twig/issues/2908
On next release of Twig, composer update will fix this.
Comment #17
carsonwThe next release of Twig is now ready: https://github.com/twigphp/Twig/releases/tag/v2.7.4
Comment #18
moshe weitzman CreditAttribution: moshe weitzman commentedNice work. I'd consider a patch which adds a conflict statement to our composer.json so we discourage use of bad twig versions.
Comment #19
SpokjeThanks @scott_euser for the hard work.
Comment #20
SpokjeHmm, this is beyond my Testbot knowledge level.
As a workaround:
For me
{{ kint(some_var) }}
in the example at #3 works after I've did acomposer update twig/twig
which got package `twig/twig` up to version 1.38.4Comment #21
SushiKong CreditAttribution: SushiKong commentedI used just
{{ kint() }}
works fine.Comment #22
moshe weitzman CreditAttribution: moshe weitzman commentedSomeone needs to make an issue to update twig in drupal core. until then, this issue remains a problem and is breaking devel's automated tests.
Comment #23
moshe weitzman CreditAttribution: moshe weitzman commentedComment #24
scott_euser CreditAttribution: scott_euser as a volunteer and at Soapbox Communications Ltd commentedWith
"twig/twig": "^1.38.2",
doesn't it allow 1.38.4 given the ^?https://cgit.drupalcode.org/drupal/tree/core/composer.json?h=8.6.x#n35
Comment #25
Spokje@scott_euser Not in Testbot-land by the looks of it, haven't got around to test it in a real-live scenario.
But since Testbot doesn't allow 1.38.4, the tests for this module will still be broken, so the patch won't help with that.
Comment #26
mikelutzFor the record, Testbot does what WE tell it to do, not what core tells it to do... :-p
Comment #27
Spokje@mikelutz: You, kind Sir, are a gentleman and a scholar.
Nifty trick!
Comment #28
moshe weitzman CreditAttribution: moshe weitzman commentedOK, that gets our tests to green. But it doesn't help real users who face this error.
The documented way to install Drupal now is to use drupal-project and that requires
webflo/drupal-core-require-dev
. That project forces folks to use 1.38.2, and thats why I suggested that the only way to fix this issue for users to is to upgrade twig in core.Comment #30
moshe weitzman CreditAttribution: moshe weitzman commentedI merged latest patch to get our tests green. Keeping this open for better visibility.
Comment #31
wrg20 CreditAttribution: wrg20 commented+1 following
Comment #32
vacho CreditAttribution: vacho at Skilld commentedHi!!
Why you use www-data user?
Not all SO use this for Apache, and not all use apache.
Comment #33
moshe weitzman CreditAttribution: moshe weitzman commentedCore now requires Twig 1.42.3.
Comment #34
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFor reference, the twig update has now been removed from the 8.x-3.x branch
https://www.drupal.org/commitlog/commit/42/9115de50de1920914ef5c6206d8ee...