From 1fa19416f4ad2c834f17a30914affc5718b0b1a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 19 May 2015 23:18:39 +0200 Subject: [PATCH] Remove unnecessary PHP version checks --- wcfsetup/install/files/lib/system/io/Tar.class.php | 14 ++------------ .../install/files/lib/system/mail/Mail.class.php | 6 +----- .../install/files/lib/util/PasswordUtil.class.php | 5 +---- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/wcfsetup/install/files/lib/system/io/Tar.class.php b/wcfsetup/install/files/lib/system/io/Tar.class.php index 249b26d444..26377be43e 100644 --- a/wcfsetup/install/files/lib/system/io/Tar.class.php +++ b/wcfsetup/install/files/lib/system/io/Tar.class.php @@ -264,12 +264,7 @@ class Tar implements IArchive { $longFilename = null; } if ($header['typeflag'] == 'L') { - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $format = 'Z'.$header['size'].'filename'; - } - else { - $format = 'a'.$header['size'].'filename'; - } + $format = 'Z'.$header['size'].'filename'; $fileData = unpack($format, $this->file->read(512)); $longFilename = $fileData['filename']; @@ -314,12 +309,7 @@ class Tar implements IArchive { } // extract values - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $format = 'Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/Z32uname/Z32gname/Z8devmajor/Z8devminor/Z155prefix'; - } - else { - $format = 'a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix'; - } + $format = 'Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/Z32uname/Z32gname/Z8devmajor/Z8devminor/Z155prefix'; $data = unpack($format, $binaryData); diff --git a/wcfsetup/install/files/lib/system/mail/Mail.class.php b/wcfsetup/install/files/lib/system/mail/Mail.class.php index c6bb84a33d..d695a1c6f7 100644 --- a/wcfsetup/install/files/lib/system/mail/Mail.class.php +++ b/wcfsetup/install/files/lib/system/mail/Mail.class.php @@ -159,11 +159,7 @@ class Mail { $this->header .= 'Content-Type: '.$this->getContentType().'; charset=UTF-8'.self::$lineEnding; } - // until PHP 5.3.4 mb_send_mail() appends an extra MIME-Version header - // @see: https://bugs.php.net/bug.php?id=52681 - if (MAIL_SEND_METHOD != 'php' || version_compare(PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION, '5.3.4', '>=')) { - $this->header .= 'MIME-Version: 1.0'.self::$lineEnding; - } + $this->header .= 'MIME-Version: 1.0'.self::$lineEnding; return $this->header; } diff --git a/wcfsetup/install/files/lib/util/PasswordUtil.class.php b/wcfsetup/install/files/lib/util/PasswordUtil.class.php index 013926e416..2a5fdf7420 100644 --- a/wcfsetup/install/files/lib/util/PasswordUtil.class.php +++ b/wcfsetup/install/files/lib/util/PasswordUtil.class.php @@ -254,9 +254,6 @@ final class PasswordUtil { /** * Generates secure random numbers using OpenSSL. * - * This method forces mt_rand() if PHP versions below 5.4.0 are used due to a bug - * causing up to 15 seconds delay until the bytes are returned. - * * @see http://de1.php.net/manual/en/function.openssl-random-pseudo-bytes.php#104322 * @param integer $min * @param integer $max @@ -270,7 +267,7 @@ final class PasswordUtil { } // fallback to mt_rand() if OpenSSL is not available - if (version_compare(PHP_VERSION, '5.4.0-dev', '<') || !function_exists('openssl_random_pseudo_bytes')) { + if (!function_exists('openssl_random_pseudo_bytes')) { return mt_rand($min, $max); } -- 2.20.1