#32135 closed defect (bug) (fixed)
wp_tempnam() recursive broken code
Reported by: | cloudware | Owned by: | dd32 |
---|---|---|---|
Milestone: | 4.2.2 | Priority: | normal |
Severity: | major | Version: | 4.2 |
Component: | Upgrade/Install | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
see [31936]
"If the folder is falsey, use it's (sic) parent directory name instead"
this self-calling function is broken when wordpress requires maintenance mode to be set... calling wp_tempnam("/.maintenance",""); recurses until PHP fatally runs out of memory.
Attachments (1)
Change History (11)
#2
@
9 years ago
- Component changed from General to Upgrade/Install
- Description modified (diff)
- Milestone changed from Awaiting Review to 4.2.2
#4
@
9 years ago
I have a concern with this patch - if the purpose of using a temporary name of '/.maintenance' is so WordPress can prevent access to a site under maintenance, then use of a continuously variable number instead surely isn't good.
Purely as an observation and admittedly not knowing of the inner workings, I don't know why a tempname function need to be so complex?
#5
@
9 years ago
if I'm using AddHandler php56-cgi .php /htaccess
this bug doesn't appear,
I know this is a work around but maybe it is helpfully
#7
@
9 years ago
This problem is very serious because it affects also Wordpress self updating, not only plugin/thema updating.
Wordpress's "wp_tempnam" function is not supposed that argument $filename is root directory and has no basename (such as "/.maintenance").
If $filename has no basename(extensions only), wp_tempname is called recursively to generate tempname based on the parent directory of $filename,
but parent of root directory("/") is also root("/"), so it causes infinite recursive calling.
Wordpress updater creates ".maintenance" file to the installed directory,
therefore this problem occurs when the following conditions.
. Updating via FTP (ftpsock or ftpext).
. Wordpress is installed at the root directory of FTP server (using chrooted account).
In this case, Wordpress updater calls function wp_tempnam('/.maintenance'), so it falls into infinite loop.
If Wordpress is installed at subdirectory of FTP home, or if updating via ssh or direct, this problem will not occur.
suggested by taka2 (https://ja.forums.wordpress.org/topic/150570)