diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index b9fa3f9d32e3b9ff5debd065bbbd8a825da84715..6eb306cf8f9d4571f3c702239b907dd3eda09415 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 206e3ce72af51f405ebebe58eecb6afe3c55c9e8..067c384d050d683bea83ace4144558eedd76f4ba 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 ebe7646b481781968c42b7953c1aa0e25819d195..a3c4d2bf1d014c5720cdd389d689e5eee267c3e5 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 5fb137cea9fed7258474430c9d46c7aa49be06d6..5f04dd87b9bf3e0322ccc3da6c367f57212e6bf3 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 1227f9453528ea00d565b2bd579fc9d348205b69..897f8a3d9d68b6c7f011c3f0fddb1f06464e4572 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 65059d33d33f1c966610ff7eb74d9a13b62d5de2..be7d060121a32b0d275f17f41a811a857e9cd9e1 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 d8117ee18a458e55e492d9506e8b881a393dc0f0..7c18a2525447ec5ea88eecab9b879fc121af5822 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');