[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/finder/Iterator/ -> FilterIterator.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Finder\Iterator;
  13  
  14  /**
  15   * This iterator just overrides the rewind method in order to correct a PHP bug,
  16   * which existed before version 5.5.23/5.6.7.
  17   *
  18   * @see https://bugs.php.net/68557
  19   *
  20   * @author Alex Bogomazov
  21   *
  22   * @deprecated since 3.4, to be removed in 4.0.
  23   */
  24  abstract class FilterIterator extends \FilterIterator
  25  {
  26      /**
  27       * This is a workaround for the problem with \FilterIterator leaving inner \FilesystemIterator in wrong state after
  28       * rewind in some cases.
  29       *
  30       * @see FilterIterator::rewind()
  31       */
  32      public function rewind()
  33      {
  34          if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  35              parent::rewind();
  36  
  37              return;
  38          }
  39  
  40          $iterator = $this;
  41          while ($iterator instanceof \OuterIterator) {
  42              $innerIterator = $iterator->getInnerIterator();
  43  
  44              if ($innerIterator instanceof RecursiveDirectoryIterator) {
  45                  // this condition is necessary for iterators to work properly with non-local filesystems like ftp
  46                  if ($innerIterator->isRewindable()) {
  47                      $innerIterator->next();
  48                      $innerIterator->rewind();
  49                  }
  50              } elseif ($innerIterator instanceof \FilesystemIterator) {
  51                  $innerIterator->next();
  52                  $innerIterator->rewind();
  53              }
  54  
  55              $iterator = $innerIterator;
  56          }
  57  
  58          parent::rewind();
  59      }
  60  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1