[TASK] Raise PHP version requirement to 5.3.7 62/22662/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 29 Jul 2013 15:53:03 +0000 (17:53 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 31 Jul 2013 17:29:35 +0000 (19:29 +0200)
PHP versions smaller than 5.3.7 have some bugs that are worked
around with some nasty hacks in current core. It was already
decided on TYPO3 Active Contributor Meeting in Nuernberg to
not support these versions with the upcoming LTS that will have
to support so many different PHP versions already: Younger 5.3,
5.4, 5.5 and later on in the lifecycle of the product maybe even
more.

The patch drops compatibility code for versions smaller than 5.3.7.

Change-Id: I3344d797f0c2f23f5135257b98c1b05c80871399
Resolves: #50529
Releases: 6.2
Reviewed-on: https://review.typo3.org/22662
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
12 files changed:
INSTALL.txt
NEWS.txt
typo3/sysext/core/Classes/Charset/CharsetConverter.php
typo3/sysext/core/Classes/Compatibility/CompatbilityClassLoaderPhpBelow50307.php [deleted file]
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcBackendTest.php
typo3/sysext/core/Tests/Unit/Compatibility/CompatbilityClassLoaderPhpBelow50307Test.php [deleted file]
typo3/sysext/core/Tests/Unit/Locking/LockerTest.php
typo3/sysext/extbase/Classes/Utility/TypeHandlingUtility.php
typo3/sysext/frontend/Tests/Unit/Controller/DataSubmissionControllerTest.php
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 286a004..437525f 100644 (file)
@@ -22,7 +22,7 @@ cover using TYPO3 with other databases or web servers.
 The following configuration is the minimum required:
 
 - a web server capable of running PHP
-- PHP 5.3.0 or newer with the following extensions:
+- PHP 5.3.7 or newer with the following extensions:
        - fileinfo
        - filter
        - GD2
@@ -75,12 +75,6 @@ The following configuration is recommended:
 - AllowOverride in the Apache configuration includes "Indexes" and "FileInfo"
   (see FAQ below)
 
-Since PHP below version 5.3.7 has a bug in correctly resolving type hints being
-in method signatures of interfaces - which need to be defined using a map for
-class aliases - we suggest to use at least PHP 5.3.7. Find more details here:
-- https://bugs.php.net/bug.php?id=54624
-- http://forge.typo3.org/issues/40653
-
 TYPO3 uses /dev/urandom or /dev/random on Unix-like platforms for security
 purposes. Access to these files is highly recommended and increases TYPO3
 security. Make sure to add "/dev/random:/dev/urandom" to open_basedir
index 0bc432d..33e4c84 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -18,6 +18,8 @@ Compatibility
 System environment
 -------------------------------------------------------------------------------
 
+* Raised minimum PHP version requirement to 5.3.7
+
 -------------------------------------------------------------------------------
 Deprecated and removed components
 -------------------------------------------------------------------------------
index 86b14bf..e02bf8a 100644 (file)
@@ -935,16 +935,8 @@ class CharsetConverter {
         * @todo Define visibility
         */
        public function entities_to_utf8($str, $alsoStdHtmlEnt = FALSE) {
-               // Workaround for #39287: 3rd parameter for get_html_translation_table() was only added in PHP 5.3.4 and later
-               // see http://php.net/manual/en/function.get-html-translation-table.php
-               $applyPhpCompatibilityFix = version_compare(phpversion(), '5.3.4', '<');
-
                if ($alsoStdHtmlEnt) {
-                       if ($applyPhpCompatibilityFix === TRUE) {
-                               $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_COMPAT));
-                       } else {
-                               $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'UTF-8'));
-                       }
+                       $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'UTF-8'));
                }
                $token = md5(microtime());
                $parts = explode($token, preg_replace('/(&([#[:alnum:]]*);)/', $token . '${2}' . $token, $str));
