[wp-trac] [WordPress Trac] #64610: Direct filesystem chmod emits warnings even if the permissions already match

WordPress Trac noreply at wordpress.org
Fri Feb 6 17:18:39 UTC 2026


#64610: Direct filesystem chmod emits warnings even if the permissions already
match
--------------------------+-----------------------------
 Reporter:  redsweater    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When the WordPress Direct Filesystem is asked to change the permissions of
 a file that it doesn't own, php will emit warnings even if the permissions
 requested are already set on the file.

 This affects WordPress installations where the ownership of files in the
 WordPress directory are kept separate from the web process that runs
 WordPress.

 In this scenario, although WordPress may have every permission it needs or
 expects, thanks to a given file's permissions matching the implicit or
 explicit `FS_CHMOD_FILE` variable, it still complains because of the
 underlying lack of ownership.

 I discovered this issue when I noticed PHP warnings in my log stemming
 from the Automattic JetPack Protect plugin attempting to update its own IP
 Rules files. One way to reproduce this is by using WP-CLI in conjunction
 with the Jetpack Protect plugin:

 1. Create WordPress installation in which the owner of all files is not
 the web hosting user, but the web hosting user, for example www-data, has
 all the expected permissions (for example 0775).
 2. Install Jetpack Protect.
 3. Confirm the Jetpack Protect files, for example its ./wp-content
 /jetpack-waf/rules/allow-ip.php, have the expected matching permissions
 (for example 0775).
 4. Trigger the Jetpack Protect update rules cron task as the www-data
 user:

 sudo -u www-data WP_DB_PASSWORD=mypassword wp cron event run
 jetpack_waf_rules_update_cron

 Expected: that the cron rules would run without warnings.

 Actual: PHP warnings are emitted:


 {{{
 Warning: chmod(): Operation not permitted in .../wp-admin/includes/class-
 wp-filesystem-direct.php on line 173
 }}}

 I realize these are just warnings but for those administrators who like to
 keep a cleaning warning log, it would be nice to avoid emitting these
 spurious log lines. I have been noticing these on my WordPress
 installation for years but only finally got around to searching out the
 source of the issue today.

 I have a PR to submit as soon as this ticket is published.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64610>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list