1

$_REQUEST is coming empty sometimes even though log says that $_SERVER['CONTENT_LENGTH'] is non zero.

Below is some of the information from $_SERVER:

[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BTRS125268; .NET CLR 2.0.50727; AskTbARS/5.17.0.25589)
[CONTENT_LENGTH] => 180
rekire
  • 47,260
  • 30
  • 167
  • 264

2 Answers2

1

I expect that the problem is that you post a variable e.g. test and that you have the same variable as parameter in the url. So your $_POST['test'] variable will be overridden by $_GET['test'] and you have the empty value of $_GET['test'] in $_REQUEST['test'].

So better use directly $_GET and $_POST.

rekire
  • 47,260
  • 30
  • 167
  • 264
0

$_REQUEST is an associative array that by default contains the contents of $_GET, $_POST and $_COOKIE. Whereas $_SERVER is an array containing information such as headers, paths, and script locations. $_REQUEST is a subset of $_SERVER, so it is obvious that though $_REQUEST is empty the $_SERVER is having some content.

Abinash Bishoyi
  • 187
  • 1
  • 2
  • 13