diff --git a/typo3/sysext/core/Classes/Utility/PhpOptionsUtility.php b/typo3/sysext/core/Classes/Utility/PhpOptionsUtility.php index 4d04233b9667cd0933ea956cf0af80e0042aa5d4..ee6fc51fa1e66f2490c48817bf439c8d6d8c5a2f 100644 --- a/typo3/sysext/core/Classes/Utility/PhpOptionsUtility.php +++ b/typo3/sysext/core/Classes/Utility/PhpOptionsUtility.php @@ -23,9 +23,11 @@ class PhpOptionsUtility * Check if php session.auto_start is enabled * * @return bool TRUE if session.auto_start is enabled, FALSE if disabled + * @deprecated since TYPO3 v9.3, will be removed in TYPO3 v10.0. Use custom filter_var()/ini_get() functionality yourself. */ public static function isSessionAutoStartEnabled() { + trigger_error('The PhpOptionsUtility class will be removed in TYPO3 v10.0. Use custom filter_var()/ini_get() functionality yourself.', E_USER_DEPRECATED); return self::getIniValueBoolean('session.auto_start'); } @@ -34,9 +36,11 @@ class PhpOptionsUtility * * @param string $configOption * @return bool TRUE if the given option is enabled, FALSE if disabled + * @deprecated since TYPO3 v9.3, will be removed in TYPO3 v10.0. Use custom filter_var()/ini_get() functionality yourself. */ public static function getIniValueBoolean($configOption) { + trigger_error('The PhpOptionsUtility class will be removed in TYPO3 v10.0. Use custom filter_va()/ini_get() functionality yourself.', E_USER_DEPRECATED); return filter_var(ini_get($configOption), FILTER_VALIDATE_BOOLEAN, [FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE]); } } diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85102-PhpOptionsUtility.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85102-PhpOptionsUtility.rst new file mode 100644 index 0000000000000000000000000000000000000000..f3e90922771ce3cb64bc5023f08d800471f3ff8d --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85102-PhpOptionsUtility.rst @@ -0,0 +1,34 @@ +.. include:: ../../Includes.txt + +======================================= +Deprecation: #85102 - PhpOptionsUtility +======================================= + +See :issue:`85102` + +Description +=========== + +The PHP class :php:`\TYPO3\CMS\Core\Utility\PhpOptionsUtility` has been marked as deprecated. + +The only purpose for this class was to check for available session handling in the installer. + + +Impact +====== + +Calling any method in this class will trigger deprecation warning. + + +Affected Installations +====================== + +Installations checking for session handling in custom extensions. + + +Migration +========= + +Implement the :php:`filter_var()` and :php:`ini_get()` used in the PhpOptionsUtility wrapper yourself. + +.. index:: PHP-API, FullyScanned, ext:core \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Service/SessionService.php b/typo3/sysext/install/Classes/Service/SessionService.php index 3bf73488d77956bf25c153dd3f9fe1fcec9ebc08..d5eec31fffaeea190b77d83e64f0bfd5cf50fafd 100644 --- a/typo3/sysext/install/Classes/Service/SessionService.php +++ b/typo3/sysext/install/Classes/Service/SessionService.php @@ -80,7 +80,7 @@ class SessionService implements SingletonInterface ini_set('session.gc_probability', (string)100); ini_set('session.gc_divisor', (string)100); ini_set('session.gc_maxlifetime', (string)$this->expireTimeInMinutes * 2 * 60); - if (\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSessionAutoStartEnabled()) { + if ($this->isSessionAutoStartEnabled()) { $sessionCreationError = 'Error: session.auto-start is enabled.<br />'; $sessionCreationError .= 'The PHP option session.auto-start is enabled. Disable this option in php.ini or .htaccess:<br />'; $sessionCreationError .= '<pre>php_value session.auto_start Off</pre>'; @@ -523,4 +523,25 @@ class SessionService implements SingletonInterface { session_write_close(); } + + /** + * Check if php session.auto_start is enabled + * + * @return bool TRUE if session.auto_start is enabled, FALSE if disabled + */ + protected function isSessionAutoStartEnabled() + { + return $this->getIniValueBoolean('session.auto_start'); + } + + /** + * Cast an on/off php ini value to boolean + * + * @param string $configOption + * @return bool TRUE if the given option is enabled, FALSE if disabled + */ + protected function getIniValueBoolean($configOption) + { + return filter_var(ini_get($configOption), FILTER_VALIDATE_BOOLEAN, [FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE]); + } } diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php index f4288c1ee38816645b1cbad36bab691677a47c87..691ff43080b793142125d2925bb49d6617429336 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php @@ -674,4 +674,9 @@ return [ 'Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst', ], ], + 'TYPO3\CMS\Core\Utility\PhpOptionsUtility' => [ + 'restFiles' => [ + 'Deprecation-85102-PhpOptionsUtility.rst', + ], + ], ]; diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php index 580413cb6f7a035437cc732f8b0771858b5740c7..a47d5faae27d313b065fc14badb5eddc96af5098 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php @@ -582,4 +582,18 @@ return [ 'Deprecation-85086-GeneralUtilityArrayToLogString.rst', ], ], + 'TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSessionAutoStartEnabled' => [ + 'numberOfMandatoryArguments' => 0, + 'maximumNumberOfArguments' => 0, + 'restFiles' => [ + 'Deprecation-85102-PhpOptionsUtility.rst', + ], + ], + 'TYPO3\CMS\Core\Utility\PhpOptionsUtility::getIniValueBoolean' => [ + 'numberOfMandatoryArguments' => 1, + 'maximumNumberOfArguments' => 1, + 'restFiles' => [ + 'Deprecation-85102-PhpOptionsUtility.rst', + ], + ], ];