dragon2025 2017-02-14 14:59
浏览 37

PHP _COOKIE var得到undefined(整个var,不是索引)

We have developed an API with Symfony3 with a MySQL DB for the persistence. We are running this on Wamp (Apache 2.4, MySQL 5.6, PHP 7.0.10).

The API works well most of the time but, sometimes, after a restart, the bootstrap.php.cache throws an exception caused by this notice:

PHP Notice: Undefined variable: _COOKIE in ....

Here is the entire stack trace coming from the Symfony bowels:

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}

And this is the line where the stack begins:

$request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);

It's something strange because, from the stack trace I can know that $_GET, $_POST, and $_FILES are Arrays, but $_COOKIE is not...

Why this var is getting undefined?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)