简体   繁体   English

TYPO3 Fluid:禁止在flashMessages中显示PHP警告

[英]TYPO3 Fluid: suppress PHP warnings in flashMessages

I'm building a TYPO3 based website, where I'm using different extensions from the TER. 我正在建立一个基于TYPO3的网站,在这里我使用TER的不同扩展名。 Now two plugins used together produce undesirable results: PHP Warnings in the rendered Website. 现在,两个插件一起使用会产生不良结果:呈现的网站中的PHP警告。

The one extension is tt_products , which causes the messages, by accessing undefined indices in some array. 一个扩展名是tt_products ,它通过访问某个数组中的未定义索引来引起消息。 The other extension is tkaddress , which displays the messages. 另一个扩展名是tkaddress ,它显示消息。

tkaddress is based on Fluid-Templates, and uses the <f:flashMessages /> view helper to display proper errors, like invalid E-Mail address entered when editing address records. tkaddress基于Fluid-Templates,并使用<f:flashMessages />视图帮助器显示适当的错误,例如在编辑地址记录时输入的无效电子邮件地址。 Unfortunately, otherwise ignored PHP warnings are also caught in this view helper, which gives messages like 不幸的是,在此视图帮助器中还会捕获否则会忽略的PHP警告,该警告会给出类似

PHP Warning: Illegal string offset 'name' in /usr/local/www/apache24/data/typo3conf/ext/tt_products/view/class.tx_ttproducts_info_view.php line 301 PHP警告:/usr/local/www/apache24/data/typo3conf/ext/tt_products/view/class.tx_ttproducts_info_view.php第301行中的字符串偏移'name'不合法

This only happens in the live server. 这仅在实时服务器中发生。 In my local development environment I don't get such messages. 在我的本地开发环境中,我不会收到此类消息。 The verions of both extensions are identical, and I cannot trace the problem down to its root case. 两个扩展的版本是相同的,我无法追溯到问题的根源。

(I know, fixing the bugs in tt_products would be the correct way, but I don't want to modify it) (我知道,修复tt_products中的错误是正确的方法,但我不想对其进行修改)

Is the some setting to suppress PHP Warnings when using <f:flashMessages /> in Fluid? 在Fluid中使用<f:flashMessages />时是否有一些抑制PHP警告的设置?

Update: 更新:

Dev-Environment: 开发环境:

  • TYPO3 6.1.5 TYPO3 6.1.5
  • PHP 5.3.28 PHP 5.3.28
  • tt_products 2.7.6 tt_产品2.7.6
  • error_reporting (PHP INI): 22519 error_reporting(PHP INI):22519
  • OS: Windows 7 作业系统:Windows 7

Live-Environment: 生活环境:

  • TYPO3 6.1.5 TYPO3 6.1.5
  • PHP 5.4.40 PHP 5.4.40
  • tt_products 2.7.6 tt_产品2.7.6
  • error_reporting (PHP INI): 22519 error_reporting(PHP INI):22519
  • OS: FreeBSD 操作系统:FreeBSD

So only the OS and PHP Version differ. 因此,仅OS和PHP版本有所不同。 I also couldn't find a difference in PHP or TYPO3 related error reporting settings (both have displayErrors set to 1) 我也找不到与PHP或TYPO3相关的错误报告设置的差异(两者都将displayErrors设置为1)

The PHP version seems to be causing the described difference between your dev- environment and production environment. PHP版本似乎引起了您的开发环境和生产环境之间的所述差异。 I quote; 我引用;

How do I correct this Illegal String Offset? 如何更正此非法字符串偏移?

However, this warning message is new to PHP 5.4. 但是,此警告消息是PHP 5.4的新增功能。 Old versions didn't warn if this happened. 如果发生这种情况,旧版本没有警告。 They would silently convert 'type' to 0, then try to get character 0 (the first character) of the string. 他们会默默地将'type'转换为0,然后尝试获取字符串的字符0(第一个字符)。 So if this code was supposed to work, that's because abusing a string like this didn't cause any complaints on PHP 5.3 and below. 因此,如果该代码可以正常工作,那是因为滥用这样的字符串不会对PHP 5.3及以下版本产生任何抱怨。 (A lot of old PHP code has experienced this problem after upgrading.) (许多旧的PHP代码在升级后都遇到了此问题。)

tt_products tt_products

It seems that you're using tt_products version 2.7.6 . 似乎您正在使用tt_products版本2.7.6

Since version 2.7.6 there were a couple of bug fixes, including some code changes inside the file class.tx_ttproducts_info_view.php which may fix your problem as well. 从版本2.7.6有一些错误修复,包括文件class.tx_ttproducts_info_view.php一些代码更改,这些class.tx_ttproducts_info_view.php也可能会解决您的问题。

Try updating tt_products to version 2.7.17 , see: 尝试更新tt_products到版本2.7.17 ,请参阅:

http://typo3.org/extensions/repository/view/tt_products http://typo3.org/extensions/repository/view/tt_products

If the problem still occurs in a more recent version of the extension you can submit your issue on: 如果该扩展的最新版本仍然存在问题,则可以通过以下方式提交问题:

https://forge.typo3.org/projects/extension-tt_products https://forge.typo3.org/projects/extension-tt_products

Suppress warnings 禁止警告

However ignoring any warning isn't the right way you may look at: 但是,忽略任何警告并不是您看待的正确方法:

TYPO3: how to supress deprecated warnings? TYPO3:如何抑制已过时的警告?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM