我们已经开发了一个带有Symfony3的API和一个用于持久性的MySQL DB。我们在Wamp上运行它(Apache 2.4,MySQL 5.6,PHP 7.0.10)。
API在大多数情况下运行良好,但有时,重启后,bootstrap.php.cache会引发此通知引起的异常:
PHP注意:未定义的变量:_COOKIE in ....
这是来自Symfony肠道的整个堆栈追踪:
14-Feb-2017 07:36:29 UTC PHP Notice: Undefined variable: _COOKIE in C:\xxx\wamp\www\xxx\var\bootstrap.php.cache on line 453
14-Feb-2017 07:36:29 UTC PHP Fatal error: Uncaught TypeError: Argument 4 passed to Symfony\Component\HttpFoundation\Request::createRequestFromFactory() must be of the type array, null given, called in C:\xxx\wamp\www\xxx\var\bootstrap.php.cache on line 453 and defined in > > C:\xxx\wamp\www\xxx\var\bootstrap.php.cache:1268
Stack trace:
#0 C:\xxx\wamp\www\xxx\var\bootstrap.php.cache(453): Symfony\Component\HttpFoundation\Request::createRequestFromFactory(Array, Array, >Array, NULL, Array, Array)
#1 C:\xxx\wamp\www\xxx\web\app.php(15): Symfony\Component\HttpFoundation\Request::createFromGlobals()
#2 {main}
这是堆栈开始的行:
$request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);
这有点奇怪,因为从堆栈跟踪我可以知道$ _GET,$ _POST和$ _FILES是数组,但$ _COOKIE不是......
为什么这个var未定义?