PHP raw post json_decode content-length limit

Started by nagiyevel, February 06, 2021, 11:30:30 AM

Previous topic - Next topic

nagiyevel



I have a web server with licensed CWP installed on it and PHP7.4 configured.


Today I wanted to post raw JSON data to my php application and decode it.


<?php
$json = file_get_contents('php://input&#039;);
print_r(json_decode($json));
print_r(json_last_error_msg());


But saw that when content-length of JSON self is higher than 8192 symbol raw data didn't encoded and function return empty string.


json_last_error() return "control character error possibly incorrectly encoded"


When I clear POST data there is no content-length limit and I cant post more data


<?php
$json = file_get_contents('php://input&#039;);
$json = preg_replace('/[[:cntrl:]]/', '', $json);
print_r(json_decode($json));
print_r(json_last_error_msg());


Why this happen?

nagiyevel

Don't know how but it was an apache web server problem.
After upgrading to apache 2.4.46 version with the same configuration the problem was solved.