Skip to content
Snippets Groups Projects
Commit 6a650d60 authored by Benni Mack's avatar Benni Mack Committed by Andreas Kienast
Browse files

[TASK] Deprecate PhpOptionsUtility

The utility class was thinned out in the last TYPO3
versions and now is only used in EXT:install.

The functionality can be moved into EXT:install,
and PhpOptionsUtility can be deprecated, marked
as deprecated and awaiting removal in TYPO3 v10.0.

Resolves: #85102
Releases: master
Change-Id: Ie45720ad70cd2bdd2949553c94fcec15806cb458
Reviewed-on: https://review.typo3.org/57071


Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent ff1601ff
No related branches found
No related tags found
No related merge requests found
......@@ -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]);
}
}
.. 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
......@@ -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]);
}
}
......@@ -674,4 +674,9 @@ return [
'Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst',
],
],
'TYPO3\CMS\Core\Utility\PhpOptionsUtility' => [
'restFiles' => [
'Deprecation-85102-PhpOptionsUtility.rst',
],
],
];
......@@ -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',
],
],
];
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment