Php 7.2 - is it fully supported?

I will be upgrading my sites to php 7.2 and wanted to be assured that s2member + pro support php 7.2
Thanks
Dan

1 Like

Hi, I’m on PHP 7.0 without bugs, and I don’t think that a version of PHP be a problem with s2Member… If anyone can confirm that?

I’m also curious if s2member will work on PHP 7.2?

My server is going to be updated to 7.2 this week.

I ran a compatibility check and s2member received these errors:

Any insight is most welcome. I really hope s2member will continue to work on 7.2! :pray:t2:

Hi guys.

It shouldn’t be an issue. Those warnings and errors, are for files that belong to a library that adds PHP 7 functions to earlier versions of PHP for back compatibility. https://github.com/paragonie/random_compat/tree/master/lib

Functions like random_bytes, available since PHP 7. http://php.net/random_bytes

So if your PHP installation has the function, i.e. PHP 7+, the files with the code that would give an error, would not be loaded. E.g. from s2member/src/vendor/paragonie/random_compat/lib/random.php

    /**
     * mcrypt_create_iv()
     *
     * We only want to use mcypt_create_iv() if:
     *
     * - random_bytes() hasn't already been defined
     * - the mcrypt extensions is loaded
     * - One of these two conditions is true:
     *   - We're on Windows (DIRECTORY_SEPARATOR !== '/')
     *   - We're not on Windows and /dev/urandom is readabale
     *     (i.e. we're not in a chroot jail)
     * - Special case:
     *   - If we're not on Windows, but the PHP version is between
     *     5.6.10 and 5.6.12, we don't want to use mcrypt. It will
     *     hang indefinitely. This is bad.
     *   - If we're on Windows, we want to use PHP >= 5.3.7 or else
     *     we get insufficient entropy errors.
     */
    if (
        !is_callable('random_bytes')
        &&
        // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be.
        (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307)
        &&
        // Prevent this code from hanging indefinitely on non-Windows;
        // see https://bugs.php.net/bug.php?id=69833
        (
            DIRECTORY_SEPARATOR !== '/' ||
            (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)
        )
        &&
        extension_loaded('mcrypt')
    ) {
        // See random_bytes_mcrypt.php
        require_once $RandomCompatDIR . '/random_bytes_mcrypt.php';
    }
    $RandomCompatUrandom = null;

Feel free to test in a dev installation before upgrading the live site to PHP 7.2 if you feel insecure, though. And it’s always good practice to create a full backup before such a change.

I hope that helps! :slight_smile:

Just wondering, is it possible to revert a server back to the previous version of PHP if the new version is causing issues? Or are you stuck with the new version once you upgrade?

Yes, PHP can be reverted to an earlier version. https://www.google.com/search?q=downgrade+php

You could contact your webhost to ask them how you do that, so you’re ready for it in case you need it after the upgrade.

:slight_smile:

Has anyone confirmed that s2Member (and Pro) is working in PHP 7.2? I just ran the PHP Compatibility Checker plugin and got the same 2 warnings and 3 errors as mentioned above.

I know Cristian answered that the files in question should not be a problem, but has this been confirmed?

s2Member is actually the only WP plugin I’m using that gives me any warnings or errors when tested against 7.2.

1 Like

I am currently running PHP 7.2.15 on Ubuntu 18.04.2, I have s2Member Pro and do not have any issues with it.

I am on a dedicated server and do not have any other PHP versions installed or enabled. I also have Query Monitor installed and there are also no reports of errors from s2Member.

Hope this helps,
Ross

1 Like

Great to hear, thanks!