PHP 7 Audit - Avatars For Multisite

Hello,

I am preparing to move my site to a server using PHP7 and ran an audit on all my plugins and themes to help better ensure compatibility with PHP7. Below you will find the results of ERRORS and WARNINGS that came back for the Avatars For Multisite Plugin. Any thoughts on whether these should be addressed prior to me moving to PHP 7 server?

Thanks

FILE: /wp-content/plugins/avatars/avatars.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------
 196 | ERROR | 'clone' is a reserved keyword introduced in PHP version 5.0 and cannot be invoked as a function (T_CLONE)
 232 | ERROR | 'clone' is a reserved keyword introduced in PHP version 5.0 and cannot be invoked as a function (T_CLONE)
-------------------------------------------------------------------------------------------------------------------------

FILE: /wp-content/plugins/avatars/avatars-files/front/widget.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 9 | WARNING | Use of deprecated PHP4 style class constructor is not supported since PHP 7.
  • Vaughan
    • Support/SLS MockingJay

    Hi Rone,

    Hope you're well?

    The Errors will certainly need to be fixed. The warnings shouldn't break functionality though. But should be addressed either way.

    To fix the errors:

    Open up & edit /wp-content/plugins/avatars/avatars.php

    Find the following on line 196:

    $orig_filesystem = clone( $wp_filesystem );

    Replace with:

    $orig_filesystem = clone $wp_filesystem;

    Find on line 232:

    $wp_filesystem = clone( $orig_filesystem );

    Replace with:

    $wp_filesystem = clone $orig_filesystem;

    Open up & edit /wp-content/plugins/avatars/avatars-files/front/widget.php

    Find on lines 9 - 11:

    function WA_Widget_Avatars() {
    		parent::__construct( false, __( 'Avatars Widget', 'avatars' ) );
    	}

    Replace with:

    function __construct() {
    		parent::__construct( false, __( 'Avatars Widget', 'avatars' ) );
    	}

    Hope this helps

    • Rone
      • Site Builder, Child of Zeus

      Thanks Vaughan! I am well and hope you can say the same.

      I will proceed with your suggested changes, but do wonder if these fixes will be implemented in an official release version of the plugin from you guys?

      I'd hate to make these changes to the core plugin files only to potentially have them overridden in a future update of the plugin that didn't include them.

  • Vaughan
    • Support/SLS MockingJay

    Hi,

    Yes, they will be addressed as & when we become aware of them. It would take a considerable amount of time to audit every single plugin, and as of yet, PHP 7 isn't so widely used, at this moment in time we are dealing with them on a case by case basis when they're reported.

    I have reported this to the developer, so hopefully, it will be fully fixed & released in due course :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.