SMF icon indicating copy to clipboard operation
SMF copied to clipboard

install.php/upgrade.php should support a lower PHP version than 5.3

Open Dragooon opened this issue 12 years ago • 10 comments

The base install.php/upgrade.php should ideally support PHP 4 or at least PHP 5+, otherwise we won't even be able to tell the user that their PHP version isn't supported.

Dragooon avatar Jun 10 '14 11:06 Dragooon

For the installer, agreed. For the upgrader, no, because by then it's already too late anyway.

Arantor avatar Jun 10 '14 15:06 Arantor

The installer already includes code to complain about the PHP version being too low:

    // Check the PHP version.
    if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>')))
    {
        $incontext['warning'] = $txt['error_php_too_low'];
    }

The only thing is it's treated as a warning and not an error, so theoretically you could get past that, but if we at least warn them that their PHP version is too low, we can't be responsible for problems caused by ignoring the warning.

Oldiesmann avatar Jun 10 '14 16:06 Oldiesmann

Installer will throw a parse error for versions below PHP 5.3, essentially my fault since I introduced closures to fix some other bug.

On Tue, Jun 10, 2014 at 9:59 PM, Michael Eshom [email protected] wrote:

The installer already includes code to complain about the PHP version being too low:

// Check the PHP version.
if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>')))
{
    $incontext['warning'] = $txt['error_php_too_low'];
}

The only thing is it's treated as a warning and not an error, so theoretically you could get past that, but if we at least warn them that their PHP version is too low, we can't be responsible for problems caused by ignoring the warning.

— Reply to this email directly or view it on GitHub https://github.com/SimpleMachines/SMF2.1/issues/1798#issuecomment-45637604 .

Dragooon avatar Jun 10 '14 16:06 Dragooon

Closure is used only twice. Can it be replaced by create_function and global $script_url?

AngelinaBelle avatar Jun 10 '14 16:06 AngelinaBelle

If it will still generate an error before they get to that part of the install script, then we should indeed fix it.

Oldiesmann avatar Jun 10 '14 16:06 Oldiesmann

It should just die and show the system requirements, before doing anything else.

On Tue, Jun 10, 2014 at 10:05 PM, Michael Eshom [email protected] wrote:

If it will still generate an error before they get to that part of the install script, then we should indeed fix it.

— Reply to this email directly or view it on GitHub https://github.com/SimpleMachines/SMF2.1/issues/1798#issuecomment-45638347 .

Dragooon avatar Jun 10 '14 16:06 Dragooon

That's just it - you have to remove the use of a closure and reintroduce the old code because it will throw a syntax error before it even gets to do a version test. Already one user has tried to run the installer and it fails because he's using 5.2 or lower.

Arantor avatar Jun 10 '14 16:06 Arantor

I had the same problem on. A free web host. So,something like: https://github.com/AngelinaBelle/SMF2.1/compare/patch-4 Needs to be tested, of course.

AngelinaBelle avatar Jun 10 '14 17:06 AngelinaBelle

At a glance I see no reason why that wouldn't work, actually. create_function returns a string that names the function, and $smcFunc['strtolower'] is just fine with variable functions :)

Arantor avatar Jun 10 '14 18:06 Arantor

#1811 addresses issues in install.php #1812 adresses one of the issues in upgrade.php

However, Upgrade.php still loads QueryString.php before checking php version.

This results in Parse error: syntax error, unexpected T_FUNCTION in /home/a8358262/public_html/smf/Sources/QueryString.php on line 620

AngelinaBelle avatar Jun 12 '14 17:06 AngelinaBelle