• Resolved billyrobertsgws

    (@billyrobertsgws)


    WP: Current version: 6.4.2
    Content Control: Current version: 2.1.0

    Throwing a PHP error: Warning: chmod(): Operation not permitted in /home/190491.cloudwaysapps.com/xaykdbmuyu/public_html/wp-admin/includes/class-wp-filesystem-direct.php on line 173

    this is the code that is causing the conflict with the plugin:

    /** * Changes filesystem permissions. * * @since 2.5.0 * * @param string $file Path to the file. * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, * 0755 for directories. Default false. * @param bool $recursive Optional. If set to true, changes file permissions recursively. * Default false. * @return bool True on success, false on failure. */ public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( ! $recursive || ! $this->is_dir( $file ) ) { return chmod( $file, $mode ); } // Is a directory, and we want recursive. $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . $filename, $mode, $recursive ); } return true; }

    specifically the return statement here: if ( ! $recursive || ! $this->is_dir( $file ) ) { return chmod( $file, $mode ); }

    I’ve spoken with Cloudways (my hosting server) and there isn’t a file permission error. It seems to be related to the Content Control plugin – when I disable the plugin it goes away, when I enable it, the error returns. This error is only thrown when a user is logged in.

    Thanks for looking into this.

Viewing 1 replies (of 1 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @billyrobertsgws – Sorry to here that, had typed up a much longer more thourough response but lost it due to accidental refresh, so here is the short version.

    We use Cloudways as well, and haven’t seen any issues, nor have there been any similar issues reported, so I’m gonna rule out hosting or actual file permission issues in our code on its own.

    Couple of questions to help narrow what code of ours is having an issue:

    • Have you entered a CC Pro license key?
    • Do these errors happen every page load, or are they occurring during on of our data upgrade processes?

    If no key & not during upgrade process, it indicates our logs are attempting to write data, this on its own shouldn’t be a problem as its doing so in existing folders that don’t need permissions generally.

    If its logging does adding the following make it stop?
    define( 'CONTENT_CONTROL_DISABLE_LOGGING', true );

    There are only 3 places in our plugin that can write files at all. And the questions above should determine which it is.

    In any case I’d assume due to lack of other reports that the issue is being caused due to a conflict with another plugin, theme or custom code, so next would be narrowing that down using the Health Check & Troubleshooting plugin’s Troubleshooting mode on our plugin alone.

    You should install the Twenty-Twenty-Three theme as well before using troubleshooting mode for best results.

    Retest, if the issue is no longer present its not from our plugin (alone at least).

    1. Enable a few more plugins in troubleshooting mode
    2. retest, repeat until you see the issue again.
    3. disable the last few plugins one by one until it clears up again.
    4. The last on disabled is the culprit we need to look at.
    5. If no plugins cause the issue, activate your normal theme (top toolbar).
    6. Retest.

    If you still don’t see the issue, you likely have custom code in an mu-plugin or parent theme etc that is causing trouble.

    Let us know what you find.

Viewing 1 replies (of 1 total)
  • The topic ‘File Permission: PHP Error version 2.1.0’ is closed to new replies.