From 3a930c13b1db00d1e693dea2d31ceff5c394c300 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Tue, 29 Nov 2022 19:48:17 +0000 Subject: [PATCH] - Removed sprintf which was causing problems with it's own escaping mechanism while using it in a view --- src/Common/UiElement.php | 5 ++++- src/Form/UiTextarea.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Common/UiElement.php b/src/Common/UiElement.php index e941c6d..5f6faa2 100644 --- a/src/Common/UiElement.php +++ b/src/Common/UiElement.php @@ -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); diff --git a/src/Form/UiTextarea.php b/src/Form/UiTextarea.php index c7c8b42..ff2df2a 100644 --- a/src/Form/UiTextarea.php +++ b/src/Form/UiTextarea.php @@ -22,7 +22,9 @@ class UiTextarea extends UiInput { $this->echoRaw = true; } - return sprintf("echoRaw(%s)->buildHtml($arguments) ?>", $this->echoRaw ? 'true' : 'false'); + $raw = $this->echoRaw ? 'true' : 'false'; + + return "echoRaw($raw)->buildHtml($arguments) ?>"; }