Typo3 12.4 是否可以与 PHP 8 和disable_functions=ini_set 一起使用?

问题描述 投票:0回答:1

我正在运行一个带有一些安全限制的 Typo3 页面,特别是我的管理员出于安全原因禁用了一些 PHP 功能。

disable_functions=ini_set

现在我进行了升级:

打字3 11.5 => 打字3 12.4

PHP 7.4 => PHP 8.2

这会导致 Bootstrap.php 第 441 行出现致命 PHP 错误,因为 ini_set 被禁用。

@ini_set('display_errors', (string)$displayErrors);

https://github.com/TYPO3/typo3/blob/12.4/typo3/sysext/core/Classes/Core/Bootstrap.php

Fatal error: Uncaught Error: Call to undefined function TYPO3\CMS\Core\Core\ini_set() in /var/www/html/typo3/sysext/core/Classes/Core/Bootstrap.php:441 Stack trace: #0 /var/www/html/typo3/sysext/core/Classes/Core/Bootstrap.php(94): TYPO3\CMS\Core\Core\Bootstrap::initializeErrorHandling() #1 /var/www/html/index.php(20): TYPO3\CMS\Core\Core\Bootstrap::init(Object(Composer\Autoload\ClassLoader)) #2 /var/www/html/index.php(21): {closure}() #3 {main} thrown in /var/www/html/typo3/sysext/core/Classes/Core/Bootstrap.php on line 441

它在 PHP 7.4 下工作,因为 @ 操作符让它默默地失败。但在 PHP 8.2 下,@ 运算符不再阻止致命错误。

有关于禁用功能的文档吗?

是否有可能在禁用 ini_set 的情况下在 PHP > 8 上运行 Typo3?

我知道这个:

https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Security/GuidelinesAdministrators/FurtherActions.html#security-lated-php-settings

https://php.watch/versions/8.0/fatal-error-suppression

security typo3 php-8 typo3-12.x
1个回答
0
投票

我刚刚在 TYPO3 源中搜索了

ini_set
,结果是这样的:

grep -r 'ini_set'
cms-frontend/Classes/Middleware/OutputCompression.php:
    @ini_set('zlib.output_compression_level', (string)$GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel']);
cms-core/Configuration/DefaultConfigurationDescription.yaml:
    description: 'Integer: memory_limit in MB: If more than 16, TYPO3 will try to use ini_set() to set the memory limit of PHP to the value. This works only if the function ini_set() is not disabled by your sysadmin.'
cms-core/Classes/Core/Bootstrap.php:
    @ini_set('display_errors', (string)$displayErrors);
cms-core/Classes/Core/Bootstrap.php:
    @ini_set('memory_limit', (string)((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit'] . 'm'));
cms-backend/Classes/Middleware/OutputCompression.php:
    @ini_set('zlib.output_compression_level', (string)$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']);
cms-install/Classes/Service/SessionService.php:
    ini_set('session.cookie_secure', GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'On' : 'Off');
cms-install/Classes/Service/SessionService.php:
    ini_set('session.cookie_httponly', 'On');
cms-install/Classes/Service/SessionService.php:
    ini_set('session.cookie_samesite', Cookie::SAMESITE_STRICT);
cms-install/Classes/Service/SessionService.php:
    ini_set('session.cookie_path', (string)GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
cms-install/Classes/Service/SessionService.php:
    ini_set('session.gc_probability', (string)100);
cms-install/Classes/Service/SessionService.php:
    ini_set('session.gc_divisor', (string)100);
cms-install/Classes/Service/SessionService.php:
    ini_set('session.gc_maxlifetime', (string)($this->expireTimeInMinutes * 2 * 60));

我认为,如果您设法避免或规避所有使用 TYPO3 的情况,则可能可以在不使用

ini_set
的情况下运行 TYPO3。 尽管这是一个残缺的系统,禁用了许多选项,但为每种情况找到正确的解决方案确实需要做一些工作。

© www.soinside.com 2019 - 2024. All rights reserved.