Skip to content

Smarty 5: registerPlugin() no longer working with names containing non-lowercase characters #907

@m-ober

Description

@m-ober

This should output "Test" but gives the following error in Smarty 5 / dev-master. Working with latest 4.x version.

Smarty\CompilerException: Syntax error in template "string:{customTag}" on line 1 "{customTag}" unknown tag 'customtag' in string:{customTag} on line 1

<?php

require 'vendor/autoload.php';

use Smarty\Smarty;
//use \Smarty;

class Functions
{
    public static function customTag()
    {
        return 'Test';
    }
}

$smarty = new Smarty();
$smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'customTag', [Functions::class, 'customTag']);
$smarty->display('string:{customTag}');

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions