1
0
mirror of https://github.com/flarum/core.git synced 2025-08-02 06:30:53 +02:00

chore: fix php 8.1 on preg_match 2nd argument being null, which also optimizes slightly

This commit is contained in:
Daniël Klabbers
2022-12-17 01:05:38 +01:00
parent 78189f29d2
commit d7b9a03f31

View File

@@ -38,7 +38,7 @@ abstract class AbstractRegexGambit implements GambitInterface
*/ */
protected function match($bit) protected function match($bit)
{ {
if (preg_match('/^(-?)'.$this->getGambitPattern().'$/i', $bit, $matches)) { if (! empty($bit) && preg_match('/^(-?)'.$this->getGambitPattern().'$/i', $bit, $matches)) {
return $matches; return $matches;
} }