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

WordPress Trac noreply at wordpress.org
Thu Oct 19 15:25:35 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 bikecrazyy):

 > I think what @pross is saying is that `uniqid()` uses `microtime()`
 internally, so rather than append `uniqid()` to `time()`, it makes more
 sense to remove the redundant `time()` and to instead use either
 `microtime(true)` or `uniqid()`. The primary difference between the two
 options is whether you prefer a decimal or hex string.

 '''@jrchamp''':
 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.

 '''php_error_log''':
 [[Image(https://cdn.pbrd.co/images/GPFqeD2.jpg)]]=

 '''Tested Code''':
 {{{#!php
 <?php
       $temp_file_name = $context . 'temp-write-test-' . microtime(true);
 }}}

 When I use time() and uniqid() I don't see anything in the error log.
 Maybe since I used both time() and uniqid() enough cpu cycles have gone
 by?

 '''NOTE''':
 I'm using the latest version of wordpress and PHP. I'm running php using
 fast-cgi via IIS on windows. This might have nothing to do with it or
 maybe something to do with it but when you use PHP with IIS you have to
 use the "Non-Thread Safe (NTS) versions of PHP."

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


More information about the wp-trac mailing list