[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
Fri Oct 2 19:15:24 UTC 2015


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

Comment (by kevinatelement):

 I noticed that in this changeset, the fopen call lost the leading @.
 fopen will throw an E_WARNING when the fopen fails, so I expect it might
 be desired to keep it as @fopen.

 I also wonder if it would be best practice to call fflush($fp) before
 flock( $fp, LOCK_UN )

 And finally, I wonder if it wouldn't be best to wait until right before
 the fseek( $fp, 0 ) to make the blocking flock( $fp, LOCK_EX ) call.
 Isn't it a best practice to hold a blocking lock for the minimum amount of
 time you can?

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


More information about the wp-trac mailing list