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

PHP Fatal error: Uncaught Twig_Error_Syntax: Unknown "addslashes" filter ... #64

Open
Petervw opened this issue Jan 20, 2019 · 1 comment

Comments

@Petervw
Copy link

Petervw commented Jan 20, 2019

Using the Twig extractor we've had a fatal error on a semi-custom filter.

$twig->addFilter(new Twig_SimpleFilter('addslashes', 'addslashes'));

Our twig template:

<div>{{ content.content|raw|addslashes }}</div>

Problem: We cannot use the default sanitization from Twig, we need the raw string with real HTML characters.

This will result in the following fatal error from the extractor:

PHP Fatal error:  Uncaught Twig_Error_Syntax: Unknown "addslashes" filter
@umpirsky
Copy link
Owner

Thanks for reporting!

I guess we need to register that extension in https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/twig-gettext-extractor#L29-L39.

Can you try that locally and tell if it works?

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

2 participants