IteratorIteratorIteratorIterator iterated iteration fix. To understand iteration, you first need to understand recursion and iteration and iteration and iteration and iteration.

This commit is contained in:
Garvin Hicking 2017-04-08 17:38:47 +02:00
parent b8897b3250
commit 7832c364d7
3 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,8 @@
Version 2.1-rc2 | final ()
------------------------------------------------------------------------
* Some more PHP7 error catching
* Fix missing token when updating plugin
* Fix missing variable name in regular expression match, Issue #442

View File

@ -1161,7 +1161,7 @@ function serendipity_smarty_purge() {
serendipity_smarty_init(); # need initiated smarty to get the compile/cache dir
$dir = new RecursiveDirectoryIterator($serendipity['smarty']->getCompileDir());
$ite = new RecursiveIteratorIterator($dir);
$ite = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
$files = new RegexIterator($ite, '@.*\.tpl\.php$@', RegexIterator::GET_MATCH);
foreach($files as $file) {
if (is_writable($file[0])) {

View File

@ -334,7 +334,7 @@ function serendipity_removeDeadFiles_SPL($dir=null, $deadfiles=null, $purgedir=n
} catch (Exception $e) {
return;
}
$iterator = new RecursiveIteratorIterator($_dir, RecursiveIteratorIterator::CHILD_FIRST);
$iterator = new RecursiveIteratorIterator($_dir, RecursiveIteratorIterator::CHILD_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
$search = array("\\", '//');
$replace = array('/');
foreach ($iterator as $file) {