当URL中存在错误的L
参数时,抛出此异常。它污染了/typo3temp/logs/
文件夹中的typo3_log。
这个例外似乎是在版本的2.3.0
版本中引入的。如果我降级到版本2.2.1
,则不会再记录错误。使用版本2.3.1
我也得到一个巨大的堆栈转储,其中包含整个TypoScript配置数组。
触发此错误的URL示例如下:
https://www.example.org/index.php?uid=1&L=a
config.linkVars = L(0-1)
https://www.example.org/index.php?uid=1&L=5
realurl_config.php
文件中的设置不对应的整数
config.linkVars = L(0-6)
'preVars' => array (
0 => array (
'GETvar' => 'L',
'valueMap' => array (
'en' => '1',
'fr' => '2',
'es' => '3',
'it' => '4',
),
'noMatch' => 'bypass',
),
)
https://www.example.org/index.php?uid=1&L=6
sys_language
数据库表中定义的现有语言不匹配的整数错误消息是这样的
component =“DmitryDulepov.Realurl.Encoder.UrlEncoder”:由realurl检测到错误的“L”参数(“X”)。禁用页面缓存以防止传播错误的“L”值 - “<long dump here>”
其中X
是错误的参数
长版转储不存在版本2.3.2
的realurl但版本2.3.1
我有一个完全正常的设置,与这样的版本2.2.x
很好地兼容
Typo脚本
config.linkVars = L(0-1)
page.config.linkVars < config.linkVars
config.uniqueLinkVars = 1
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de
config.sys_language_uid = 0
[globalVar = GP:L = 1]
config.language = en
config.locale_all = en_SUS
config.htmlTag_langKey = en
config.sys_language_uid = 1
[global]
realurl_conf.php
'preVars' => array (
0 => array (
'GETvar' => 'L',
'valueMap' => array (
'en' => '1',
),
'noMatch' => 'bypass',
),
),
激活语言英语:id = 1,默认语言德语
我搜索了错误消息,但我发现的是Dimitri(realurl的作者)的一些论坛回复,他们声称配置错误,但没有暗示什么是错误的。
错误未触发,因为我站点上的某些链接具有错误的L参数。访问日志显示具有错误参数的链接来自机器人或没有引用者或来自外部链接
我几次做过这个补丁似乎解决了这个问题:
index 1ce3874..c7004ea 100644
--- a/Classes/Encoder/UrlEncoder.php
+++ b/Classes/Encoder/UrlEncoder.php
@@ -1605,10 +1605,10 @@ class UrlEncoder extends EncodeDecoderBase {
addslashes($sysLanguageUid)
);
$this->tsfe->set_no_cache($message);
- $this->logger->error($message);
- if (version_compare(TYPO3_version, '7.6.0', '>=')) {
- $this->logger->debug($message, debug_backtrace());
- }
+ //$this->logger->error($message);
+ //if (version_compare(TYPO3_version, '7.6.0', '>=')) {
+ // $this->logger->debug($message, debug_backtrace());
+ //}
throw new InvalidLanguageParameterException($sysLanguageUid);
}
我认为在realurl配置中没有任何东西可以修复它。所以你必须应用这个补丁。我个人使用cweagans/composer-patches,如果你使用composer来管理你网站的依赖关系,这很好。