- Removed sprintf which was causing problems with it's own escaping mechanism while using it in a view

This commit is contained in:
Dave M. 2022-11-29 19:48:17 +00:00
parent 164a27d267
commit 3a930c13b1
2 changed files with 7 additions and 2 deletions

View File

@ -355,7 +355,8 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
return count($this->childs);
}
public function jsonSerialize() {
public function jsonSerialize() : mixed
{
return [
'tag' => $this->tag,
'attr' => $this->attributes,
@ -364,6 +365,7 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
];
}
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
if ( is_numeric($offset) ) {
return $this->selected[$offset] = $value;
@ -406,6 +408,7 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
return key($this->childs);
}
#[\ReturnTypeWillChange]
public function next() : self
{
return next($this->childs);

View File

@ -22,7 +22,9 @@ class UiTextarea extends UiInput {
$this->echoRaw = true;
}
return sprintf("<?php echo ( new \\" . static::class . "() )->echoRaw(%s)->buildHtml($arguments) ?>", $this->echoRaw ? 'true' : 'false');
$raw = $this->echoRaw ? 'true' : 'false';
return "<?php echo ( new \\" . static::class . "() )->echoRaw($raw)->buildHtml($arguments) ?>";
}