[wp-trac] [WordPress Trac] #36184: Eternal loop under certain conditions

WordPress Trac noreply at wordpress.org
Mon Aug 21 15:01:42 UTC 2017


#36184: Eternal loop under certain conditions
----------------------------+------------------------------
 Reporter:  Mikk3lRo        |       Owner:
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  4.4.2
 Severity:  normal          |  Resolution:  invalid
 Keywords:  has-patch       |     Focuses:  performance
----------------------------+------------------------------
Changes (by tmuka):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 We ran into this issue migrating a site this week, and it is amazing how
 fast the apache error_log grows in size with only a single person testing
 the site.  While not a common issue, it is certainly a serious one! I can
 only imagine how fast this would completely kill my server if this were
 more than just a single user hitting the site for testing.

 Thanks @robertstaddon for the patch, it takes care of the error log growth
 issue.  I wonder why this patch hasn't been merged into core!?  Perhaps
 it's not optimal to do a filesystem permissions check on each call?  Any
 sort of "cheaper" sanity check could be good too, like the suggested
 adding
 {{{#!php
  <?php while ( '.' != $target_parent && ! is_dir( $target_parent )  &&
 $target_parent != '/'  ) {
 }}}
 (or course that's not cross platform compatible since on windows we'd need
 to check for  '\' instead of '/')
 Perhaps just adding an exit condition to prevent infinite loops when they
 are simply detected...

 {{{#!php
 <?php
 // We need to find the permissions of the parent folder that exists and
 inherit that.
 $target_parent = dirname( $target );
 $prev_target_parent = '';
 while ( '.' != $target_parent && $target_parent != $prev_target_parent &&
 ! is_dir( $target_parent ) ) {
     $target_parent = dirname( $target_parent );
     $prev_target_parent =  $target_parent;
 }

 }}}




 Now i'm trying to track down the actual cause.  The wp_options upload_path
 value is an empty string (which i think is correct).  There must be a
 plugin or theme doing something funky here.

 For other people searching for this issue, my error logs looked like this


 {{{
 [Mon Aug 21 10:07:46.705173 2017] [proxy_fcgi:error] [pid 6813] [client
 192.168.1.10:36156] AH01071: Got error 'ww/vhosts/example.com/:/tmp/) in
 /var/www/vhosts/example.com/httpdocs/wp-includes/functions.php on line
 1613\nPHP message: PHP Warning:  is_dir(): open_basedir restriction in
 effect. File(/) is not within the allowed path(s):
 (/var/www/vhosts/example.com/:/tmp/) in
 /var/www/vhosts/example.com/httpdocs/wp-includes/functions.php on line
 1613
 }}}

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


More information about the wp-trac mailing list