ID:               27092
 Updated by:       [EMAIL PROTECTED]
 Reported By:      adam at trachtenberg dot com
-Status:           Open
+Status:           Assigned
-Bug Type:         Feature/Change Request
+Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5CVS-2004-01-29 (dev)
 Assigned To:      helly


Previous Comments:
------------------------------------------------------------------------

[2004-01-30 01:49:38] [EMAIL PROTECTED]

property $it is only in the examples since there is no other way to
implement that in userspace. Anyway i'll add something like that.

------------------------------------------------------------------------

[2004-01-29 20:41:22] adam at trachtenberg dot com

This also applies to RecursiveIteratorIterator.

------------------------------------------------------------------------

[2004-01-29 18:29:47] adam at trachtenberg dot com

Description:
------------
You cannot access, $it, the iterator passed into 
FilterIterator in a child class.

Reproduce code:
---------------
class DirectoryFilterDots extends FilterIterator implements
RecursiveIterator
{
        function __construct($path) {
                parent::__construct(new DirectoryIterator($path));
        }
        
        function accept() {
                return !$this->it->isDot();
        }
        
        function hasChildren() {
                return $this->it->hasChildren();
        }

        function getChildren() {
                return new DirectoryFilterDots($this->it->getPathname());
        }
        
        function key() {
                return $this->it->getPathname();
        }
}

$dir = new RecursiveIteratorIterator(new DirectoryFilterDots(
                new RecursiveDirectoryIterator($argv[1])), true);

foreach ($dir as $file) {
        print $file. "\n";
}

Expected result:
----------------
Class filters out dot files.

Actual result:
--------------
PHP Notice:  Undefined property:  
DirectoryFilterDots::$it in /Users/adam/Documents/php/
php5/dir.php on line 42
PHP Fatal error:  Call to a member function isDot() on a 
non-object in /Users/adam/Documents/php/php5/dir.php on 
line 42
/usr/local/cvs/php/php-src/main/streams/streams.c(371) : 
Stream of type 'dir' 0xad6f28 (path:(null)) was not 
closed
/usr/local/cvs/php/php-src/main/streams/streams.c(371) : 
Stream of type 'dir' 0xad65a0 (path:(null)) was not 
closed


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27092&edit=1

Reply via email to