In line #103 you have passed $value
to htmlspecialcharacters
after you have set $value
as an array earlier, before line #94 or at #96.
htmlspecialcharacters
is expecting a string, not an array, as the first argument.
You need to change #103 to be the same as #100 and pass it $val
and not $value
.