From 2addf9acaddd854101de0afef828d9bcd6e0c3d4 Mon Sep 17 00:00:00 2001 From: chen-chan1 <161545719+chen-chan1@users.noreply.github.com> Date: Thu, 3 Apr 2025 21:37:54 -0600 Subject: [PATCH] uppercase + 4th match fix --- lib/BladeOne.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/BladeOne.php b/lib/BladeOne.php index c012a8d..693edf2 100644 --- a/lib/BladeOne.php +++ b/lib/BladeOne.php @@ -3021,19 +3021,19 @@ protected function compileComponents($value) * @return string */ $callback = function($match) { - if (static::contains($match[0], 'x-')) { + if (isset($match[4]) && static::contains($match[0], 'x-')) { $match[4] = $this->compileComponents($match[4]); } $paramsCompiled = $this->parseParams($match[2]); $str = "('components." . $match[1] . "'," . $paramsCompiled . ")"; - return self::compileComponent($str) . $match[4] . self::compileEndComponent(); + return self::compileComponent($str) . ($match[4] ?? '') . self::compileEndComponent(); }; return preg_replace_callback('/]*)?(>((?:(?!<\/x-\1>).)*)<\/x-\1>|\/>)/ms', $callback, $value); } protected function parseParams($params): string { - preg_match_all('/([a-z-0-9:]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches); + preg_match_all('/([a-zA-Z0-9:-]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches); $paramsCompiled = []; foreach ($matches[1] as $i => $key) { $value = str_replace('"', '', $matches[2][$i]);