2012-04-26 58 views
1

由于服务器上的sf_culture = 1,我收到了很多错误。Symfony sf_culture = 1错误

{sfConfigurationException} Unable to find a matching route to generate url 
for params "array ( 'action' => 'legend', 'module' => 'housing', 'sf_culture' =>'1',)" 

本地本匹配缺省路由:

Match route "default" (/:sf_culture/:module/:action/*) for /de_DE/housing/legend with 
parameters array ( 'module' => 'housing', 'action' => 'legend', 'sf_format' => 'html', 
'sf_culture' => 'de_DE',) 

至极看起来像这样

default: 
    url: /:sf_culture/:module/:action/* 
    param: { sf_format: html } 
    requirements: 
    sf_culture: (?:<?php echo $cultures ?>) 

为什么它甚至有可能是:sf_culture或$ sf_user-> getCulture()将返回'1',我也在日志中看到'de?keepthis = true',这更奇怪。

我该如何处理这个错误?

编辑:我不能是唯一一个这个错误?我的意思是看这些日志(约1分钟)

May 10 09:50:23 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array ( 'action' => 'legend', 'module' => 'housing', 'sf_culture' => 'en“',)". 
May 10 09:50:34 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array ( 'action' => 'legend', 'module' => 'housing', 'sf_culture' => 'mvcleltja',)". 
May 10 09:50:45 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array ( 'action' => 'legend', 'module' => 'housing', 'sf_culture' => '√ en',)". 
May 10 09:51:26 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array ( 'action' => 'legend', 'module' => 'housing', 'sf_culture' => '1',)". 
May 10 09:51:42 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array ( 'action' => 'legend', 'module' => 'housing', 'sf_culture' => 'whwgopshwhyrydi',)". 
+1

你的'$文化'包含什么?顺便说一句,你是否检查产生这些错误的ips?也许这是一个疯狂的机器人尝试很多不同的网址。 – j0k 2012-05-10 08:13:57

+0

我很愚蠢,它始终是相同的IP,看起来像一个谷歌机器人。 – 2012-05-10 08:26:08

回答

0

您可以通过修改routing.yml限制在网址中允许的文化(应用程序/应用程序的名字/配置/ routing.yml文件),像这样:

 
localized_homepage: 
    url: /:sf_culture/ 
    param: { module: yourmodule, action: youraction } 
    requirements: 
    sf_culture: (?:fr|en)