From 4a2ae66eeb4bd5c42c3e4c8e60020c25a8fdf795 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 18 Oct 2018 22:32:47 +0100 Subject: [PATCH] Fix determining the last preg error --- src/RegexResult.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RegexResult.php b/src/RegexResult.php index 62de463..f910266 100644 --- a/src/RegexResult.php +++ b/src/RegexResult.php @@ -6,6 +6,6 @@ abstract class RegexResult { protected static function lastPregError(): string { - return array_flip(get_defined_constants(true)['pcre'])[preg_last_error()]; + return array_search(preg_last_error(), get_defined_constants(true)['pcre'], true); } }