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

Mixins with arguments seem to break on Twig functions' interpolation #53

Closed
butteredptarmigan opened this issue Jun 5, 2020 · 2 comments
Assignees
Labels

Comments

@butteredptarmigan
Copy link

Environment

  • PHP 7.4.4
  • Symfony 5
  • Pug-symfony 3.0.0
  • All optional node dependencies installed via Composer
  • Configured expression language is javascript, but it also applies to php-style expressions

Description

When I write a mixin and make it take some arguments, I see the following error: "Notice: Undefined offset: 1". It derives from line 199 of trait HelpersHandler, inside a method interpolateTwigFunctions.

There are some cases when it does not occur, for example:

mixin withoutParentheses
    p foo

mixin withParentheses()
    p bar

However, it occurs if an argument is defined – even if the mixin was not actually called or the argument was not used inside the mixin body. For example, this snippet from the documentation does not work:

mixin pet(name)
  li.pet= name
ul
  +pet('cat')
  +pet('dog')
  +pet('pig')
@kylekatarnls kylekatarnls self-assigned this Jun 5, 2020
kylekatarnls added a commit that referenced this issue Jun 5, 2020
Fix #53 interpolateTwigFunctions end of stream
@kylekatarnls
Copy link
Member

Hello, thank you for the report. I fixed it and released a patch 3.0.1. Please try to update.

@butteredptarmigan
Copy link
Author

You're the best! It works as expected now.

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

No branches or pull requests

2 participants