Skip to content

Fix autoescaping for Twig 2.x #102

Description

@andriokha

Thanks for a very useful project!

Currently there's a boolean configuration option called autoescape that gets passed directly to \Twig\Environment::__construct() in

$twig = new \Twig_Environment($loaders, [
'debug' => $this->config['debug'],
'autoescape' => $this->config['autoescape'],

In Twig 1:

  • true is the same as html and uses that escaping strategy
  • false disables auto-escaping

In Twig 2 true was removed as an option (so to get the old true behaviour you should pass html).

It occurred to me that we could expose the full range of options, but I'm not sure if there's really any demand for that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions