Merge pull request #339 from ajoneil/remove-pre-53-support

Remove pre 5.3 support
This commit is contained in:
Sean Harvey 2012-04-17 16:19:23 -07:00
commit 7d84aff01e
7 changed files with 9 additions and 31 deletions

View File

@ -264,7 +264,6 @@ abstract class DataFormatter extends Object {
// add default required fields
$dbFields = array_merge($dbFields, array('ID'=>'Int'));
// @todo Requires PHP 5.1+
if(is_array($this->removeFields)) {
$dbFields = array_diff_key($dbFields, array_combine($this->removeFields,$this->removeFields));
}

View File

@ -331,7 +331,7 @@ class SS_ClassManifest {
if (!$classes) {
$tokens = token_get_all($file);
if(version_compare(PHP_VERSION, '5.3', '>=')) {
$classes = self::get_namespaced_class_parser()->findAll($tokens);
$namespace = self::get_namespace_parser()->findAll($tokens);
if($namespace) {
@ -339,10 +339,7 @@ class SS_ClassManifest {
} else {
$namespace = '';
}
} else {
$classes = self::get_class_parser()->findAll($tokens);
$namespace = '';
}
$interfaces = self::get_interface_parser()->findAll($tokens);
$cache = array('classes' => $classes, 'interfaces' => $interfaces, 'namespace' => $namespace);

View File

@ -18,8 +18,6 @@
* Usage on CLI: sake dev/tasks/i18nTextCollectorTask
* Usage on CLI (module-specific): sake dev/tasks/i18nTextCollectorTask module=mymodule
*
* Requires PHP 5.1+ due to class_implements() limitations
*
* @author Bernat Foj Capell <bernat@silverstripe.com>
* @author Ingo Schommer <FIRSTNAME@silverstripe.com>
* @package framework

View File

@ -2160,10 +2160,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @return bool
*/
public static function has_own_table($dataClass) {
// The condition below has the same effect as !is_subclass_of($dataClass,'DataObject'),
// which causes PHP < 5.3 to segfault in rare circumstances, see PHP bug #46753
if($dataClass == 'DataObject' || !in_array('DataObject', ClassInfo::ancestry($dataClass))) return false;
if(!is_subclass_of($dataClass,'DataObject')) return false;
if(!isset(DataObject::$cache_has_own_table[$dataClass])) {
if(get_parent_class($dataClass) == 'DataObject') {

View File

@ -21,12 +21,9 @@ class RandomGenerator {
// TODO Fails with "Could not gather sufficient random data" on IIS, temporarily disabled on windows
if(!$isWin) {
// mcrypt with urandom is only available on PHP 5.3 or newer
if(version_compare(PHP_VERSION, '5.3.0', '>=') && function_exists('mcrypt_create_iv')) {
$e = mcrypt_create_iv(64, MCRYPT_DEV_URANDOM);
if($e !== false) return $e;
}
}
// Fall back to SSL methods - may slow down execution by a few ms
if (function_exists('openssl_random_pseudo_bytes')) {

View File

@ -13,10 +13,6 @@ class NamespacedClassManifestTest extends SapphireTest {
public function setUp() {
parent::setUp();
if(version_compare(PHP_VERSION, '5.3', '<')) {
$this->markTestSkipped('Namespaces are not supported before PHP 5.3');
}
$this->base = dirname(__FILE__) . '/fixtures/namespaced_classmanifest';
$this->manifest = new SS_ClassManifest($this->base, false, true, false);
}

View File

@ -122,9 +122,6 @@ PHP
}
function testNamesapcedClassDefParser() {
if(version_compare(PHP_VERSION, '5.3', '<')) {
return;
}
$parser = SS_ClassManifest::get_namespaced_class_parser();
$tokens = $this->getNamespaceTokens();
@ -167,9 +164,6 @@ PHP
}
function testNamespaceDefParser() {
if(version_compare(PHP_VERSION, '5.3', '<')) {
return;
}
$parser = SS_ClassManifest::get_namespace_parser();
$namespacedTokens = $this->getNamespaceTokens();