From 3988081030bb2b6e507dc8d91c10c6f364bc97d0 Mon Sep 17 00:00:00 2001 From: spinsch Date: Wed, 7 Oct 2020 10:27:52 +0200 Subject: [PATCH] Change lowest PHP version to 7 --- api.php | 4 ++-- .../Authorizenet/Model/Directpost/Request.php | 14 ++------------ get.php | 6 +++--- index.php | 7 +++---- index.php.sample | 5 ----- install.php | 4 ++-- lib/Mage/Archive/Tar.php | 4 ---- lib/Varien/Simplexml/Element.php | 19 ++----------------- lib/Zend/Http/Client.php | 2 +- lib/Zend/Pdf/StringParser.php | 8 +------- 10 files changed, 16 insertions(+), 57 deletions(-) diff --git a/api.php b/api.php index 666fc918072..f5c207f3cf7 100644 --- a/api.php +++ b/api.php @@ -24,8 +24,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -if (version_compare(phpversion(), '5.2.0', '<')) { - echo 'It looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer'; +if (version_compare(phpversion(), '7.0.0', '<')===true) { + echo 'It looks like you have an invalid PHP version. Magento supports PHP 7.0.0 or newer'; exit; } diff --git a/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php b/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php index 285dce8ea70..01bc53a0f82 100644 --- a/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php +++ b/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php @@ -78,23 +78,13 @@ protected function _setTransactionKey($transKey) */ public function generateRequestSign($merchantApiLoginId, $merchantTransactionKey, $amount, $currencyCode, $fpSequence, $fpTimestamp) { - if (phpversion() >= '5.1.2') { - return hash_hmac("md5", - $merchantApiLoginId . '^' . - $fpSequence . '^' . - $fpTimestamp . '^' . - $amount . '^' . - $currencyCode, $merchantTransactionKey - ); - } - - return bin2hex(mhash(MHASH_MD5, + return hash_hmac("md5", $merchantApiLoginId . '^' . $fpSequence . '^' . $fpTimestamp . '^' . $amount . '^' . $currencyCode, $merchantTransactionKey - )); + ); } /** diff --git a/get.php b/get.php index 09ea490ec55..f25d7634ce6 100644 --- a/get.php +++ b/get.php @@ -23,12 +23,12 @@ * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -if (version_compare(phpversion(), '5.2.0', '<')===true) { +if (version_compare(phpversion(), '7.0.0', '<')===true) { echo '

Whoops, it looks like you have an invalid PHP version.' - . '

Magento supports PHP 5.2.0 or newer. Find out how to install Magento using PHP-CGI as a work-around.

'; + . '

Magento supports PHP 7.0.0 or newer. Find out how to install

'; exit; } $start = microtime(true); diff --git a/index.php b/index.php index 2157d4f332f..369e8f3cedf 100644 --- a/index.php +++ b/index.php @@ -24,13 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -if (version_compare(phpversion(), '5.3.0', '<')===true) { +if (version_compare(phpversion(), '7.0.0', '<')===true) { echo '

-Whoops, it looks like you have an invalid PHP version.

Magento supports PHP 5.3.0 or newer. -Find out how to install - Magento using PHP-CGI as a work-around.

'; +Whoops, it looks like you have an invalid PHP version.

Magento supports PHP 7.0.0 or newer. +Find out how to install

'; exit; } diff --git a/index.php.sample b/index.php.sample index 98ccd0cd104..8f1b1e20e99 100644 --- a/index.php.sample +++ b/index.php.sample @@ -24,11 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -if (version_compare(phpversion(), '5.2.0', '<')===true) { - echo '

Whoops, it looks like you have an invalid PHP version.

Magento supports PHP 5.2.0 or newer. Find out how to install Magento using PHP-CGI as a work-around.

'; - exit; -} - require 'app/bootstrap.php'; /** diff --git a/install.php b/install.php index 4624ba69ceb..efc95c00c47 100644 --- a/install.php +++ b/install.php @@ -118,8 +118,8 @@ * */ -if (version_compare(phpversion(), '5.2.0', '<')===true) { - die('ERROR: Whoops, it looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer.'); +if (version_compare(phpversion(), '7.0.0', '<')===true) { + die('ERROR: Whoops, it looks like you have an invalid PHP version. Magento supports PHP 7.0.0 or newer.'); } set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); require 'app/bootstrap.php'; diff --git a/lib/Mage/Archive/Tar.php b/lib/Mage/Archive/Tar.php index cec1df9822e..cc95e005ddf 100644 --- a/lib/Mage/Archive/Tar.php +++ b/lib/Mage/Archive/Tar.php @@ -103,10 +103,6 @@ protected function _initWriter() */ protected static final function _getFormatParseHeader() { - if (version_compare(phpversion(), '5.5.0', '<') === true) { - return 'a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2version/' - . 'a32uname/a32gname/a8devmajor/a8devminor/a155prefix/a12closer'; - } return 'Z100name/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1type/Z100symlink/Z6magic/Z2version/' . 'Z32uname/Z32gname/Z8devmajor/Z8devminor/Z155prefix/Z12closer'; } diff --git a/lib/Varien/Simplexml/Element.php b/lib/Varien/Simplexml/Element.php index dc066a07377..48528093d59 100644 --- a/lib/Varien/Simplexml/Element.php +++ b/lib/Varien/Simplexml/Element.php @@ -345,16 +345,7 @@ public function xmlentities($value = null) public function appendChild($source) { if ($source->children()) { - /** - * @see http://bugs.php.net/bug.php?id=41867 , fixed in 5.2.4 - */ - if (version_compare(phpversion(), '5.2.4', '<')===true) { - $name = $source->children()->getName(); - } - else { - $name = $source->getName(); - } - $child = $this->addChild($name); + $child = $this->addChild($source->getName()); } else { $child = $this->addChild($source->getName(), $this->xmlentities($source)); } @@ -477,13 +468,7 @@ public function setNode($path, $value, $overwrite=true) $xml->addChild($nodeName, $xml->xmlentities($value)); */ if (!isset($node->$nodeName) || $overwrite) { - // http://bugs.php.net/bug.php?id=36795 - // comment on [8 Feb 8:09pm UTC] - if (isset($node->$nodeName) && (version_compare(phpversion(), '5.2.6', '<')===true)) { - $node->$nodeName = $node->xmlentities($value); - } else { - $node->$nodeName = $value; - } + $node->$nodeName = $value; } } else { if (!isset($node->$nodeName)) { diff --git a/lib/Zend/Http/Client.php b/lib/Zend/Http/Client.php index fd30f26cfd8..bd4b13ec46b 100644 --- a/lib/Zend/Http/Client.php +++ b/lib/Zend/Http/Client.php @@ -293,7 +293,7 @@ public function __construct($uri = null, $config = null) $this->setConfig($config); } - $this->_queryBracketsEscaped = version_compare(phpversion(), '5.1.3', '>='); + $this->_queryBracketsEscaped = true; } /** diff --git a/lib/Zend/Pdf/StringParser.php b/lib/Zend/Pdf/StringParser.php index 13720ed98dd..387e508b1a3 100644 --- a/lib/Zend/Pdf/StringParser.php +++ b/lib/Zend/Pdf/StringParser.php @@ -264,13 +264,7 @@ public function readLexeme() } } else { $start = $this->offset; - $compare = ''; - if( version_compare( phpversion(), '5.2.5' ) >= 0) { - $compare = "()<>[]{}/%\x00\t\n\f\r "; - } else { - $compare = "()<>[]{}/%\x00\t\n\r "; - } - + $compare = "()<>[]{}/%\x00\t\n\r "; $this->offset += strcspn($this->data, $compare, $this->offset); return substr($this->data, $start, $this->offset - $start);