In the function below, before I open the directory I first test to
make sure the address I have is, in fact, a directory. This function
was working fine on one web server running FreeBSD and PHP 4.06.
However, today I'm trying to run this software on a new server (RH
Linux 9, PHP 4.2.3) and the directory is failing the is_dir() test.
The error message that I have in my code is printing out this error:
In getListOfAnyDir ectory(), we expected the function to be handed an
address to a directory, but instead we were given this:
ppArrangementsP ublic/.
Now, ppArrangementsP ublic/ looks like a directory to me. So why is it
failing the test?
function getListOfAnyDir ectory($address =false) {
// 03-17-04 - this function should be given an address to a folder.
$controllerForA ll = & getController() ;
$resultsObject = & $controllerForA ll->getObject("McR esults", " in
getListOfAnyDir ectory().");
$theDirFilesArr ay = array() ;
$address2 = str_replace("/", "", $address);
if (is_dir($addres s) || is_dir($address 2)) {
// open the directory and load all the files into an array
$theDir = @ opendir($addres s);
if ($theDir) {
// We go through the array one element at a time, putting it into a
new array, minus invisible files
//marked by "." and ".."
while ($theDirFiles = readdir ($theDir)) {
if ($theDirFiles != "." && $theDirFiles != "..") {
$theDirFilesArr ay[] = $theDirFiles ;
}
}
closedir ($theDir) ;
return $theDirFilesArr ay;
} else {
$resultsObject->error("In getListOfAnyDir ectory(), we tried to open
the directory at the address $address, but for some reason it didn't
open.", "getListOfAnyDi rectory");
}
} else {
$resultsObject->error("In getListOfAnyDir ectory(), we expected the
function to be handed an address to a directory, but instead we were
given this: $address.", "getListOfAnyDi rectory");
}
}
make sure the address I have is, in fact, a directory. This function
was working fine on one web server running FreeBSD and PHP 4.06.
However, today I'm trying to run this software on a new server (RH
Linux 9, PHP 4.2.3) and the directory is failing the is_dir() test.
The error message that I have in my code is printing out this error:
In getListOfAnyDir ectory(), we expected the function to be handed an
address to a directory, but instead we were given this:
ppArrangementsP ublic/.
Now, ppArrangementsP ublic/ looks like a directory to me. So why is it
failing the test?
function getListOfAnyDir ectory($address =false) {
// 03-17-04 - this function should be given an address to a folder.
$controllerForA ll = & getController() ;
$resultsObject = & $controllerForA ll->getObject("McR esults", " in
getListOfAnyDir ectory().");
$theDirFilesArr ay = array() ;
$address2 = str_replace("/", "", $address);
if (is_dir($addres s) || is_dir($address 2)) {
// open the directory and load all the files into an array
$theDir = @ opendir($addres s);
if ($theDir) {
// We go through the array one element at a time, putting it into a
new array, minus invisible files
//marked by "." and ".."
while ($theDirFiles = readdir ($theDir)) {
if ($theDirFiles != "." && $theDirFiles != "..") {
$theDirFilesArr ay[] = $theDirFiles ;
}
}
closedir ($theDir) ;
return $theDirFilesArr ay;
} else {
$resultsObject->error("In getListOfAnyDir ectory(), we tried to open
the directory at the address $address, but for some reason it didn't
open.", "getListOfAnyDi rectory");
}
} else {
$resultsObject->error("In getListOfAnyDir ectory(), we expected the
function to be handed an address to a directory, but instead we were
given this: $address.", "getListOfAnyDi rectory");
}
}
Comment