[CLEANUP] Remove some obsolete PHP version checks 24/34824/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 30 Nov 2014 19:03:42 +0000 (20:03 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Sun, 30 Nov 2014 19:10:19 +0000 (20:10 +0100)
With hard requirement of PHP 5.5 and above a couple of
php version checks are obsolete and can be removed.

Resolves: #63461
Releases: master
Change-Id: Ib1dd7540fa6d3818809bb4d760bc730de23a7da2
Reviewed-on: http://review.typo3.org/34824
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcBackendTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 5fda3fc..a1b7fe4 100644 (file)
@@ -186,9 +186,6 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function flushByTagRemovesCacheEntriesWithSpecifiedTag() {
-               if (version_compare(phpversion(), '5.4.0', '<')) {
-                       $this->markTestSkipped('This test is not reliable with PHP version below 5.4.0');
-               }
                $backend = $this->setUpBackend();
                $data = 'some data' . microtime();
                $backend->set('BackendAPCTest1', $data, array('UnitTestTag%test', 'UnitTestTag%boring'));
index 316bfef..efe3bfd 100644 (file)
@@ -480,9 +480,6 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
         * @see http://phpmagazin.de/vfsStream-1.1.0-nutzt-PHP-5.4-M%C3%B6glichkeiten-064406.html
         */
        public function newFilesCanBeCreated() {
-               if (version_compare(PHP_VERSION, '5.4.0', '<')) {
-                       $this->markTestSkipped('touch() does not work with vfsStream in PHP 5.3 and below.');
-               }
                $fixture = $this->createDriverFixture();
                $fixture->createFile('testfile.txt', '/');
                $this->assertTrue($fixture->fileExists('/testfile.txt'));
@@ -493,9 +490,6 @@ class LocalDriverTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase {
         * @see http://phpmagazin.de/vfsStream-1.1.0-nutzt-PHP-5.4-M%C3%B6glichkeiten-064406.html
         */
        public function createdFilesAreEmpty() {
-               if (version_compare(PHP_VERSION, '5.4.0', '<')) {
-                       $this->markTestSkipped('touch() does not work with vfsStream in PHP 5.3 and below.');
-               }
                $fixture = $this->createDriverFixture();
                $fixture->createFile('testfile.txt', '/');
                $this->assertTrue($fixture->fileExists('/testfile.txt'));
index 190d992..9c8b5da 100644 (file)
@@ -3437,19 +3437,18 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                vfsStream::setup('test', NULL, $structure);
                $vfsUrl = vfsStream::url('test');
 
-               if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
-                       // set random values for mtime
-                       foreach ($structure as $structureLevel1Key => $structureLevel1Content) {
-                               $newMtime = rand();
-                               if (is_array($structureLevel1Content)) {
-                                       foreach ($structureLevel1Content as $structureLevel2Key => $structureLevel2Content) {
-                                               touch($vfsUrl . '/' . $structureLevel1Key . '/' . $structureLevel2Key, $newMtime);
-                                       }
-                               } else {
-                                       touch($vfsUrl . '/' . $structureLevel1Key, $newMtime);
+               // set random values for mtime
+               foreach ($structure as $structureLevel1Key => $structureLevel1Content) {
+                       $newMtime = rand();
+                       if (is_array($structureLevel1Content)) {
+                               foreach ($structureLevel1Content as $structureLevel2Key => $structureLevel2Content) {
+                                       touch($vfsUrl . '/' . $structureLevel1Key . '/' . $structureLevel2Key, $newMtime);
                                }
+                       } else {
+                               touch($vfsUrl . '/' . $structureLevel1Key, $newMtime);
                        }
                }
+
                return $vfsUrl;
        }
 
@@ -3528,10 +3527,6 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getFilesInDirCanOrderByMtime() {
-               if (version_compare(PHP_VERSION, '5.4.0', '<')) {
-                       $this->markTestSkipped('touch() does not work with vfsStream in PHP 5.3 and below.');
-               }
-
                $vfsStreamUrl = $this->getFilesInDirCreateTestDirectory();
                $files = array();
                $iterator = new \DirectoryIterator($vfsStreamUrl);
index 715d445..94d7dfb 100644 (file)
@@ -182,13 +182,8 @@ class ObjectConverter extends AbstractTypeConverter implements \TYPO3\CMS\Core\S
                                throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException('Override of target type not allowed. To enable this, you need to set the PropertyMappingConfiguration Value "CONFIGURATION_OVERRIDE_TARGET_TYPE_ALLOWED" to TRUE.', 1317050430);
                        }
 
-                               // FIXME: The following check and the checkInheritanceChainWithoutIsA() method should be removed if we raise the PHP requirement to 5.3.9 or higher
-                       if (version_compare(phpversion(), '5.3.8', '>')) {
-                               if ($targetType !== $originalTargetType && is_a($targetType, $originalTargetType, TRUE) === FALSE) {
-                                       throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidDataTypeException('The given type "' . $targetType . '" is not a subtype of "' . $originalTargetType . '".', 1317048056);
-                               }
-                       } else {
-                               $targetType = $this->checkInheritanceChainWithoutIsA($targetType, $originalTargetType);
+                       if ($targetType !== $originalTargetType && is_a($targetType, $originalTargetType, TRUE) === FALSE) {
+                               throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidDataTypeException('The given type "' . $targetType . '" is not a subtype of "' . $originalTargetType . '".', 1317048056);
                        }
                }
 
index 9249a58..bcf609b 100644 (file)
@@ -85,7 +85,6 @@ class Check {
                $statusArray[] = $this->checkMaxExecutionTime();
                $statusArray[] = $this->checkDisableFunctions();
                $statusArray[] = $this->checkDownloadsPossible();
-               $statusArray[] = $this->checkSafeMode();
                $statusArray[] = $this->checkDocRoot();
                $statusArray[] = $this->checkOpenBaseDir();
                $statusArray[] = $this->checkXdebugMaxNestingLevel();
@@ -420,34 +419,6 @@ class Check {
        }
 
        /**
-        * Check if safe mode is enabled
-        *
-        * @return Status\StatusInterface
-        */
-       protected function checkSafeMode() {
-               $safeModeEnabled = FALSE;
-               if (version_compare(phpversion(), '5.4', '<')) {
-                       $safeModeEnabled = filter_var(
-                               ini_get('safe_mode'),
-                               FILTER_VALIDATE_BOOLEAN,
-                               array(FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE)
-                       );
-               }
-               if ($safeModeEnabled) {
-                       $status = new Status\ErrorStatus();
-                       $status->setTitle('PHP safe mode on');
-                       $status->setMessage(
-                               'PHP safe_mode enabled. This is unsupported by TYPO3 CMS, it must be turned off:' . LF .
-                               'safe_mode=Off'
-                       );
-               } else {
-                       $status = new Status\OkStatus();
-                       $status->setTitle('PHP safe mode off');
-               }
-               return $status;
-       }
-
-       /**
         * Check for doc_root ini setting
         *
         * @return Status\StatusInterface