From e8a89aafa614227c6acb03b7e421bee96ffcf128 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Wed, 29 Nov 2017 19:04:55 +0100 Subject: [PATCH] Remove leftovers from previously supported PHP-version --- lib/SimpleSAML/Session.php | 5 ---- lib/SimpleSAML/SessionHandlerPHP.php | 8 +------ templates/selectidp-dropdown.php | 13 ++--------- tests/lib/SimpleSAML/DatabaseTest.php | 2 -- tests/lib/SimpleSAML/Utils/SystemTest.php | 4 ---- tests/www/IndexTest.php | 5 ---- www/_include.php | 28 ----------------------- 7 files changed, 3 insertions(+), 62 deletions(-) diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index b9fa3f9d3..6eb306cf8 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -482,11 +482,6 @@ class SimpleSAML_Session implements Serializable $this->dirty = true; - if (!function_exists('header_register_callback')) { - // PHP version < 5.4, can't register the callback - return; - } - if ($this->callback_registered) { // we already have a shutdown callback registered for this object, no need to add another one return; diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php index 206e3ce72..067c384d0 100644 --- a/lib/SimpleSAML/SessionHandlerPHP.php +++ b/lib/SimpleSAML/SessionHandlerPHP.php @@ -49,13 +49,7 @@ class SessionHandlerPHP extends SessionHandler $config = \SimpleSAML_Configuration::getInstance(); $this->cookie_name = $config->getString('session.phpsession.cookiename', null); - if (function_exists('session_status') && defined('PHP_SESSION_ACTIVE')) { // PHP >= 5.4 - $previous_session = session_status() === PHP_SESSION_ACTIVE; - } else { - $previous_session = (session_id() !== '') && (session_name() !== $this->cookie_name); - } - - if ($previous_session) { + if (session_status() === PHP_SESSION_ACTIVE) { if (session_name() === $this->cookie_name || $this->cookie_name === null) { Logger::warning( 'There is already a PHP session with the same name as SimpleSAMLphp\'s session, or the '. diff --git a/templates/selectidp-dropdown.php b/templates/selectidp-dropdown.php index ebe7646b4..a3c4d2bf1 100644 --- a/templates/selectidp-dropdown.php +++ b/templates/selectidp-dropdown.php @@ -33,21 +33,12 @@ foreach ($this->data['idplist'] as $idpentry) { value="<?php echo htmlspecialchars($this->data['returnIDParam']); ?>"/> <select id="dropdownlist" name="idpentityid"> <?php - /* - * TODO: change this to use $this instead when PHP 5.4 is the minimum requirement. - * - * This is a dirty hack because PHP 5.3 does not allow the use of $this inside closures. Therefore, the - * translation function must be passed somehow inside the closure. PHP 5.4 allows using $this, so we can - * then go back to the previous behaviour. - */ - $GLOBALS['__t'] = $this; usort($this->data['idplist'], function ($idpentry1, $idpentry2) { return strcmp( - $GLOBALS['__t']->t('idpname_'.$idpentry1['entityid']), - $GLOBALS['__t']->t('idpname_'.$idpentry2['entityid']) + $this->t('idpname_'.$idpentry1['entityid']), + $this->t('idpname_'.$idpentry2['entityid']) ); }); - unset($GLOBALS['__t']); foreach ($this->data['idplist'] as $idpentry) { echo '<option value="'.htmlspecialchars($idpentry['entityid']).'"'; diff --git a/tests/lib/SimpleSAML/DatabaseTest.php b/tests/lib/SimpleSAML/DatabaseTest.php index 5fb137cea..5f04dd87b 100644 --- a/tests/lib/SimpleSAML/DatabaseTest.php +++ b/tests/lib/SimpleSAML/DatabaseTest.php @@ -31,8 +31,6 @@ class SimpleSAML_DatabaseTest extends TestCase * Make protected functions available for testing * * @param string $getMethod The method to get. - * @requires PHP 5.3.2 - * * @return mixed The method itself. */ protected static function getMethod($getMethod) diff --git a/tests/lib/SimpleSAML/Utils/SystemTest.php b/tests/lib/SimpleSAML/Utils/SystemTest.php index 1227f9453..897f8a3d9 100644 --- a/tests/lib/SimpleSAML/Utils/SystemTest.php +++ b/tests/lib/SimpleSAML/Utils/SystemTest.php @@ -110,7 +110,6 @@ class SystemTest extends TestCase } /** - * @requires PHP 5.4.0 * @covers \SimpleSAML\Utils\System::writeFile * @test */ @@ -129,7 +128,6 @@ class SystemTest extends TestCase } /** - * @requires PHP 5.4.0 * @covers \SimpleSAML\Utils\System::writeFile * @test */ @@ -152,7 +150,6 @@ class SystemTest extends TestCase } /** - * @requires PHP 5.4.0 * @covers \SimpleSAML\Utils\System::writeFile * @test */ @@ -211,7 +208,6 @@ class SystemTest extends TestCase } /** - * @requires PHP 5.4.0 * @requires OS Linux * @covers \SimpleSAML\Utils\System::getTempDir * @test diff --git a/tests/www/IndexTest.php b/tests/www/IndexTest.php index 65059d33d..be7d06012 100644 --- a/tests/www/IndexTest.php +++ b/tests/www/IndexTest.php @@ -71,11 +71,6 @@ class IndexTest extends TestCase $this->markTestSkipped('The web-based tests cannot be run in HHVM for the moment.'); } - if (version_compare(phpversion(), '5.4') === -1) { - // no built-in server prior to 5.4 - $this->markTestSkipped('The web-based tests cannot be run in PHP versions older than 5.4.'); - } - // test most basic redirection $this->updateConfig(array( 'baseurlpath' => 'http://example.org/simplesaml/' diff --git a/www/_include.php b/www/_include.php index d8117ee18..7c18a2525 100644 --- a/www/_include.php +++ b/www/_include.php @@ -1,33 +1,5 @@ <?php -/** - * Disable magic quotes if they are enabled. - */ -function removeMagicQuotes() -{ - if (get_magic_quotes_gpc()) { - foreach (array('_GET', '_POST', '_COOKIE', '_REQUEST') as $a) { - if (isset($$a) && is_array($$a)) { - foreach ($$a as &$v) { - // we don't use array-parameters anywhere. Ignore any that may appear - if (is_array($v)) { - continue; - } - // unescape the string - $v = stripslashes($v); - } - } - } - } - if (get_magic_quotes_runtime()) { - set_magic_quotes_runtime(false); - } -} - -if (version_compare(PHP_VERSION, '5.4.0', '<')) { - removeMagicQuotes(); -} - // initialize the autoloader require_once(dirname(dirname(__FILE__)).'/lib/_autoload.php'); -- GitLab