doupang5433 2016-08-19 21:58
浏览 39
已采纳

nginx fastcgi返回允许的内存大小耗尽而不是未找到异常

I have a website, written in Symfony2. when users want to access a route which doesn't exists, PHP returns

FastCGI sent in stderr:
PHP message:PHP Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate 85 bytes)
symfony/symfony/src/Symfony/Component/Debug/Exception/FlattenException. php on line 296

which is in flattenArgs function: (i think it gets in loop but i don'y know why)

elseif (is_array($value)) {
  if ($level > 10) {
    $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  } else {
    $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  }
} 

I have increased the memory_limit value in my php.ini, and also checked my configs. The other sites with same config written in pure PHP are working safe and write.

But naturally it should return 404, not found exception.

  • 写回答

1条回答 默认 最新

  • duanhuang1967 2017-04-10 06:48
    关注

    so i found the solution! you shouldn't use security context in error twigs. in my case i was using is_granted in header, processing some kind of errors is before defining security context.

    you can pass it by first checking user object and then security context.

    for example {%if app.user and is_granted('IS_AUTHENTICATED_FULLY')%}

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探