• Resolved lhungil

    (@lhungil)


    Background
    WordPress internally uses the constant WP_PLUGIN_DIR to refer to the directory containing installed directories.

    Affected Sites
    All WordPress installations where the plugin directory has been specified as something other than the WordPress default of “WP_CONTENT_DIR/plugins/” and WordFence is installed (verified against WordFence version 5.3.6).

    Symptoms
    When WordPress sends out an alert email regarding an available plugin upgrade, the email does not contain the name of the plugin and instead displays: The Plugin "" needs an upgrade..

    Potential Fix
    Edit “/wordfence/lib/wfUtils.php” starting around line 104. Replace:

    public static function getPluginBaseDir(){
    		return WP_CONTENT_DIR . '/plugins/';
    		//return ABSPATH . 'wp-content/plugins/';
    	}

    With:

    public static function getPluginBaseDir(){
    		if(defined('WP_PLUGIN_DIR')) {
    			return wp_normalize_path(WP_PLUGIN_DIR . '/');
    		}
    		return wp_normalize_path(WP_CONTENT_DIR . '/plugins/');
    		//return ABSPATH . 'wp-content/plugins/';
    	}

    https://www.ads-software.com/plugins/wordfence/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hi,

    Thanks for this. I have sent this suggestion over to the dev team to evaluate. We appreciate the help! I’ll mark this resolved for now.

    tim

    FB687

    Download lastest version and let me know if it happens again.

    tim

    Justin Norton

    (@designerbydesign)

    You have deployed a release of Wordfence that contains wp_normalize_path() – this function is not supported on WordPress versions below 3.9. The result is a fatal error on affected sites. Please fix this issue ASAP as I imagine lots of sites are now broken due to auto updates.

    Justin Norton

    (@designerbydesign)

    I have patched affected sites using this:

    public static function getPluginBaseDir(){
    		if(function_exists('wp_normalize_path')){
    			if(defined('WP_PLUGIN_DIR')) {
    				return wp_normalize_path(WP_PLUGIN_DIR . '/');
    			}
    			return wp_normalize_path(WP_CONTENT_DIR . '/plugins/');
    		} else {
    			return WP_PLUGIN_DIR . '/';
    		}
    	}

    Entered in our system for remediation. Thanks for the code fix.

    tim

    FB690

    @desinerbydesign Did you add that to our plugin or to the functions.php file?

    tim

    Justin Norton

    (@designerbydesign)

    The plugin file /lib/wfUtils.php, Line 104

    Cheers Justin

    Thanks Justin!

    tim

    Hi,

    Even I have this same issue. My client’s site went blank this morning. When I checked the error log, i got this:

    [20-Mar-2015 08:46:02 UTC] PHP Fatal error: Call to undefined function wp_normalize_path() in /home/theme/public_html/wp-content/plugins/wordfence/lib/wfUtils.php on line 106

    I copied the code given by lhungil. But still I have the issue. when I active the plugin, site goes blank again.

    Please help,
    Shiran

    The workaround suggested by the customer caused a few errors. Please revert your WF version to 5.3.6, available here:
    https://www.ads-software.com/plugins/wordfence/developers/

    tim

    I deleted the one that I had and reinstalled from the plugin add new.
    That should install the latest right? for that version i went from ftp and edited the wfUtils.php file.

    Still has the issue.

    i’m sorry.

    read your mail properly this time ??

    Cheers!
    Shiran

    @all,

    We just released a new version to address this. Please update and let me know if this fixes your issue.

    tim

    Justin Norton

    (@designerbydesign)

    Thanks for the fix Tim – much appreciated. As this issue has cured the bug for versions below WP 3.9 could you update the minimum WP version entry in the plugin readme.txt? Or is the release only tested against 3.9 and above?

    No, just going forward we are only supporting the version 3.9 and above. As much as we’d love to be able to support the older versions, its just not feasible, especially when we want to try to keep providing new features and functionality, and offer consistent support levels.

    Thanks for helping track this issue down.

    tim

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘WP_PLUGIN_DIR is not utilized by WordFence’ is closed to new replies.