mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-02 18:07:35 +00:00
Cover and document the matches operator throwing on an invalid UTF-8 subject
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* Fix the sandbox resolving `use` trait templates before checking that the `use` tag is allowed
|
||||
* Fix `html_attr` dropping `style` declarations whose value is `0`, `0.0` or `'0'`
|
||||
* Fix the `default` filter fallback emitting an undefined variable warning when it uses the null-safe operator
|
||||
* Fix the `matches` operator silently treating PCRE execution errors as non-matches
|
||||
* Fix the `matches` operator silently treating PCRE execution errors as non-matches; it now throws a `RuntimeError`
|
||||
* Fix `TemplateWrapper::streamBlock()`, `TemplateWrapper::hasBlock()`, and `TemplateWrapper::getBlockNames()` omitting environment globals
|
||||
* Fix exceptions from dynamic parent expressions escaping without template context
|
||||
* Add the `BlockChain` class to compose blocks from multiple templates without using template internals
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Twig reports a PCRE failure when the "matches" subject is not valid UTF-8
|
||||
--TEMPLATE--
|
||||
{{ subject matches regexp }}
|
||||
--DATA--
|
||||
return ['subject' => "\xC3\x28abc", 'regexp' => '/^\p{L}+$/u'];
|
||||
--EXCEPTION--
|
||||
Twig\Error\RuntimeError: Regexp "/^\p{L}+$/u" passed to "matches" failed: Malformed UTF-8 characters, possibly incorrectly encoded in "index.twig" at line 2.
|
||||
Reference in New Issue
Block a user