• andiv88

    (@andiv88)


    Hi,

    Have some php errors in iThemes Security 5.3.7 but already fixed it in CORE. It would be cool if you add fixes in next release.

    See below

    PHP Error

    Warning mkdir() [function.mkdir]: File exists

    Location wp-content/plugins/better-wp-security/core/class-itsec-files.php:331

    Call Stack

    mkdir()
    wp-content/plugins/better-wp-security/core/class-itsec-files.php:331
    ITSEC_Files->get_file_lock()
    wp-content/plugins/better-wp-security/core/modules/file-change/class-itsec-file-change.php:169
    ITSEC_File_Change->execute_file_check()
    Unknown location
    do_action(‘init’)
    wp-settings.php:392

    SOLUTION
    // add a check whether directory is already exists before making new directory at wp-content/plugins/better-wp-security/core/class-itsec-files.php:331

    if ( ! @is_dir( $lock_file ) ) {
    
    			@mkdir( $lock_file );
    		}
    		else {
    		// if ( false === @mkdir( $lock_file ) ) {
    
    			if ( false !== $dir_age ) {
    
    				if ( ( time() - $dir_age ) > intval( $exp ) ) { //see if the lock has expired
    
    					@rmdir( $lock_file );
    					@mkdir( $lock_file );
    
    				} else { //couldn't get the lock
    
    					return false;
    
    				}
    
    			} else {
    
    				return false;
    
    			}
    
    		}

    Andrey

    https://wordpress.org/plugins/better-wp-security/

Viewing 5 replies - 1 through 5 (of 5 total)
  • dwinden

    (@dwinden)

    @andiv88

    Where is that PHP error displayed (in the browser or somewhere in a log file) and what PHP version are you using ?

    I wonder why you get a PHP Warning when the mkdir() command is prepended with a @ ?

    dwinden

    Thread Starter andiv88

    (@andiv88)

    @dwinden

    Warning showed in Query Monitor plugin 2.10.0 which displays errors in wp admin pannel. I think that in log will be the same error if warning level is activated php config. PHP version is 5.3

    dwinden

    (@dwinden)

    @andiv88

    Thank you for that clarification.

    After reading about the Query Monitor plugin in your last post I remembered having seen something similar recently so I went back in the forum history and found this fairly recent topic.

    Please ignore my comments in that topic. I now have a better understanding of what is happening than at the time of me posting in that topic.

    I guess there is no harm in PHP warnings being displayed in the Query Monitor plugin only and nowhere else.
    I don’t think the warning level activated in php config will overrule the @ prepending … but I might be wrong.

    In any case this has absolutely no impact whatsoever on the functioning of the iTSec plugin. Just a minor cosmetic thing.

    dwinden

    Thread Starter andiv88

    (@andiv88)

    @dwinden

    Sure, agree with you. It just UX matter for those who use Query Monitor plugin as it shows red caution at the top of admin pannel.

    Thanks

    dwinden

    (@dwinden)

    @andiv88

    Exactly.

    Would it be possible to include a link to a screenshot which shows that Query Monitor plugin red caution ?

    dwinden

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Error mkdir() with fix’ is closed to new replies.