Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rob_utopano's avatar

LineBreak (\n\r) throws error at API with JSON

Hey guys,

I am building a API which get requests in JSON-format. Some fields are getting long text values with linebreaks (\n\r) these linebreaks creates an internal server error, probably cause these linebreaks.

Is there a function to sanitize such requests so an error like this does not happen?

Best regards, Robert

0 likes
0 replies

Please or to participate in this conversation.