ID:               33901
 User updated by:  richard dot quadling at bandvulc dot co dot uk
 Reported By:      richard dot quadling at bandvulc dot co dot uk
 Status:           Closed
 Bug Type:         SPL related
 Operating System: Windows XP SP2
 PHP Version:      5.0.4
 New Comment:

What was fixed? CVS for the ext/spl shows no changes.


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

[2005-07-28 16:30:04] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



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

[2005-07-28 13:04:54] richard dot quadling at bandvulc dot co dot uk

Description:
------------
I have a script which is using the nice new SPL
RecursiveDirectoryIterator.

The iterator is being asked to look at files which reside on another
computer which is accessed via a drive mapping.

In terms of permissions, I have full access to the mapping.

The webserver is running with my credentials. I am using Sambar Server
with php V5.0.4 ISAPI.

The script below gives a different response when using CLI and web (See
results below).

I do have 2 different php.ini files - php-cli.ini and php-isapi.ini

The only difference between them is html_errors is On for the ISAPI
version and Off for the CLI version and the phpmanual is NOT shown for
the CLI version.

I've tried using the full UNC path to the directory and this works in
both CLI and ISPAI mode. The line below works in both CLI and ISAPI
modes.

$objRDI = new RecursiveIteratorIterator(new
filterAutomatedEarnieIQBackup(new
RecursiveDirectoryIterator("\\\\BANDACCESS\\IQ Backup")));


Reproduce code:
---------------
<?php
abstract class RecursiveFilterIterator extends FilterIterator
implements RecursiveIterator
        {
        private $ref;

        function __construct(RecursiveIterator $it)
                {
                $this->ref = new ReflectionClass($this);
                parent::__construct($it);
                }

        function hasChildren()
                {
                return $this->getInnerIterator()->hasChildren();
                }

        function getChildren()
                {
                return
$this->ref->newInstance($this->getInnerIterator()->getChildren());
                }
        }

class filterAutomatedEarnieIQBackup extends RecursiveFilterIterator
        {
        function accept()
                {
                return $this->getInnerIterator()->isFile() &&
(strpos($this->getInnerIterator()->getFilename(),
'AutomatedEarnieIQBackup') !== False);
                }
        }

$objRDI = new RecursiveIteratorIterator(new
filterAutomatedEarnieIQBackup(new RecursiveDirectoryIterator("K:\\IQ
Backup")));
foreach($objRDI as $sPath => $sFile)
        {
        echo number_format(filesize($sPath)) . " {$sPath}<br />\n";
        }
?>

Expected result:
----------------
249,648,640 K:/IQ Backup/AutomatedEarnieIQBackup20050728101148<br />


Actual result:
--------------
Fatal error: Uncaught exception 'Exception' with message
'DirectoryIterator::__construct(K:/IQ Backup)
[function.--construct.html]: failed to open dir: Invalid argument' in
D:\Data\Web Sites\Quick Scripts\public_html\Test_SPL_Iterator.php:31
Stack trace: #0 D:\Data\Web Sites\Quick
Scripts\public_html\Test_SPL_Iterator.php(31):
RecursiveDirectoryIterator->__construct('K:/IQ Backup') #1 {main}
thrown in D:\Data\Web Sites\Quick
Scripts\public_html\Test_SPL_Iterator.php on line 31

Fatal error: Unknown: The inner constructor wasn't initialized with an
iterator instance in Unknown on line 0



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


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

Reply via email to