[wp-trac] [WordPress Trac] #36184: Eternal loop under certain conditions
WordPress Trac
noreply at wordpress.org
Wed Mar 9 16:42:15 UTC 2016
#36184: Eternal loop under certain conditions
-------------------------+-----------------------------
Reporter: Mikk3lRo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.4.2
Severity: normal | Keywords:
Focuses: performance |
-------------------------+-----------------------------
I've run into this quite a few times now, and often it puts a massive
strain on the server and very rapidly fills the error log if logging is
enabled.
An very tight eternal loop in wp_mkdir_p() - wp-includes/functions.php
line 1556 to 1613 - can be triggered if a path in the database is wrong.
5 lines from line 1583 read:
{{{#!php
// We need to find the permissions of the parent folder that exists and
inherit that.
$target_parent = dirname( $target );
while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
$target_parent = dirname( $target_parent );
}
}}}
I move wordpress installs around between servers and / or folders quite
often, and sometimes an old (and now invalid) upload_path in the DB will
cause this to loop forever. Obviously the mistake is mine for not
correcting the path up front, but an eternal loop that may write to the
error-log on each iteration (if open_basedir is active, possibly under
other circumstances too) is not a very graceful way to fail... on a shared
host (where you may not have the control I do) it could be pretty
catastrophic.
I'm not sure if other conditions are needed to trigger it, but I've only
ever seen it when the upload path is wrong... seeing as it won't be
triggered unless the path is wrong an easy solution would be to just check
if '/' has been reached and throw an error pointing towards the
solution...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36184>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list