Custom Admin Text issue, possibly due to PHP 5.5

I recently upgrade to PHP 5.5 and started have getting 502 errors on my server, which I've never had before. I turned on logging in an attempt to identify the issue. After a week of testing every time the 502 error occurred I noticed the same below log entries:

[26-May-2015 23:10:28 UTC] PHP Strict Standards:  Redefining already defined constructor for class Site_Wide_Text_Change in /nas/wp/www/server/wp-content/plugins/site-wide-text-change/site-wide-text-change.php on line 71
[26-May-2015 23:10:28 UTC] PHP Deprecated:  Assigning the return value of new by reference is deprecated in /nas/wp/www/server/wp-content/plugins/site-wide-text-change/site-wide-text-change.php on line 476

Any chance of getting these issues resolved in a plugin update?

Thanks!

  • Vinod Dalvi

    Hi Gabe,

    I hope you are well today and thanks for posting on the forum.

    You can resolve the shared warning/messages by editing the following Custom Admin Text plugin file as described below.

    Custom Admin Text plugin file:
    wp-content/plugins/site-wide-text-change/site-wide-text-change.php

    In the above file moved the PHP 4 constructor from line number 61 below the PHP 5 constructor as displayed below.

    /**
     * PHP 5 constructor
     **/
    function __construct() {
    	add_action('admin_init', array(&$this, 'add_admin_header_sitewide'));
    
    	add_action( 'admin_menu', array( &$this, 'admin_page' ) );
    	add_action( 'network_admin_menu', array( &$this, 'network_admin_page' ) );
    
    	add_filter('gettext', array(&$this, 'replace_text'), 10, 3);
    
    	add_action( 'plugins_loaded', array(&$this, 'load_textdomain'));
    
    	if( defined('SWTC-BELTANDBRACES') ) {
    		add_action('init', array(&$this, 'start_cache'), 1);
    		add_action('admin_print_footer_scripts', array(&$this, 'end_cache'), 999);
    	}
    
    }
    
    /**
     * PHP 4 constructor
     **/
    function Site_Wide_Text_Change() {
    	$this->__construct();
    }

    Then in the same file on line number 476 change the code as displayed below.

    Before Editing:

    $swtc =& new Site_Wide_Text_Change();

    After Editing:

    $swtc = new Site_Wide_Text_Change();

    Alternatively you can directly use the attached modified file site-wide-text-change.php and replace it with your Custom Admin Text plugin file.

    I have notified this to the plugin developer and this fixes will be implemented in the future version of plugin.

    Best Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.