Skip to content

Commit

Permalink
escaper should return 'null' on null value
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Feb 21, 2024
1 parent b17f2b8 commit 109dddb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Html/Escaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ class Escaper extends \Phalcon\Html\Escaper
*/
public function escapeJson(mixed $json = null): string
{
if (is_null($json)) {
return 'null';
}

// raw url encode
return rawurlencode(json_validate($json) ? $json ?? '' : json_encode($json));
return rawurlencode(json_validate($json) ? $json : json_encode($json));
}
}

0 comments on commit 109dddb

Please sign in to comment.