PHP Deprecated htmlspecialchars(): Passing null to paramete
Closed this issue · 4 comments
Ran into this error after updating my PHP version to 8.1:
htmlspecialchars_decode(): Passing null to parameter #1 ($string) of type string is deprecated
Whoops\Exception\ErrorException …/site/plugins/kirby-uniform-master/vendor/mzur/kirby-form/src/Form.php332
protected function decodeField($data) { return is_array($data) ? array_map([$this, 'decodeField'], $data) : htmlspecialchars_decode($data); }
Updated with a conditional and seems to have fixed the error.
protected function decodeField($data) { return is_array($data) ? array_map([$this, 'decodeField'], $data) : htmlspecialchars_decode($data ?: ''); }
@adamkiss Well-spotted, thanks! I've removed the version constraint so people get the latest version. However, I think the HTML encoding was only introduced in v5.
Please reopen if there is anything else to discuss.