Skip to content

[Bug] Filters - some not working #244

@ampmonteiro

Description

@ampmonteiro

Version: 2.9.1, 2.5.x
PHP: 7.4.x
OS: Linux

Bug Description

When tried some examples of docs like filters, the output is an error.

Filters that i tried and give me an error: capitalize, webalize and upper.

output error:

<ul>
   <li id="item-1">PHP Fatal error:  Uncaught Error: Call to undefined function Latte\Runtime\mb_convert_case() in latte_project/vendor/latte/latte/src/Latte/Runtime/Filters.php:591
Stack trace:
#0 latte_project/temp/template.latte--eacf53d382.php(21): Latte\Runtime\Filters::capitalize()
#1 latte_project/vendor/latte/latte/src/Latte/Runtime/Template.php(205): Templateeacf53d382->main()
#2 latte_project/vendor/latte/latte/src/Latte/Engine.php(95): Latte\Runtime\Template->render()
#3 latte_project/index.php(8): Latte\Engine->render()
#4 {main}
 thrown in latte_project/vendor/latte/latte/src/Latte/Runtime/Filters.php on line 591

Steps To Reproduce

A stand alone installation without the Nette framework.
The same as the docs, for capitalize filter:

index.php page:

require __DIR__ . '/vendor/autoload.php';

$latte = new Latte\Engine;
$latte->setTempDirectory('temp');
$parameters['items'] = array('one', 'two', 'three');
$latte->render('views/template.latte', $parameters);

views/template.latte:

<ul n:if="$items">
{foreach $items as $item}
   <li id="item-{$iterator->counter}">{$item|capitalize}</li>
{/foreach}
</ul>

Expected Behavior

I expected the code to work, by capitalizing each word

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions