From 338a5016cffd1b4463f8b7999208af42e90ac204 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 9 Jul 2021 20:23:30 +0200 Subject: [PATCH] Allow cyrillic letters in API filter values (fixes #1296) --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + controllers/BaseApiController.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 362cf26a..5185c185 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -88,3 +88,4 @@ - Fixed that due soon products with `due_type` = "Expiration date" were missing in `due_products` of the `/stock/volatile` endpoint - Fixed that `PUT/DELETE /objects/{entity}/{objectId}` produced an internal server error when the given object id was invalid (now returns `400 Bad Request`) - Fixed that hyphens in filter values did not work +- Fixed that cyrillic letters were not allowed in filter values diff --git a/controllers/BaseApiController.php b/controllers/BaseApiController.php index 5eb34bd9..96a2d343 100644 --- a/controllers/BaseApiController.php +++ b/controllers/BaseApiController.php @@ -12,7 +12,7 @@ class BaseApiController extends BaseController const PATTERN_OPERATOR = '!?(=|~|<|>|(>=)|(<=)|(ยง))'; - const PATTERN_VALUE = '[A-Za-z_0-9.$#^|-]+'; + const PATTERN_VALUE = '[A-Za-z\x{0400}-\x{04FF}_0-9.$#^|-]+'; public function __construct(\DI\Container $container) { @@ -90,7 +90,7 @@ class BaseApiController extends BaseController preg_match( '/(?P' . self::PATTERN_FIELD . ')' . '(?P' . self::PATTERN_OPERATOR . ')' - . '(?P' . self::PATTERN_VALUE . ')/', + . '(?P' . self::PATTERN_VALUE . ')/u', $q, $matches );