Skip to content

Commit

Permalink
Change lowest PHP version to 7 (#1255)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Fahlke <flyingmana@googlemail.com>
  • Loading branch information
spinsch and Flyingmana committed May 17, 2021
1 parent 9d0cb18 commit 6bdcc28
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 51 deletions.
4 changes: 2 additions & 2 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
14 changes: 2 additions & 12 deletions app/code/core/Mage/Authorizenet/Model/Directpost/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions get.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; '
. 'border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; '
. 'text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.'
. '</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="https://www.openmage.org/magento-lts/install.html" '

. '</h3></div><p>Magento supports PHP 7.0.0 or newer. <a href="https://www.openmage.org/magento-lts/install.html" '
. 'target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
exit;
}
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">
Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.3.0 or newer.
Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 7.0.0 or newer.
<a href="https://www.openmage.org/magento-lts/install.html" target="">Find out</a> how to install</a>
Magento using PHP-CGI as a work-around.</p></div>';
exit;
Expand Down
4 changes: 2 additions & 2 deletions index.php.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="https://www.openmage.org/magento-lts/install.html" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
if (version_compare(phpversion(), '7.0.0', '<')===true) {
echo '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 7.0.0 or newer. <a href="https://www.openmage.org/magento-lts/install.html" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
exit;
}

Expand Down
4 changes: 2 additions & 2 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 0 additions & 4 deletions lib/Mage/Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
19 changes: 2 additions & 17 deletions lib/Varien/Simplexml/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
8 changes: 1 addition & 7 deletions lib/Zend/Pdf/StringParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6bdcc28

Please sign in to comment.