From:             richard dot quadling at bandvulc dot co dot uk
Operating system: Windows XP SP2
PHP version:      5.0.4
PHP Bug Type:     SPL related
Bug description:  RecursiveDirectoryIterator gives different response depending 
on CLI or ISAPI

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 bug report at http://bugs.php.net/?id=33901&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33901&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33901&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33901&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33901&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33901&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33901&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33901&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33901&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33901&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33901&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33901&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33901&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33901&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33901&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33901&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33901&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33901&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33901&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33901&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33901&r=mysqlcfg

Reply via email to