Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify PHP version error message in index.php, install.php, api.php… #2982

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

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';
$minVersion = '7.3.0';
if (version_compare(phpversion(), $minVersion, '<') === true) {
echo "It looks like you have an invalid PHP version. OpenMage supports PHP $minVersion or newer";
exit;
}

Expand Down
11 changes: 5 additions & 6 deletions get.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
* @copyright Copyright (c) 2016-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
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.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>';
$minVersion = '7.3.0';
if (version_compare(phpversion(), $minVersion, '<') === true) {
echo "<h3>Whoops, it looks like you have an invalid PHP version.</h3>";
echo "<p>OpenMage supports PHP $minVersion or newer. <a href=\"https://www.openmage.org/magento-lts/install.html\">Find out how to install</a> OpenMage using PHP-CGI as a work-around.</p>";
exit;
}

$start = microtime(true);
/**
* Error reporting
Expand Down
11 changes: 4 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

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.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>';
$minVersion = '7.3.0';
if (version_compare(phpversion(), $minVersion, '<') === true) {
echo "<h3>Whoops, it looks like you have an invalid PHP version.</h3>";
echo "<p>OpenMage supports PHP $minVersion or newer. <a href=\"https://www.openmage.org/magento-lts/install.html\">Find out how to install</a> OpenMage using PHP-CGI as a work-around.</p>";
exit;
}

Expand Down
8 changes: 6 additions & 2 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@
*
*/

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.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install.php is meant to be invoked from the cli, I think that's why there wasn't HTML before.

$minVersion = '7.3.0';
if (version_compare(phpversion(), $minVersion, '<') === true) {
echo "<h3>Whoops, it looks like you have an invalid PHP version.</h3>";
echo "<p>OpenMage supports PHP $minVersion or newer. <a href=\"https://www.openmage.org/magento-lts/install.html\">Find out how to install</a> OpenMage using PHP-CGI as a work-around.</p>";
exit;
}

set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path());
require 'app/bootstrap.php';
require 'app/Mage.php';
Expand Down