- Fixed a bug related to encoding into a template exception

This commit is contained in:
mcndave committed 2026-10-27 18:18:47 +00:00
1 parent 2931a462c0
commit 0eed9b76af
1 file changed
+3 -1
+3 -1
View File
@@ -31,6 +31,8 @@ class BlockToken implements ControlStructure {
return "<?php echo \$___block->render(\$___class__template); unset(\$___block); ?>"; return "<?php echo \$___block->render(\$___class__template); unset(\$___block); ?>";
case "arguments": case "arguments":
$cleanArguments = htmlspecialchars($arguments);
return <<<PHP return <<<PHP
<?php <?php
try { try {
@@ -42,7 +44,7 @@ class BlockToken implements ControlStructure {
\$showArgs = fn(\$e) => (\$type = gettype(\$e)) === 'object' ? \$e::class : \$type; \$showArgs = fn(\$e) => (\$type = gettype(\$e)) === 'object' ? \$e::class : \$type;
throw new \Exception( throw new \Exception(
sprintf('A block awaiting arguments (%s) instead received (%s) with values (%s)', '$arguments', implode(', ', array_map(\$showArgs, \$inlineVariables ?? [])), json_encode(\$inlineVariables)) sprintf('A block awaiting arguments (%s) instead received (%s) with values (%s)', '$cleanArguments', implode(', ', array_map(\$showArgs, \$inlineVariables ?? [])), json_encode(\$inlineVariables))
); );
} }
/*%EXCEPTION_LINE_BASE%*/?> /*%EXCEPTION_LINE_BASE%*/?>