导入.t3d文件至TYPO3 12.4.6时遇htmlspecialchars类型错误求助
TYPO3 从6.2.30迁移到12.4.6导入.t3d文件报错求助
背景
- 根服务器崩溃后,从虚拟机恢复TYPO3 6.2.30文件备份,导出站点为
.t3d文件 - 在配置接近新服务器的虚拟机上搭建TYPO3 12.4.6测试环境(v12界面简洁美观)
- 导入
.t3d文件时后端报错:htmlspecialchars(): Argument #1 ($string) must be of type string, null given
相关日志
警告信息
Sun, 08 Oct 2023 18:27:27 +0000 [WARNING] request="418b1cee8d80d" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Undefined array key "8e79286a8efa8a13de373312028aee83" in /srv/www/typo3_src-12.4.6/typo3/sysext/impexp/Classes/ImportExport.php line 721 Sun, 08 Oct 2023 18:27:27 +0000 [WARNING] request="418b1cee8d80d" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Trying to access array offset on value of type null in /srv/www/typo3_src-12.4.6/typo3/sysext/impexp/Classes/ImportExport.php line 738
错误信息
Sun, 08 Oct 2023 18:27:27 +0000 [CRITICAL] request="418b1cee8d80d" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler": Core: Exception handler (WEB: BE): TypeError, code #0, file /srv/www/typo3_src-12.4.6/typo3/sysext/impexp/Classes/ImportExport.php, line 738: htmlspecialchars(): Argument #1 ($string) must be of type string, null given - {"mode":"WEB","application_mode":"BE","exception_class":"TypeError","exception_code":0,"file":"/srv/www/typo3_src-12.4.6/typo3/sysext/impexp/Classes/ImportExport.php","line":738,"message":"htmlspecialchars(): Argument #1 ($string) must be of type string, null given","request_url":"http://[sitename.tld]/typo3/record/importexport/import?token=--AnonymizedToken--","exception":null}
问题排查
- 报错代码行(第738行):
$line['title'] = htmlspecialchars($fileInfo['filename']); - 该问题与TYPO3 v11曾修复的Bug场景类似,推测是缺少
?? ''的空值兜底处理 - 尝试手动添加空值处理后出现新错误,因自身PHP能力有限无法继续推进
求助疑问
TYPO3 v12标注为“新项目推荐”且稳定,是否应改用v11,半年后再升级?
内容的提问来源于stack exchange,提问作者Rossi
相关产品推荐
相关产品推荐

