[wp-trac] [WordPress Trac] #31767: insert_with_markers() is not atomic, leading to corrupted .htaccess updates under race conditions

WordPress Trac noreply at wordpress.org
Mon Jun 15 05:00:38 UTC 2015


#31767: insert_with_markers() is not atomic, leading to corrupted .htaccess updates
under race conditions
----------------------------+------------------------------
 Reporter:  tigertech       |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  4.1.1
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------------

Comment (by dd32):

 I think it'd be safer to simply use `flock()` and/or `file_put_contents()`
 with `LOCK_EX` specified.

 Some filesystems won't support locking, but this would cover a bunch of
 them.
 Really, no system should be writing to the `.htaccess` file often, if
 there's a plugin which modifies the rules regularly (especially often
 enough to cause corruption at present) I think it should be considered a
 bug report for that plugin..

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31767#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list