• On lines 160 and 161 of file s2member-secure-file-browser/class/psk_s2msfb.class.php, there are instances of create_function which has been deprecated in PHP 7.2. This can be addressed by changing these lines:

    add_action( ‘widgets_init’ , create_function( ” , ‘register_widget( “‘ . PSK_S2MSFB_WIDGET_DOWNLOAD_ID . ‘” );’ ) );
    add_action( ‘widgets_init’ , create_function( ” , ‘register_widget( “‘ . PSK_S2MSFB_WIDGET_FILES_ID . ‘” );’ ) );

    to these:

    add_action( ‘widgets_init’ , function() {
    register_widget( PSK_S2MSFB_WIDGET_DOWNLOAD_ID );
    } );
    add_action( ‘widgets_init’ , function() {
    register_widget( PSK_S2MSFB_WIDGET_FILES_ID );
    } );

Viewing 1 replies (of 1 total)
  • Thread Starter KTS915

    (@kts915)

    There are also a couple of uses of create_function in a code block beginning on line 47 of s2member-secure-file-browser/s2member-secure-file-browser.php, so that these lines:

    
    	if ( ! version_compare( PHP_VERSION , PSK_S2MSFB_MIN_PHP_VERSION , ">=" ) ) {
    		add_action( "all_admin_notices" , create_function( '' , 'echo \'<div class="error fade"><p>You need PHP v\' . PSK_S2MSFB_MIN_PHP_VERSION . \'+ to use \' . PSK_S2MSFB_NAME . \'.</p></div>\';' ) );
    	} else if ( ! version_compare( get_bloginfo( "version" ) , PSK_S2MSFB_MIN_WP_VERSION , ">=" ) ) {
    		add_action( "all_admin_notices" , create_function( '' , 'echo \'<div class="error fade"><p>You need WordPress? v\' . PSK_S2MSFB_MIN_WP_VERSION . \'+ to use \' . PSK_S2MSFB_NAME . \'.</p></div>\';' ) );
    	} else {
    

    should be changed to these:

    
    	if ( ! version_compare( PHP_VERSION , PSK_S2MSFB_MIN_PHP_VERSION , ">=" ) ) {
    		add_action( "all_admin_notices" , function() {
    			echo '<div class="error fade"><p>You need PHP v' . PSK_S2MSFB_MIN_PHP_VERSION . '+ to use ' . PSK_S2MSFB_NAME . '.</p></div>';
    		} );
    	} else if ( ! version_compare( get_bloginfo( "version" ) , PSK_S2MSFB_MIN_WP_VERSION , ">=" ) ) {
    		add_action( "all_admin_notices" , function() {
    			echo '<div class="error fade"><p>You need WordPress? v' . PSK_S2MSFB_MIN_WP_VERSION . '+ to use ' . PSK_S2MSFB_NAME . '.</p></div>';
    		} );
    	} else {
    
Viewing 1 replies (of 1 total)
  • The topic ‘Fix for create_function depracated in PHP 7.2’ is closed to new replies.