Running WAMP on Windows XP. PHP version 5.4.3
Here’s a curious problem. I’m trying out the directory iterator object. This code is in the html body, loaded as localhost/dirtest.php
[php]<?php
$rdir=“C:\Temp”;
foreach (new DirectoryIterator($rdir) as $fileInfo) {
if($fileInfo->isDot()) continue;
if ($fileInfo->isDir()) echo $fileInfo->getFilename() . "</br>";
}
?>[/php]
This works fine. If I change the path to “C:\Temp\ancyc” it works ok as well. If I try this “C:\Temp\encyc” I get this -
[font=trebuchet ms]Fatal error: Uncaught exception ‘UnexpectedValueException’ with message ‘DirectoryIterator::__construct(C:\Tempencyc,C:\Tempencyc): The system cannot find the file specified. (code: 2)’ in C:\wamp\www\dirtest.php on line 10[/font]
I have tried a variety of directory names. It seems that DirectoryIterator gets confused by the letter e, lower case only, and for some reason removes the backslash. Does anyone know why this happens?