Skip to content

Commit 55764d1

Browse files
authored
Merge pull request #203 from shokkaku-net/master
uppercase + 4th match fix
2 parents fb51dcd + 2addf9a commit 55764d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/BladeOne.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,19 +3021,19 @@ protected function compileComponents($value)
30213021
* @return string
30223022
*/
30233023
$callback = function($match) {
3024-
if (static::contains($match[0], 'x-')) {
3024+
if (isset($match[4]) && static::contains($match[0], 'x-')) {
30253025
$match[4] = $this->compileComponents($match[4]);
30263026
}
30273027
$paramsCompiled = $this->parseParams($match[2]);
30283028
$str = "('components." . $match[1] . "'," . $paramsCompiled . ")";
3029-
return self::compileComponent($str) . $match[4] . self::compileEndComponent();
3029+
return self::compileComponent($str) . ($match[4] ?? '') . self::compileEndComponent();
30303030
};
30313031
return preg_replace_callback('/<x-([a-z0-9.-]+)(\s[^>]*)?(>((?:(?!<\/x-\1>).)*)<\/x-\1>|\/>)/ms', $callback, $value);
30323032
}
30333033

30343034
protected function parseParams($params): string
30353035
{
3036-
preg_match_all('/([a-z-0-9:]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches);
3036+
preg_match_all('/([a-zA-Z0-9:-]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches);
30373037
$paramsCompiled = [];
30383038
foreach ($matches[1] as $i => $key) {
30393039
$value = str_replace('"', '', $matches[2][$i]);

0 commit comments

Comments
 (0)