@@ -966,9 +958,6 @@ class CharsetConverter {
                        } elseif ($alsoStdHtmlEnt && isset($trans_tbl['&' . $v . ';'])) {
                                // Other entities:
                                $v = $trans_tbl['&' . $v . ';'];
-                               if ($applyPhpCompatibilityFix === TRUE) {
-                                       $v = $this->utf8_encode($v, 'iso-8859-1');
-                               }
                                $parts[$k] = $v;
                        } else {
                                // No conversion:
diff --git a/typo3/sysext/core/Classes/Compatibility/CompatbilityClassLoaderPhpBelow50307.php b/typo3/sysext/core/Classes/Compatibility/CompatbilityClassLoaderPhpBelow50307.php
deleted file mode 100644 (file)
index f13eff1..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Compatibility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012-2013 Thomas Maroschik <tmaroschik@dfau.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * This is a compatibility layer for systems running PHP < 5.3.7
- * It rewrites the type hints in method definitions so that they are identical to the
- * core interface definition
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- */
-class CompatbilityClassLoaderPhpBelow50307 extends \TYPO3\CMS\Core\Core\ClassLoader {
-
-       /**
-        * Contains the class loaders class name
-        *
-        * @var string
-        */
-       static protected $className = __CLASS__;
-
-       /**
-        * Installs TYPO3 autoloader, and loads the autoload registry for the core.
-        *
-        * @return boolean TRUE in case of success
-        */
-       static public function registerAutoloader() {
-               return parent::registerAutoloader();
-       }
-
-       /**
-        * Unload TYPO3 autoloader and write any additional classes
-        * found during the script run to the cache file.
-        *
-        * This method is called during shutdown of the framework.
-        *
-        * @return boolean TRUE in case of success
-        */
-       static public function unregisterAutoloader() {
-               return parent::unregisterAutoloader();
-       }
-
-       /**
-        * Require the class file and rewrite non sysext files transparently
-        *
-        * @static
-        * @param string $classPath
-        * @param string $className
-        * @return void
-        */
-       static public function requireClassFileOnce($classPath, $className) {
-               if (
-                       GeneralUtility::isFirstPartOfStr($className, 'tx_')
-                       || GeneralUtility::isFirstPartOfStr($className, 'Tx_')
-                       || GeneralUtility::isFirstPartOfStr($className, 'ux_')
-                       || GeneralUtility::isFirstPartOfStr($className, 'user_')
-                       || GeneralUtility::isFirstPartOfStr($className, 'User_')
-               ) {
-                       // If class in question starts with one of the allowed old prefixes
-                       static::checkClassCacheEntryAndRequire($classPath);
-                       // Load original file if the class is still not there (because cache is disabled)
-                       if (!class_exists($className)) {
-                               static::requireClassFile($classPath);
-                       }
-               } else {
-                       // Do nothing for system extensions or external libraries.
-                       // They are already using the proper type hints or do not use them at all.
-                       static::requireClassFile($classPath);
-               }
-       }
-
-       /**
-        * Require class file from cache and create if it doesn't exist yet
-        *
-        * @param $classPath
-        * @return void
-        */
-       static protected function checkClassCacheEntryAndRequire($classPath) {
-               $cacheIdentifier = static::getClassPathCacheIdentifier($classPath);
-               /** @var $phpCodeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
-               $phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_core');
-               if (!$phpCodeCache->has($cacheIdentifier)) {
-                       $classCode = static::rewriteMethodTypeHintsFromClassPath($classPath);
-                       $phpCodeCache->set($cacheIdentifier, $classCode, array(), 0);
-               }
-               $phpCodeCache->requireOnce($cacheIdentifier);
-       }
-
-       /**
-        * Generates the cache identifier from the relative class path and the files sha1 hash
-        *
-        * @static
-        * @param string $classPath
-        * @return string
-        */
-       static protected function getClassPathCacheIdentifier($classPath) {
-               // The relative class path is part of the cache identifier
-               $relativeClassPath = (GeneralUtility::isFirstPartOfStr($classPath, PATH_site)) ? substr($classPath, strlen(PATH_site)) : $classPath;
-               $fileExtension = strrchr($classPath, '.');
-               $fileNameWithoutExtension = substr(basename($classPath), 0, strlen($fileExtension) * -1);
-               // The class content has to be part of the identifier too
-               // otherwise the old class files get loaded from cache
-               $fileSha1 = sha1_file($classPath);
-               $cacheIdentifier = 'ClassLoader_' . $fileNameWithoutExtension . '_' . substr(sha1($fileSha1 . '|' . $relativeClassPath), 0, 20);
-               // Clean up identifier to be a valid cache entry identifier
-               $cacheIdentifier = preg_replace('/[^a-zA-Z0-9_%\-&]/i', '_', $cacheIdentifier);
-               return $cacheIdentifier;
-       }
-
-       /**
-        * Loads the class path and rewrites the type hints
-        *
-        * @static
-        * @param string $classPath
-        * @return string rewritten php code
-        */
-       static protected function rewriteMethodTypeHintsFromClassPath($classPath) {
-               $pcreBacktrackLimitOriginal = ini_get('pcre.backtrack_limit');
-               $classAliasMap = static::$aliasToClassNameMapping;
-               $fileContent = static::getClassFileContent($classPath);
-               $fileLength = strlen($fileContent);
-               $hasReplacements = FALSE;
-               // when the class file is bigger than the original pcre backtrace limit increase the limit
-               if ($pcreBacktrackLimitOriginal < $fileLength) {
-                       ini_set('pcre.backtrack_limit', $fileLength);
-               }
-               $fileContent = preg_replace_callback(
-                       '/function[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\((.*?\$.*?)\)(\s*[{;])/ims',
-                       function($matches) use($classAliasMap, &$hasReplacements) {
-                       if (isset($matches[1]) && isset($matches[2])) {
-                               list($functionName, $argumentList) = array_slice($matches, 1, 2);
-                               $arguments = explode(',', $argumentList);
-                               $arguments = array_map('trim', $arguments);
-                               $arguments = preg_replace_callback('/([\\a-z0-9_]+\s+)?((\s*[&]*\s*\$[a-z0-9_]+)(\s*=\s*.+)?)/ims', function($argumentMatches) use($classAliasMap, &$hasReplacements)  {
-                                       if (isset($argumentMatches[1]) && isset($argumentMatches[2])) {
-                                               $typeHint = strtolower(ltrim(trim($argumentMatches[1]), '\\'));
-                                               if (isset($classAliasMap[$typeHint])) {
-                                                       $hasReplacements = TRUE;
-                                                       return '\\' . $classAliasMap[$typeHint] . ' ' . $argumentMatches[2];
-                                               }
-                                       }
-                                       return $argumentMatches[0];
-                               }, $arguments);
-                               return 'function ' . $functionName . '(' . implode(', ', $arguments) . ')' . $matches[3];
-                       }
-                       return $matches[0];
-               }, $fileContent);
-               $fileContent = preg_replace(array(
-                       '/^\s*<\?php/',
-                       '/\?>\s*$/'
-               ), '', $fileContent);
-               if ($pcreBacktrackLimitOriginal < $fileLength) {
-                       ini_set('pcre.backtrack_limit', $pcreBacktrackLimitOriginal);
-               }
-
-               if (!$hasReplacements) {
-                       $fileContent = 'require_once \'' . $classPath . '\';';
-               }
-
-               return $fileContent;
-       }
-
-       /**
-        * Wrapper method to be able to mock in unit tests
-        *
-        * @param string $classPath
-        */
-       protected static function requireClassFile($classPath) {
-               GeneralUtility::requireOnce($classPath);
-       }
-
-       /**
-        * Wrapper method to be able to mock in unit tests
-        *
-        * @param string $classPath
-        * @return string
-        */
-       protected static function getClassFileContent($classPath) {
-               return file_get_contents($classPath);
-       }
-
-}
-
-?>
\ No newline at end of file
index 1f021ad..27f8af5 100644 (file)
@@ -353,11 +353,7 @@ class Bootstrap {
         * @return \TYPO3\CMS\Core\Core\Bootstrap
         */
        protected function registerAutoloader() {
-               if (PHP_VERSION_ID < 50307) {
-                       \TYPO3\CMS\Core\Compatibility\CompatbilityClassLoaderPhpBelow50307::registerAutoloader();
-               } else {
-                       \TYPO3\CMS\Core\Core\ClassLoader::registerAutoloader();
-               }
+               \TYPO3\CMS\Core\Core\ClassLoader::registerAutoloader();
                return $this;
        }
 
@@ -1057,11 +1053,7 @@ class Bootstrap {
         * @internal This is not a public API method, do not use in own extensions
         */
        public function shutdown() {
-               if (PHP_VERSION_ID < 50307) {
-                       \TYPO3\CMS\Core\Compatibility\CompatbilityClassLoaderPhpBelow50307::unregisterAutoloader();
-               } else {
-                       \TYPO3\CMS\Core\Core\ClassLoader::unregisterAutoloader();
-               }
+               \TYPO3\CMS\Core\Core\ClassLoader::unregisterAutoloader();
                return $this;
        }
 
index 8b85e04..031d39a 100644 (file)
@@ -213,9 +213,6 @@ class SystemEnvironmentBuilder {
                require_once __DIR__ . '/../Log/LogLevel.php';
                require_once __DIR__ . '/../Utility/MathUtility.php';
                require_once __DIR__ . '/ClassLoader.php';
-               if (PHP_VERSION_ID < 50307) {
-                       require_once __DIR__ . '/../Compatibility/CompatbilityClassLoaderPhpBelow50307.php';
-               }
        }
 
        /**
index a88666c..c29108d 100644 (file)
@@ -66,14 +66,6 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function itIsPossibleToSetAndCheckExistenceInCache() {
-               // APC has some slam protection that tries to prevent hammering of cache
-               // entries. This can be disabled, but the option does not work at least
-               // in native PHP 5.3.3 on debian squeeze. While it is no problem with
-               // higher PHP version like the current one on travis-ci.org,
-               // the test is now just skipped on PHP environments that are knows for issues.
-               if (version_compare(phpversion(), '5.3.4', '<')) {
-                       $this->markTestSkipped('This test is not reliable with PHP version below 5.3.3');
-               }
                $backend = $this->setUpBackend();
                $data = 'Some data';
                $identifier = 'MyIdentifier' . md5(uniqid(mt_rand(), TRUE));
@@ -86,14 +78,6 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function itIsPossibleToSetAndGetEntry() {
-               // APC has some slam protection that tries to prevent hammering of cache
-               // entries. This can be disabled, but the option does not work at least
-               // in native PHP 5.3.3 on debian squeeze. While it is no problem with
-               // higher PHP version like the current one on travis-ci.org,
-               // the test is now just skipped on PHP environments that are knows for issues.
-               if (version_compare(phpversion(), '5.3.4', '<')) {
-                       $this->markTestSkipped('This test is not reliable with PHP version below 5.3.3');
-               }
                $backend = $this->setUpBackend();
                $data = 'Some data';
                $identifier = 'MyIdentifier' . md5(uniqid(mt_rand(), TRUE));
@@ -227,14 +211,6 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function flushRemovesAllCacheEntries() {
-               // APC has some slam protection that tries to prevent hammering of cache
-               // entries. This can be disabled, but the option does not work at least
-               // in native PHP 5.3.3 on debian squeeze. While it is no problem with
-               // higher PHP version like the current one on travis-ci.org,
-               // the test is now just skipped on PHP environments that are knows for issues.
-               if (version_compare(phpversion(), '5.3.4', '<')) {
-                       $this->markTestSkipped('This test is not reliable with PHP version below 5.3.3');
-               }
                $backend = $this->setUpBackend();
                $data = 'some data' . microtime();
                $backend->set('BackendAPCTest1', $data);
diff --git a/typo3/sysext/core/Tests/Unit/Compatibility/CompatbilityClassLoaderPhpBelow50307Test.php b/typo3/sysext/core/Tests/Unit/Compatibility/CompatbilityClassLoaderPhpBelow50307Test.php
deleted file mode 100644 (file)
index 7ca6b30..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Unit\Compatibility;
-
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012-2013 Helmut Hummel <helmut.hummel@typo3.org>
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Testcase for TYPO3\CMS\Core\Compatibility\CompatbilityClassLoaderPhpBelow50307
- *
- */
-class CompatbilityClassLoaderPhpBelow50307Test extends \TYPO3\CMS\Core\Tests\UnitTestCase {
-
-       /**
-        * Class name of the fixture class
-        *
-        * @var string
-        */
-       protected $testClassName = 'Tx_Core_Tests_Unit_Core_Fixtures_LegacyClassFixture';
-
-       /**
-        * Fixture class template
-        *
-        * @var string
-        */
-       protected $classTemplate = 'abstract class Tx_Core_Tests_Unit_Core_Fixtures_LegacyClassFixture {
-               %s
-       }';
-
-       /**
-        * Fixture class code
-        *
-        * @var string
-        */
-       public static $classCode = '';
-
-       /**
-        * @var \TYPO3\CMS\Core\Compatibility\CompatbilityClassLoaderPhpBelow50307|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $fixture;
-
-       /**
-        * @return string
-        */
-       protected function getCompatibilityClassLoaderMockClass() {
-               $className = uniqid('CompatbilityClassLoaderPhpBelow50307Mock');
-               eval(
-                       'if (!class_exists(\'ClassPathHasBeenRequired\')) {' . LF .
-                               'class ClassPathHasBeenRequired extends Exception {}' . LF .
-                       '}' . LF .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Compatibility\\CompatbilityClassLoaderPhpBelow50307 {' . LF .
-                               'protected static function requireClassFile($classPath) {' . LF .
-                                       'throw new ClassPathHasBeenRequired(\'Class path \' . $classPath);' . LF .
-                               '}' . LF .
-                               'static public function getClassFileContent() {' . LF .
-                               '       return TYPO3\\CMS\\Core\\Tests\Unit\Compatibility\\CompatbilityClassLoaderPhpBelow50307Test::$classCode;' . LF .
-                               '}' . LF .
-                               'static public function rewriteMethodTypeHintsFromClassPath($classPath) {' . LF .
-                               '       return parent::rewriteMethodTypeHintsFromClassPath($classPath);' . LF .
-                               '}' . LF .
-                       '}'
-               );
-               return $className;
-       }
-
-       public function requireClassFileOnceTriggersParserForClassesWithAllowedPrefixesDataProvider() {
-               return array(
-                       'tx_' => array('tx_Foo'),
-                       'Tx_' => array('Tx_bar'),
-                       'user_' => array('user_fooBar'),
-                       'User_' => array('User_Barfoo'),
-                       'ux_' => array('ux_Foo'),
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider requireClassFileOnceTriggersParserForClassesWithAllowedPrefixesDataProvider
-        * @expectedException \checkClassCacheEntryAndRequireTestException
-        */
-       public function requireClassFileOnceTriggersParserForClassesWithAllowedPrefixes($className) {
-               $mockClassName = uniqid('CompatbilityClassLoaderPhpBelow50307Mock');
-               eval(
-                       'if (!class_exists(\'checkClassCacheEntryAndRequireTestException\')) {' . LF .
-                               'class checkClassCacheEntryAndRequireTestException extends Exception {}' . LF .
-                       '}' . LF .
-                       'class ' . $mockClassName . ' extends \\TYPO3\\CMS\\Core\\Compatibility\\CompatbilityClassLoaderPhpBelow50307 {' . LF .
-                               'protected static function checkClassCacheEntryAndRequire($classPath) {' . LF .
-                                       'throw new checkClassCacheEntryAndRequireTestException(\'Class path \' . $classPath);' . LF .
-                               '}' . LF .
-                       '}'
-               );
-               $mockClassName::requireClassFileOnce('/some/path', $className);
-       }
-
-       /**
-        * @test
-        * @expectedException \ClassPathHasBeenRequired
-        */
-       public function coreClassesAreRequiredImmediately() {
-               $classPath = '/dummy/path';
-               $className = 'TYPO3\\CMS\\Core\\Utility\\GeneralUtility';
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $mockClassLoaderClass::requireClassFileOnce($classPath, $className);
-       }
-
-       /**
-        * @test
-        * @expectedException \ClassPathHasBeenRequired
-        */
-       public function thirdPartyClassesAreRequiredImmediately() {
-               $classPath = '/dummy/path';
-               $className = 'SwiftMailer';
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $mockClassLoaderClass::requireClassFileOnce($classPath, $className);
-       }
-
-       /**
-        * @test
-        * @expectedException \ClassPathHasBeenRequired
-        */
-       public function nameSpacedExtensionClassesAreRequiredImmediately() {
-               $classPath = '/dummy/path';
-               $className = 'Vendor\\CoolExtension\\Service\\CoolService';
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $mockClassLoaderClass::requireClassFileOnce($classPath, $className);
-       }
-
-       /**
-        * @test
-        */
-       public function classCacheOnlyContainsRequireOfOriginalClassIfNothingHasBeenRewritten() {
-               $classPath = '/dummy/path';
-               self::$classCode = sprintf($this->classTemplate,
-                       '/**' . LF .
-                       ' *' . LF .
-                       ' */' . LF .
-                       'public function nothing() {' . LF .
-                       '}'
-               );
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $rewrittenContent = $mockClassLoaderClass::rewriteMethodTypeHintsFromClassPath($classPath);
-               $this->assertSame('require_once \'' . $classPath . '\';', $rewrittenContent);
-       }
-
-       /**
-        * @test
-        */
-       public function typeHintInOneLineAbstractFunctionIsCorrectlyRewritten() {
-               $classPath = '/dummy/path';
-               self::$classCode = sprintf($this->classTemplate,
-                       '/**' . LF .
-                       ' * @abstract' . LF .
-                       ' * @param t3lib_div $bar' . LF .
-                       ' * @return mixed' . LF .
-                       ' */' . LF .
-                       'abstract public function bar(t3lib_div $bar);'
-               );
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $rewrittenContent = $mockClassLoaderClass::rewriteMethodTypeHintsFromClassPath($classPath);
-               $this->assertContains('abstract public function bar(\TYPO3\CMS\Core\Utility\GeneralUtility $bar);', $rewrittenContent);
-       }
-
-       /**
-        * @test
-        */
-       public function typeHintInOneLineFunctionWithOneParameterIsCorrectlyRewritten() {
-               $classPath = '/dummy/path';
-               self::$classCode = sprintf($this->classTemplate,
-                       '/**' . LF .
-                       ' * @param t3lib_div $foo' . LF .
-                       ' */' . LF .
-                       'public function foo(t3lib_div $foo) {' . LF .
-                               '// this is only a dummy function' . LF .
-                               'if ($foo instanceof t3lib_div) {' . LF .
-                                       'return FALSE;' . LF .
-                               '}' . LF .
-                       '}' . LF
-               );
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $rewrittenContent = $mockClassLoaderClass::rewriteMethodTypeHintsFromClassPath($classPath);
-               $this->assertContains('// this is only a dummy function' . LF . 'if', $rewrittenContent, 'Comment not touched, newline after function ignored');
-               $this->assertContains('public function foo(\TYPO3\CMS\Core\Utility\GeneralUtility $foo) {', $rewrittenContent);
-       }
-
-       /**
-        * @test
-        */
-       public function typeHintInTwoLineFunctionWithTwoParametersIsCorrectlyRewritten() {
-               $classPath = '/dummy/path';
-               self::$classCode = sprintf($this->classTemplate,
-                       '/**' . LF .
-                       ' * @param t3lib_div $foo' . LF .
-                       ' * @param $baz' . LF .
-                       ' */' . LF .
-                       'public function         baz(t3lib_div $foo,' . LF .
-                       ' $baz) {' . LF .
-                       '}' . LF
-               );
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $rewrittenContent = $mockClassLoaderClass::rewriteMethodTypeHintsFromClassPath($classPath);
-               $this->assertContains('public function baz(\TYPO3\CMS\Core\Utility\GeneralUtility $foo, $baz) {', $rewrittenContent);
-       }
-
-       /**
-        * @test
-        */
-       public function typeHintInTwoLineFunctionWithTwoParametersWhileOneHavingTypehintNotInAliasMapIsCorrectlyRewritten() {
-               $classPath = '/dummy/path';
-               self::$classCode = sprintf($this->classTemplate,
-                       '       /**
-        * @param Tx_Extbase_Persistence_QueryInterface $query
-        * @param Tx_News_Domain_Model_DemandInterface $demand
-        */
-       abstract protected function createConstraintsFromDemand(Tx_Extbase_Persistence_QueryInterface $query,
-                                                                                                  Tx_News_Domain_Model_DemandInterface $demand);
-');
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $rewrittenContent = $mockClassLoaderClass::rewriteMethodTypeHintsFromClassPath($classPath);
-               $this->assertContains('protected function createConstraintsFromDemand(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, Tx_News_Domain_Model_DemandInterface $demand);', $rewrittenContent, 'Multi line abstract and second parameter with own typehint not in aliasmap');
-       }
-
-       /**
-        * @test
-        */
-       public function functionsWithoutParametersOrTypeHintsNotInAliasMapRemainUntouchedEvenWhenOtherTypeHintsAreRewritten() {
-               $classPath = '/dummy/path';
-               self::$classCode = sprintf($this->classTemplate,
-                       '       /**
-        * @param t3lib_div $foo
-        */
-       public function foo(t3lib_div $foo) {
-       }
-
-       /**
-        *
-        */
-       public function nothing() {
-       }
-
-       /**
-        * @param Tx_Core_Tests_Unit_Core_Fixtures_LegacyClassFixture $nothing
-        */
-       protected function stillNothing(Tx_Core_Tests_Unit_Core_Fixtures_LegacyClassFixture $nothing) {
-       }
-');
-
-               $mockClassLoaderClass = $this->getCompatibilityClassLoaderMockClass();
-               $rewrittenContent = $mockClassLoaderClass::rewriteMethodTypeHintsFromClassPath($classPath);
-               $this->assertContains('public function foo(\TYPO3\CMS\Core\Utility\GeneralUtility $foo) {', $rewrittenContent);
-               $this->assertContains('public function nothing() {', $rewrittenContent, 'One line one parameter');
-               $this->assertContains('protected function stillNothing(Tx_Core_Tests_Unit_Core_Fixtures_LegacyClassFixture $nothing) {', $rewrittenContent, 'One line on parameter with typehint not in aliasmap');
-       }
-}
-
-?>
\ No newline at end of file
index fbdfbc7..ea81c03 100644 (file)
@@ -235,10 +235,6 @@ class LockerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                if (TYPO3_OS === 'WIN') {
                        $this->markTestSkipped('releaseDoesNotRemoveFilesNotWithinTypo3TempLocksDirectory() test not available on Windows.');
                }
-               // Reflection needs php 5.3.2 or above
-               if (version_compare(phpversion(), '5.3.2', '<')) {
-                       $this->markTestSkipped('releaseDoesNotRemoveFilesNotWithinTypo3TempLocksDirectory() test not available with php version smaller than 5.3.2');
-               }
                // Create test file
                touch($file);
                if (!is_file($file)) {
index 4fec71a..d193034 100644 (file)
@@ -120,15 +120,6 @@ class TypeHandlingUtility {
                                        return TRUE;
                                }
                        }
-
-                               // is_subclass_of does not check for interfaces in PHP < 5.3.7
-                       if (version_compare(PHP_VERSION, '5.3.7', '<') === TRUE) {
-                               foreach (self::$collectionTypes as $collectionType) {
-                                       if (in_array($collectionType, class_implements($type)) === TRUE) {
-                                               return TRUE;
-                                       }
-                               }
-                       }
                }
 
                return FALSE;
index 08f0880..2922dbd 100644 (file)
@@ -54,12 +54,8 @@ class DataSubmissionControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                if (TYPO3_OS === 'WIN') {
                        $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() test not available on Windows.');
                }
-                       // Reflection needs php 5.3.2 or above
-               if (version_compare(phpversion(), '5.3.2', '<')) {
-                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() test not available with php version smaller than 5.3.2');
-               }
 
-                       // Create test file
+               // Create test file
                touch($file);
                if (!is_file($file)) {
                        $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() skipped: Test file could not be created');
index baadf64..9079c02 100644 (file)
@@ -125,7 +125,7 @@ class Check {
        /**
         * Checks if current directory (.) is in PHP include path
         *
-        * @return Status\WarningStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkCurrentDirectoryIsInIncludePath() {
                $includePath = ini_get('include_path');
@@ -151,7 +151,7 @@ class Check {
        /**
         * Check if file uploads are enabled in PHP
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkFileUploadEnabled() {
                if (!ini_get('file_uploads')) {
@@ -177,7 +177,7 @@ class Check {
        /**
         * Check maximum file upload size against default value of 10MB
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkMaximumFileUploadSize() {
                $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
@@ -202,7 +202,7 @@ class Check {
        /**
         * Check maximum post upload size correlates with maximum file upload
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkPostUploadSizeIsHigherOrEqualMaximumFileUploadSize() {
                $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
@@ -227,7 +227,7 @@ class Check {
        /**
         * Check memory settings
         *
-        * @return Status\ErrorStatus|Status\WarningStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkMemorySettings() {
                $memoryLimit = $this->getBytesFromSizeMeasurement(ini_get('memory_limit'));
@@ -269,28 +269,17 @@ class Check {
        /**
         * Check minimum PHP version
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkPhpVersion() {
-               $minimumPhpVersion = '5.3.0';
-               $recommendedPhpVersion = '5.3.7';
+               $minimumPhpVersion = '5.3.7';
                $currentPhpVersion = phpversion();
                if (version_compare($currentPhpVersion, $minimumPhpVersion) < 0) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('PHP version too low');
                        $status->setMessage(
                                'Your PHP version ' . $currentPhpVersion . ' is too old. TYPO3 CMS does not run' .
-                               ' with this version. Update to at least PHP ' . $recommendedPhpVersion
-                       );
-               } elseif (version_compare($currentPhpVersion, $recommendedPhpVersion) < 0) {
-                       $status = new Status\WarningStatus();
-                       $status->setTitle('PHP version below recommended version');
-                       $status->setMessage(
-                               'Your PHP version ' . $currentPhpVersion . ' is below the recommended version' .
-                               ' ' . $recommendedPhpVersion . '. TYPO3 CMS will mostly run with your PHP' .
-                               ' version, but it is not officially supported. Expect some problems,' .
-                               ' and a performance penalty, monitor your system for errors and watch' .
-                               ' out for an upgrade, soon.'
+                               ' with this version. Update to at least PHP ' . $minimumPhpVersion
                        );
                } else {
                        $status = new Status\OkStatus();
@@ -302,7 +291,7 @@ class Check {
        /**
         * Check maximum execution time
         *
-        * @return Status\ErrorStatus|Status\WarningStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkMaxExecutionTime() {
                $minimumMaximumExecutionTime = 30;
@@ -354,7 +343,7 @@ class Check {
        /**
         * Check for disabled functions
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkDisableFunctions() {
                $disabledFunctions = trim(ini_get('disable_functions'));
@@ -403,7 +392,7 @@ class Check {
        /**
         * Check if safe mode is enabled
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSafeMode() {
                $safeModeEnabled = FALSE;
@@ -430,7 +419,7 @@ class Check {
        /**
         * Check for doc_root ini setting
         *
-        * @return Status\NoticeStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkDocRoot() {
                $docRootSetting = trim(ini_get('doc_root'));
@@ -454,7 +443,7 @@ class Check {
        /**
         * Check open_basedir
         *
-        * @return Status\NoticeStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkOpenBaseDir() {
                $openBaseDirSetting = trim(ini_get('open_basedir'));
@@ -478,7 +467,7 @@ class Check {
        /**
         * If xdebug is loaded, the default max_nesting_level of 100 must be raised
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkXdebugMaxNestingLevel() {
                if (extension_loaded('xdebug')) {
@@ -509,7 +498,7 @@ class Check {
        /**
         * Check accessibility and functionality of OpenSSL
         *
-        * @return Status\NoticeStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkOpenSslInstalled() {
                if (extension_loaded('openssl')) {
@@ -541,7 +530,7 @@ class Check {
        /**
         * Check enabled suhosin
         *
-        * @return Status\NoticeStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSuhosinLoaded() {
                if ($this->isSuhosinLoaded()) {
@@ -563,7 +552,7 @@ class Check {
        /**
         * Check suhosin.request.max_vars
         *
-        * @return Status\ErrorStatus|Status\InfoStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSuhosinRequestMaxVars() {
                $recommendedRequestMaxVars = 400;
@@ -596,7 +585,7 @@ class Check {
        /**
         * Check suhosin.post.max_vars
         *
-        * @return Status\ErrorStatus|Status\InfoStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSuhosinPostMaxVars() {
                $recommendedPostMaxVars = 400;
@@ -629,7 +618,7 @@ class Check {
        /**
         * Check suhosin.get.max_value_length
         *
-        * @return Status\ErrorStatus|Status\InfoStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSuhosinGetMaxValueLength() {
                $recommendedGetMaxValueLength = 2000;
@@ -662,7 +651,7 @@ class Check {
        /**
         * Check suhosin.executor.include.whitelist contains phar
         *
-        * @return Status\NoticeStatus|Status\InfoStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSuhosinExecutorIncludeWhiteListContainsPhar() {
                if ($this->isSuhosinLoaded()) {
@@ -692,7 +681,7 @@ class Check {
        /**
         * Check suhosin.executor.include.whitelist contains vfs
         *
-        * @return Status\NoticeStatus|Status\InfoStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSuhosinExecutorIncludeWhiteListContainsVfs() {
                if ($this->isSuhosinLoaded()) {
@@ -723,7 +712,7 @@ class Check {
        /**
         * Check if some opcode cache is loaded
         *
-        * @return Status\WarningStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkSomePhpOpcodeCacheIsLoaded() {
                if (
@@ -756,7 +745,7 @@ class Check {
        /**
         * Check doc comments can be fetched by reflection
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkReflectionDocComment() {
                $testReflection = new \ReflectionMethod(get_class($this), __FUNCTION__);
@@ -781,7 +770,7 @@ class Check {
        /**
         * Checks thread stack size if on windows with apache
         *
-        * @return Status\WarningStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkWindowsApacheThreadStackSize() {
                if (
@@ -809,7 +798,7 @@ class Check {
         * Check if a specific required PHP extension is loaded
         *
         * @param string $extension
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkRequiredPhpExtension($extension) {
                if (!extension_loaded($extension)) {
@@ -829,7 +818,7 @@ class Check {
        /**
         * Check imagecreatetruecolor to verify gdlib works as expected
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkGdLibTrueColorSupport() {
                if (function_exists('imagecreatetruecolor')) {
@@ -859,7 +848,7 @@ class Check {
        /**
         * Check gif support of GD library
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkGdLibGifSupport() {
                if (
@@ -894,7 +883,7 @@ class Check {
        /**
         * Check jgp support of GD library
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkGdLibJpgSupport() {
                if (
@@ -918,7 +907,7 @@ class Check {
        /**
         * Check png support of GD library
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkGdLibPngSupport() {
                if (
@@ -954,7 +943,7 @@ class Check {
        /**
         * Check gdlib supports freetype
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkGdLibFreeTypeSupport() {
                if (function_exists('imagettftext')) {
@@ -980,7 +969,7 @@ class Check {
        /**
         * Create true type font test image
         *
-        * @return Status\OkStatus|Status\NoticeStatus
+        * @return Status\StatusInterface
         */
        protected function isTrueTypeFontDpiStandard() {
                if (function_exists('imageftbbox')) {
@@ -1023,7 +1012,7 @@ class Check {
        /**
         * Check php magic quotes
         *
-        * @return Status\OkStatus|Status\WarningStatus
+        * @return Status\StatusInterface
         */
        protected function checkPhpMagicQuotes() {
                if (get_magic_quotes_gpc()) {
@@ -1043,7 +1032,7 @@ class Check {
        /**
         * Check register globals
         *
-        * @return Status\ErrorStatus|Status\OkStatus
+        * @return Status\StatusInterface
         */
        protected function checkRegisterGlobals() {
                $registerGlobalsEnabled = filter_var(
@@ -1143,7 +1132,5 @@ class Check {
                }
                return $bytes;
        }
-
-
 }
 ?>