Skip to content

Filters for specific keys are string templated incorrectly #10

@raikasdev

Description

@raikasdev

Because we use backslashes and not normal slashes, this escapes the complex string templating and results in the wrong filter name:

$strings[ $key ] = apply_filters( "air_cookie\strings\{$key}", $string );

with key consent_modal_title results in a filter "air_cookie\strings\{consent_modal_title}" being applied.

Proper usage would be

$strings[ $key ] = apply_filters( "air_cookie\strings\\{$key}", $string );

As seen on PHP String docs "Complex (curly) syntax" in the last 5 lines of the first code example.

// Won't work, outputs: C:\folder\{fantastic}.txt
echo "C:\folder\{$great}.txt"
// Works, outputs: C:\folder\fantastic.txt
echo "C:\\folder\\{$great}.txt"

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