[BUGFIX] Cast values always to string before applying through ini_set 29/55629/5
authorBenjamin Kott <benjamin.kott@wfp2.com>
Fri, 9 Feb 2018 13:17:48 +0000 (14:17 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 9 Feb 2018 15:55:03 +0000 (16:55 +0100)
Resolves: #83826
Releases: master
Change-Id: I55d7141ffb26126215be029547e143ed2f777707
Reviewed-on: https://review.typo3.org/55629
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: TYPO3com <no-reply@typo3.com>
typo3/sysext/backend/Classes/Middleware/OutputCompression.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/frontend/Classes/Http/RequestHandler.php
typo3/sysext/install/Classes/Service/SessionService.php

index 6bb93af..5e2cb0c 100644 (file)
@@ -52,7 +52,7 @@ class OutputCompression implements MiddlewareInterface
     {
         if (extension_loaded('zlib') && $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) {
             if (MathUtility::canBeInterpretedAsInteger($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'])) {
-                @ini_set('zlib.output_compression_level', $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']);
+                @ini_set('zlib.output_compression_level', (string)$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']);
             }
             ob_start('ob_gzhandler');
         }
index 6c43efe..ddad790 100644 (file)
@@ -633,7 +633,7 @@ class Bootstrap
                     );
                 }
         }
-        @ini_set('display_errors', $displayErrors);
+        @ini_set('display_errors', (string)$displayErrors);
 
         if (!empty($errorHandlerClassName)) {
             // Register an error handler for the given errorHandlerError
@@ -659,7 +659,7 @@ class Bootstrap
     protected function setMemoryLimit()
     {
         if ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit'] > 16) {
-            @ini_set('memory_limit', ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit'] . 'm'));
+            @ini_set('memory_limit', (string)((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit'] . 'm'));
         }
         return $this;
     }
@@ -972,7 +972,7 @@ class Bootstrap
     {
         if (extension_loaded('zlib') && $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) {
             if (MathUtility::canBeInterpretedAsInteger($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'])) {
-                @ini_set('zlib.output_compression_level', $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']);
+                @ini_set('zlib.output_compression_level', (string)$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']);
             }
             ob_start('ob_gzhandler');
         }
index 7a5199a..3ffec3c 100644 (file)
@@ -322,7 +322,7 @@ class RequestHandler implements RequestHandlerInterface, PsrRequestHandlerInterf
     {
         if ($GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] && extension_loaded('zlib')) {
             if (MathUtility::canBeInterpretedAsInteger($GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'])) {
-                @ini_set('zlib.output_compression_level', $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel']);
+                @ini_set('zlib.output_compression_level', (string)$GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel']);
             }
             ob_start([GeneralUtility::makeInstance(CompressionUtility::class), 'compressionOutputHandler']);
         }
index 9629e3d..b2eda36 100644 (file)
@@ -74,11 +74,11 @@ class SessionService implements SingletonInterface
         session_set_save_handler([$this, 'open'], [$this, 'close'], [$this, 'read'], [$this, 'write'], [$this, 'destroy'], [$this, 'gc']);
         session_save_path($sessionSavePath);
         session_name($this->cookieName);
-        ini_set('session.cookie_path', GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
+        ini_set('session.cookie_path', (string)GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
         // Always call the garbage collector to clean up stale session files
-        ini_set('session.gc_probability', 100);
-        ini_set('session.gc_divisor', 100);
-        ini_set('session.gc_maxlifetime', $this->expireTimeInMinutes * 2 * 60);
+        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()) {
             $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 />';