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 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号