WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #36184, comment 5


Ignore:
Timestamp:
08/21/2017 03:09:33 PM (4 years ago)
Author:
tmuka
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36184, comment 5

    v1 v2  
    1212// We need to find the permissions of the parent folder that exists and inherit that.
    1313$target_parent = dirname( $target );
    14 $prev_target_parent = '';
    15 while ( '.' != $target_parent && $target_parent != $prev_target_parent && ! is_dir( $target_parent ) ) {
    16     $prev_target_parent =  $target_parent;
    17     $target_parent = dirname( $target_parent );
    18 }
     14     $target_parent = dirname( $target );
     15     $prev_target_parent = '';
     16        while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
     17            $prev_target_parent =  $target_parent;
     18            $target_parent = dirname( $target_parent );
     19            if($target_parent != $prev_target_parent) {
     20                error_log('infinite loop issue detected with finding parent folder');
     21                break;
     22            }
     23        }
    1924
    2025}}}