From 6bdcc287c26b09a150535c3916af847a2bb8d396 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 17 May 2021 09:10:59 +0200 Subject: [PATCH] Change lowest PHP version to 7 (#1255) Co-authored-by: Daniel Fahlke --- api.php | 4 ++-- .../Authorizenet/Model/Directpost/Request.php | 14 ++------------ get.php | 5 +++-- index.php | 4 ++-- index.php.sample | 4 ++-- 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, 17 insertions(+), 51 deletions(-) diff --git a/api.php b/api.php index bc9d545a49e..88eeaa8aba2 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 108fccc4784..2227d27374f 100644 --- a/get.php +++ b/get.php @@ -23,11 +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.

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

'; exit; } diff --git a/index.php b/index.php index ae4cb0be3ac..796de631fb2 100644 --- a/index.php +++ b/index.php @@ -24,11 +24,11 @@ * @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. +Whoops, it looks like you have an invalid PHP version.

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

'; exit; diff --git a/index.php.sample b/index.php.sample index 3020ca31361..9723ae98146 100644 --- a/index.php.sample +++ b/index.php.sample @@ -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', '<')===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.

'; +if (version_compare(phpversion(), '7.0.0', '<')===true) { + echo '

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

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

'; exit; } 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);