[wp-trac] [WordPress Trac] #42265: get_filesystem_method() isn't unique enough

WordPress Trac noreply at wordpress.org
Thu Oct 19 17:59:39 UTC 2017


#42265: get_filesystem_method() isn't unique enough
----------------------------+------------------------------------------
 Reporter:  bikecrazyy      |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  2.5
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  administration, performance
----------------------------+------------------------------------------

Comment (by jrchamp):

 Replying to [comment:4 bikecrazyy]:
 > Makes sense, I changed it on my server to microtime(true) to give it a
 try. After a little load testing, the results were better and less errors
 were thrown, but there were still file access issues. See error log below.

 The uniqueness difference between `microtime(true)` and `uniqid()` is
 governed by the `precision` configuration value. You should be able to use
 `ini_set('precision', 16);` to achieve the same behavior.

 To avoid that complexity, I agree that `uniqid()` is easier to use and
 often sufficient:

 '''Example''':
 {{{#!php
 <?php
     $temp_file_name = $context . 'temp-write-test-' . uniqid();
 }}}

 If `uniqid()`'s default behavior is not sufficient, you could enable the
 `more_entropy` optional parameter:

 '''Example''':
 {{{#!php
 <?php
     $temp_file_name = $context . 'temp-write-test-' . uniqid('', true);
 }}}

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


More information about the wp-trac mailing list