Fix exception where node isn't callable #1414
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been trying to upgrade my Tinyboard fork's version of Twig to 1.15.1 from a several years old version. Tinyboard uses the Twig I18n extension (I updated the Extensions folder to Twig-extensions v1.0.1), and an extension of its own that just adds some simple filters. I started getting this exception on most pages after updating Twig:
I think this issue in another project is related: kolber/stacey#91
I notice that Twig_Node_Expression_Function only sometimes sets the 'callable' attribute on itself. Call.php appears to have logic for handling the callable attribute not being set, but it forgets to actually catch the exception if it's not set. I added a try-catch block, and things seem to be all working now. I'm not familiar with the Twig codebase, so someone else will have to judge the correctness of this.