Skip to content

Change Concat Operator doesn't work #552

Closed

Description

@billmn

With Twig 1.4 release I have problems to change the Concat operator from "~" to "&"

I've used this code

public function getOperators() {
    return array(
        array(),
        array(
            '&' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT)
        ),
    );
}

but it doesn't work ... with 1.3 it works fine

Activity

  1. nikic commented on Dec 7, 2011

    @nikic
    Contributor

    I just tried your code sample with {{ 'a' & 'b' }} and for me it generated the expected Twig_Node_Expression_Binary_Concat node. So the problem must be related to some other code you are using.

  2. billmn commented on Dec 7, 2011

    @billmn
    Author

    You are right,
    I found the problem ... that is related to another class that override my configuration

    thank you

  3. added a commit that references this issue on May 27, 2026
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