Support » Plugin: Server IP & Memory Usage Display » V2.0.3 : function create_function() is deprecated in PHP 7.2

  • Resolved doume

    (@doume)


    Hello,

    Seen with WP4.8.2 running on a PHP7.2.0RC5 server:
    PHP Deprecated: Function create_function() is deprecated in \…\wp-content\plugins\server-ip-memory-usage\server-ip-memory-usage.php on line 101

    List of the announced deprecaded functions in PHP7.2.0 here.

    D.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author apasionados

    (@apasionados)

    Hi there,

    There is a lot of work to do with our plugins to make them run in PHP 7.2. Right know we are aware of that. I don’t think we will be will have them tested and ready for 30th November when the final version is released, but it shouldn’t take us much more time.

    Best regards from Spain.

    Do you need help with that? I don’t think there is need for a dynamic function for the plugin initialization at all, but even that could be easily done via an anonymous function instead of the obsolete create_function. I’d love to contribute a PR on GitHub.

    Plugin Author apasionados

    (@apasionados)

    Hi @pputzer,

    It will take us some time to make our plugins run in PHP 7.2. Right now we don’t have them on GitHub, but it would be great if you could send us a patch by email to info AT apasionados . es and we will update the plugin.

    Best regards from Spain.

    Hi @apasionados!

    The patch is so trivial, I’ll post it right here:

    --- server-ip-memory-usage.php.orig	2017-05-26 12:48:56.646649000 +0200
    +++ server-ip-memory-usage.php	2017-12-10 19:41:54.857343000 +0100
    @@ -98,7 +98,9 @@
     
     	}
     
    -	add_action( 'plugins_loaded', create_function('', '$memory = new ip_address_memory_usage();') );
    +	add_action( 'plugins_loaded', function() { 
    +		$memory = new ip_address_memory_usage();
    +	} );
     }
     
     /**
    

    This fixes the plugin for now. The code should be refactored though to only create the plugin object on the admin side, but immediately. The initialization should be moved from the constructor to a separate method hooked to plugins_loaded.

    • This reply was modified 1 year, 4 months ago by  Peter Putzer.
    Plugin Author apasionados

    (@apasionados)

    Hi @pputzer,

    Thanks for the patch. We just uploaded version 2.1.0 with it.

    Next months we will be working on refactoring it to only create the plugin object on the admin side.

    Best regards from Spain.

    • This reply was modified 1 year, 3 months ago by  apasionados.

    Just downloaded it. Thanks!

    Fixed in V2.1.0. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘V2.0.3 : function create_function() is deprecated in PHP 7.2’ is closed to new replies.