Skip to content

Commit

Permalink
Make php7.3 minimum requirement (#2413)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Sep 7, 2022
1 parent bf19809 commit 8a90b2b
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static-code-analyses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
max-parallel: 5
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.0', '7.4']
php-versions: ['7.3', '8.1']
steps:
- uses: actions/checkout@v3
- name: Setup PHP
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0','8.1']
php-versions: ['8.2']
steps:
- uses: actions/checkout@v3
- name: Setup PHP
Expand Down
47 changes: 30 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,26 @@ level of backwards compatibility to the official releases.

**Pull requests with unofficial bug fixes and security patches from the community are encouraged and welcome!**

Though Magento does not follow [Semantic Versioning](http://semver.org/) we aim to provide a workable system for
### Versioning

Though Magento does __not__ follow [Semantic Versioning](http://semver.org/) we aim to provide a workable system for
dependency definition. Each Magento `1.<minor>.<revision>` release will get its own branch (named `1.<minor>.<revision>.x`)
that will be independently maintained with upstream patches and community bug fixes for as long as it makes sense
to do so (based on available resources). For example, Magento version `1.9.3.4` was merged into the `1.9.3.x` branch.
to do so (based on available resources). For example, Magento version `1.9.4.5` was merged into the `1.9.4.x` branch.

## Requirements

- PHP 7.0+ (PHP 7.3 with OpenSSL extension strongly recommended and verified compatible) (PHP 7.4 and 8.0 are supported)
- MySQL 5.6+ (8.0+ recommended)
- (optional) Redis 5+ (7.x recommended, latest verified compatible 7.0.4 with 20.x)
- PHP 7.3+ (PHP 8.0 is supported)
- MySQL 5.6+ (8.0+ recommended) or MariaDB

__Please be aware that although OpenMage is compatible that one or more extensions may not be__

### Optional

- PHP 7.4 and 8.0 are supported
- Please be aware that although OpenMage is compatible that 1 or more extensions may not be
- Redis 5+ (6.x recommended, latest verified compatible 6.0.7 with 20.x)

If using php 7.2+ then mcrypt needs to be disabled in php.ini or pecl to fallback on mcryptcompat and phpseclib. mcrypt is deprecated from 7.2+ onwards.
### PHP 7.2+
If using php 7.2+ then `mcrypt` needs to be disabled in `php.ini` or pecl to fallback on `mcryptcompat` and `phpseclib`. `mcrypt` is deprecated from 7.2+ onwards.

## Installation

Expand All @@ -60,7 +65,7 @@ If you want to contribute to the project:
```bash
git init
git remote add origin https://github.com/<YOUR GIT USERNAME>/magento-lts
git pull origin master
git pull origin main
git remote add upstream https://github.com/OpenMage/magento-lts
git pull upstream 1.9.4.x
git add -A && git commit
Expand Down Expand Up @@ -153,14 +158,22 @@ To find which files need the modification you can run `grep -rn 'urn:Magento' --
## Development Environment with ddev

- Install [ddev](https://ddev.com/get-started/)
- Clone the repository as described in Installation -> Using Git
- Create a ddev config using ```$ ddev config``` the defaults should be good for you
- Open .ddev/config.yaml and change the php version to 7.2
- Type ```$ ddev start``` to download and start the containers
- Navigate to https://magento-lts.ddev.site
- When you are done you can stop the test system by typing ```$ ddev stop```

### PhpStorm Factory Helper
- Clone the repository as described in installation ([Using Git](https://github.com/OpenMage/magento-lts#using-git))
- Create a ddev config, defaults should be good for you
```bash
$ ddev config
```
- Open `.ddev/config.yaml` and change the php version to your needs
- Download and start the containers
```bash
$ ddev start
```
- Open your site in browser
```bash
$ ddev launch
```

## PhpStorm Factory Helper

This repo includes class maps for the core Magento files in `.phpstorm.meta.php`.
To add class maps for installed extensions, you have to install [N98-magerun](https://github.com/netz98/n98-magerun)
Expand Down
4 changes: 2 additions & 2 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

if (version_compare(phpversion(), '7.0.0', '<')===true) {
echo 'It looks like you have an invalid PHP version. OpenMage supports PHP 7.0.0 or newer';
if (version_compare(phpversion(), '7.3.0', '<')===true) {
echo 'It looks like you have an invalid PHP version. OpenMage supports PHP 7.3.0 or newer';
exit;
}

Expand Down
28 changes: 0 additions & 28 deletions app/code/core/Mage/Core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,22 +392,6 @@ function hash_equals($known_string, $user_string)
}
}

if (version_compare(PHP_VERSION, '7.0.0', '<') && !function_exists('random_int')) {
/**
* Generates pseudo-random integers
*
* @param int $min
* @param int $max
* @return int Returns random integer in the range $min to $max, inclusive.
*/
function random_int($min, $max)
{
mt_srand();

return mt_rand($min, $max);
}
}

/**
* polyfill for PHP 8.0 function "str_contains"
*/
Expand Down Expand Up @@ -453,15 +437,3 @@ function str_ends_with($haystack, $needle)
}
}

/**
* polyfill for PHP 7.3 function "is_countable"
*/
if (!function_exists('is_countable')) {
/**
* @param mixed $value
* @return bool
*/
function is_countable($value) {
return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXMLElement;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"type": "magento-source",
"require": {
"php": ">=7.0 <8.2",
"php": ">=7.3 <8.2",
"ext-curl": "*",
"ext-dom": "*",
"ext-gd": "*",
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions get.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,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(), '7.0.0', '<')===true) {
if (version_compare(phpversion(), '7.3.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>OpenMage supports PHP 7.0.0 or newer. <a href="https://www.openmage.org/magento-lts/install.html" '
. '</h3></div><p>OpenMage supports PHP 7.3.0 or newer. <a href="https://www.openmage.org/magento-lts/install.html" '
. 'target="">Find out</a> how to install</a> OpenMage 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 @@ -18,11 +18,11 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

if (version_compare(phpversion(), '7.0.0', '<')===true) {
if (version_compare(phpversion(), '7.3.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>OpenMage supports PHP 7.0.0 or newer.
Whoops, it looks like you have an invalid PHP version.</h3></div><p>OpenMage supports PHP 7.3.0 or newer.
<a href="https://www.openmage.org/magento-lts/install.html" target="">Find out</a> how to install</a>
OpenMage 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 @@ -112,8 +112,8 @@
*
*/

if (version_compare(phpversion(), '7.0.0', '<')===true) {
die('ERROR: Whoops, it looks like you have an invalid PHP version. OpenMage supports PHP 7.0.0 or newer.');
if (version_compare(phpversion(), '7.3.0', '<')===true) {
die('ERROR: Whoops, it looks like you have an invalid PHP version. OpenMage supports PHP 7.3.0 or newer.');
}
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
require 'app/bootstrap.php';
Expand Down

0 comments on commit 8a90b2b

Please sign in to comment.