[wp-trac] [WordPress Trac] #65150: Issue with copy_dir() function t does not skips folders.

WordPress Trac noreply at wordpress.org
Wed Apr 29 08:39:02 UTC 2026


#65150: Issue with copy_dir() function  t does not skips folders.
----------------------------+------------------------------
 Reporter:  neo2k23         |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by neo2k23):

 This code does not skip folders whic is part of the current copy_dir()
 function.


 {{{
         foreach ( (array) $dirlist as $filename => $fileinfo ) {
                 if ( in_array( $filename, $skip_list, true ) ) {
                         continue;
                 }
 }}}


 if i change it to this it works again


 {{{
         $skip_regex = '';
         foreach ( (array)$skip_list as $key => $skip_file )
                 $skip_regex .= preg_quote($skip_file, '!') . '|';

         if ( !empty($skip_regex) )
                 $skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i';

         foreach ( (array) $dirlist as $filename => $fileinfo ) {
                 if ( !empty($skip_regex) )
                         if ( preg_match($skip_regex, $from . $filename) )
                                 continue;
 }}}

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


More information about the wp-trac mailing list