10

我安装了 TYPO3 7.6 版,在向我的页面添加扩展名后出现错误:

“糟糕,发生错误!代码:201512031647523f4d731f”

我没有得到这个错误的含义,我也在'displayErrors' => 1本地配置中启用了,但仍然没有得到有意义的错误。

在此处输入图像描述

4

3 回答 3

29

您需要关闭“内容对象异常处理程序”,这是新版本中的异常处理程序。如果内容元素/插件抛出异常,它不再关闭整个站点,而只会关闭它自己。要禁用它,请设置

config.contentObjectExceptionHandler = 0

参考

不要忘记在上线时重新启用异常处理程序,并且在您的实时系统中,您可以在日志文件中找到异常跟踪。基本上 Viktor Livakivskyi 在另一个答案中所说的。

于 2015-12-03T12:02:37.360 回答
11

基本上它是date + hash,这使得每个这样的错误都是独一无二的。

对于开发环境,您可以按照@Jost 的建议将其关闭。

但是对于生产来说,让它打开是至关重要的,所以如果你的一些插件或 TS 库失败了,它不会破坏完整的输出并在没有任何信息的情况下显示“Oops an error occurred”,但是你现在看到的消息用代码。

然后,网站的真实用户可以向您报告此代码,您可以在您的 TYPO3 错误日志中搜索此代码,该日志默认位于 下typo3temp/logs/,除非您对其进行了不同的配置。

因此,此功能确实可以让您轻松找出用户生成的错误。

于 2015-12-03T13:54:58.537 回答
0

您可以打开文件./typo3/sysext/frontend/Classes/ContentObject/Exception/ProductionExceptionHandler.php

搜索字符串糟糕,发生错误!. 在函数声明之后直接添加调试行。

    /**
 * Handles exceptions thrown during rendering of content objects
 * The handler can decide whether to re-throw the exception or
 * return a nice error message for production context.
 *
 * @param \Exception $exception
 * @param AbstractContentObject $contentObject
 * @param array $contentObjectConfiguration
 * @return string
 * @throws \Exception
 */
public function handle(\Exception $exception, AbstractContentObject $contentObject = null, $contentObjectConfiguration = array())
{
debug ($exception, 'handle $exception');

然后使用调试扩展,例如fh_debug。这将为您提供这样的输出。它向您显示导致此错误的调​​用的回溯。回溯以 2 种格式显示。您可以在回溯位置之前的位置添加更多调试行,以便获得有关错误的更多信息。

<table><tbody><tr><td>index.php</td><td>34</td><td>call_user_func</td></tr><tr><td>index.php</td><td>33</td><td>run</td></tr><tr><td>Application.php</td><td>78</td><td>handleRequest</td></tr><tr><td>Bootstrap.php</td><td>302</td><td>handleRequest</td></tr><tr><td>RequestHandler.php</td><td>232</td><td>INTincScript</td></tr><tr><td>TypoScriptFrontendController.php</td><td>3478</td><td>recursivelyReplaceIntPlaceholdersInContent</td></tr><tr><td>TypoScriptFrontendController.php</td><td>3512</td><td>INTincScript_process</td></tr><tr><td>TypoScriptFrontendController.php</td><td>3564</td><td>cObjGetSingle</td></tr><tr><td>ContentObjectRenderer.php</td><td>859</td><td>render</td></tr><tr><td>ContentObjectRenderer.php</td><td>943</td><td>render</td></tr><tr><td>ContentObjectArrayContentObject.php</td><td>41</td><td>cObjGet</td></tr><tr><td>ContentObjectRenderer.php</td><td>805</td><td>cObjGetSingle</td></tr><tr><td>ContentObjectRenderer.php</td><td>859</td><td>render</td></tr><tr><td>ContentObjectRenderer.php</td><td>953</td><td>handle</td></tr><tr><td>ProductionExceptionHandler.php</td><td>53</td><td>debug</td></tr></tbody></table><br><table><tbody><tr><th>Object TYPO3\CMS\Core\Error\Exception</th></tr><tr><td>message</td><td class="el">PHP Catchable Fatal Error: Argument 1 passed to TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::render() must be an instance of TYPO3\CMS\Frontend\ContentObject\AbstractContentObject, null given, called in /home/myuser/public_html/neu/typo3_src-7.6.10/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php on line 1359 and defined in /home/myuser/public_html/neu/typo3_src-7.6.10/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 927</td></tr>
<tr><td>code</td><td class="el"><table><tbody><tr><th>Integer</th></tr><tr><td>1</td></tr></tbody></table></td></tr>
<tr><td>file</td><td class="el">/home/myuser/public_html/neu/typo3_src-7.6.10/typo3/sysext/core/Classes/Error/ErrorHandler.php</td></tr>
<tr><td>line</td><td class="el"><table><tbody><tr><th>Integer</th></tr><tr><td>111</td></tr></tbody></table></td></tr>
</tbody></table>

<h3>handle $exception</h3><hr>


文本,稍后补充: 同时不需要再编辑 TYPO3 的 PHP 文件 ProductionExceptionHandler.php。您只需安装和配置扩展 fh_debug,它现在会自动执行必要的步骤。

于 2016-07-27T19:10:03.033 回答