Laravel - Disable automatically escaped character "<" (Less-than sign)

Viewed 44

I've found out that Laravel form requests automatically escape the "<" (Less-than sign), but only in the case when there is a character coming afterward (excluding whitespace).

Example successful input (Input is: foo < bar)

"comments" => "foo < bar"

Example failed input (Input is: foo < bar \r\n bar <foo)

"comments" => """
  foo < bar\r\n
  bar 
  """

It automatically trims the string, right after the following character of the less-than sign. Dumping directly the $_POST variable shows all the data correctly, however, the data gets escaped and is not possible to be accessed within the request.

1 Answers

I'm not sure but try this "comments" => htmlspecialchars("foo < bar")

Related