Skip to content

Commit

Permalink
Merge pull request trongate#169 from mjim/master
Browse files Browse the repository at this point in the history
change the out method to accept an empty string or null
  • Loading branch information
trongate authored Apr 12, 2024
2 parents e223e54 + 494b1ce commit 99d32e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engine/tg_helpers/string_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ function url_title($value, $transliteration = true) {
* @return string The escaped and formatted string ready for safe inclusion in the specified context.
* @throws Exception if an unsupported output format is provided.
*/
function out(string $input, string $encoding = 'UTF-8', string $output_format = 'html'): string {
function out(?string $input, string $encoding = 'UTF-8', string $output_format = 'html'): string {
$flags = ENT_QUOTES;

if ($input === null) {
$input = '';
}

if ($output_format === 'xml') {
$flags = ENT_XML1;
} elseif ($output_format === 'json') {
Expand Down

0 comments on commit 99d32e3

Please sign in to comment.