Hi, i've been reading the Volt page of the doc and i played with it today. However, when i ran accros the filter part with all the examples i've had some troubles :
{{ "\'this is a string\'"|stripslashes }}
gives me
Parse error: syntax error, unexpected 'this' (T_STRING) in C:\wamp\www\phalcon\app\views\index\index.volt.php on line 2
{{ [3, 1, 2]|sort }}
gives me
Notice: Array to string conversion in C:\wamp\www\phalcon\app\views\index\index.volt.php on line 12
BUT if i do {{ [3, 1, 2]|sort|var_dump }} with $compiler->addFilter('var_dump', 'var_dump');, it works of course, same goes for keys, so the example is not working but the functions are working for those 2
{{ ['first': 1, 'second': 2, 'third': 3]|keys }}
gives me
Notice: Array to string conversion in C:\wamp\www\phalcon\app\views\index\index.volt.php on line 8
Array
{{ '{"one":1,"two":2,"three":3}'|json_decode }}
gives me
Catchable fatal error: Object of class stdClass could not be converted to string in C:\wamp\www\phalcon\app\views\index\index.volt.php on line 1
However, {{ ["a","b"] | json_encode }} works
and
{{ "some\ntext"|nl2br }}
gives me
some\ntext, but when i do :
{{ "some (press enter)
text"|nl2br}} it works :)
Thoses examples come from : https://docs.phalcon.io/en/latest/reference/volt.html#filters For key and sort, it's just that the doc is giving us some wrong examples, and i'd be wise to change them :)
Did i misuse thoses filters or is anybody else having this problem ?