Permalink
Browse files

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

Remove pre 5.3 support
  • Loading branch information...
2 parents 1ee0d3a + fb3b03f commit 7d84aff01e08cdc6778fafa10ceecc7f57ba9ae5 @halkyon halkyon committed Apr 17, 2012
View
@@ -264,7 +264,6 @@ protected function getFieldsForObj($obj) {
// 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));
}
@@ -331,18 +331,15 @@ public function handleFile($basename, $pathname, $depth) {
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) {
- $namespace = implode('', $namespace[0]['namespaceName']) . '\\';
- } else {
- $namespace = '';
- }
+
+ $classes = self::get_namespaced_class_parser()->findAll($tokens);
+ $namespace = self::get_namespace_parser()->findAll($tokens);
+ if($namespace) {
+ $namespace = implode('', $namespace[0]['namespaceName']) . '\\';
} else {
- $classes = self::get_class_parser()->findAll($tokens);
$namespace = '';
}
+
$interfaces = self::get_interface_parser()->findAll($tokens);
$cache = array('classes' => $classes, 'interfaces' => $interfaces, 'namespace' => $namespace);
@@ -17,8 +17,6 @@
* Usage through URL (module-specific): http://localhost/dev/tasks/i18nTextCollectorTask/?module=mymodule
* 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>
View
@@ -2160,10 +2160,7 @@ public function hasOwnTableDatabaseField($field) {
* @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') {
@@ -21,11 +21,8 @@ function generateEntropy() {
// 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;
- }
+ $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
@@ -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);
}
@@ -122,9 +122,6 @@ function testClassDefParser() {
}
function testNamesapcedClassDefParser() {
- if(version_compare(PHP_VERSION, '5.3', '<')) {
- return;
- }
$parser = SS_ClassManifest::get_namespaced_class_parser();
$tokens = $this->getNamespaceTokens();
@@ -167,9 +164,6 @@ function testInterfaceDefParser() {
}
function testNamespaceDefParser() {
- if(version_compare(PHP_VERSION, '5.3', '<')) {
- return;
- }
$parser = SS_ClassManifest::get_namespace_parser();
$namespacedTokens = $this->getNamespaceTokens();

0 comments on commit 7d84aff

Please sign in to comment.