Undefined variable Problem

Description:

With PHP 7.1, following notice happens from time to time:

Notice: Undefined variable: _SERVER in C:\Apache24\htdocs\stock\vendor\symfony\http-foundation\Request.php on line 271

Notice: Undefined variable: _FILES in C:\Apache24\htdocs\stock\vendor\symfony\http-foundation\Request.php on line 281

Fatal error: Uncaught TypeError: Argument 5 passed to Symfony\Component\HttpFoundation\Request::createRequestFromFactory() must be of the type array, null given, called in C:\Apache24\htdocs\stock\vendor\symfony\http-foundation\Request.php on line 281 and defined in C:\Apache24\htdocs\stock\vendor\symfony\http-foundation\Request.php:1933 Stack trace: #0 C:\Apache24\htdocs\stock\vendor\symfony\http-foundation\Request.php(281): Symfony\Component\HttpFoundation\Request::createRequestFromFactory(Array, Array, Array, Array, NULL, NULL) #1 C:\Apache24\htdocs\stock\vendor\laravel\framework\src\Illuminate\Http\Request.php(57): Symfony\Component\HttpFoundation\Request::createFromGlobals() #2 C:\Apache24\htdocs\stock\public\index.php(56): Illuminate\Http\Request::capture() #3 {main} thrown in C:\Apache24\htdocs\stock\vendor\symfony\http-foundation\Request.php on line 1933

Solution:

Reference: