[wp-trac] [WordPress Trac] #6531: Recursively search for files in theme and plugin editors

WordPress Trac noreply at wordpress.org
Thu Oct 5 06:20:37 UTC 2017


#6531: Recursively search for files in theme and plugin editors
-------------------------------------------------+-------------------------
 Reporter:  torbens                              |       Owner:
     Type:  defect (bug)                         |  WraithKenny
 Priority:  high                                 |      Status:  reviewing
Component:  Themes                               |   Milestone:  4.9
 Severity:  minor                                |     Version:  2.5
 Keywords:  theme-editor has-patch has-unit-     |  Resolution:
  tests                                          |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------

Comment (by schlessera):

 I tried several permutations now to transform the iterator into an array
 to stay safe and not try to serialize the actual iterator object, but the
 `RecursiveFilterIterator` seems buggy in its PHP 5.2 incarnation.

 Normally, with PHP 5.4+, you'd use a `CallbackFilterIterator`, but with
 PHP 5.2, you have to create a custom class instead, which will need a
 second constructor argument to inject the options. And whatever
 combinations I have tried, the conversion to an array always created new
 instances of that filter and omitted the second argument to the
 constructor.

 Without the filter, it is not possible to filter folders, only files, so
 it would not be possible to exclude folders such a `node_modules`. This is
 a show-stopper for using iterators in this case.

 I suggest going with the recursive function for now, and re-investigate
 using iterators when WordPress Core uses PHP 5.4 as a minimum (hopefully
 next year, then ;) ).

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


More information about the wp-trac mailing list