Jump to content


Photo

Fatal error: Call to a member function read() on a non-object in


  • Please log in to reply
2 replies to this topic

#1 DrumDude

DrumDude
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 25 September 2006 - 04:17 PM

Hi,
I am totally new to PHP scripting but had to upgrade Apache and PHP because of security issues.
I upgraded from Apache 1.3.x and PHP 4.2.3 to Apache 2.0.54 and PHP 5.0.5.
I now get this error on my index.php page:
Fatal error: Call to a member function read() on a non-object on line 89.
Here is the code I will insert#89 so you know which line 89 is.
>
<?php

$fileHandle = fopen("dlconfig2.txt", "r");
while (!feof($fileHandle)) {

$aLine = fgets($fileHandle, 4096);
parse_str($aLine);


}
fclose($fileHandle);

for ($i = 0; $i < count($dropType); $i++) {
$typeToPrefix[$dropType[$i]] = $dropPrefix[$i];
}

$aDirectory = dir("");

#89 while ($anEntry = $aDirectory->read()) {

// Short cut because we know aDirectory only contains other directories.
if ($anEntry != "." && $anEntry!="..") {
$aDropDirectory = dir("");
$fileCount = 0;
while ($aDropEntry = $aDropDirectory->read()) {
if ((stristr($aDropEntry, ".html")))  {
// Count the files in the directory
$fileCount = $fileCount + 1;
}
}
$aDropDirectory.closedir();

$parts = explode("-", $anEntry);
if (count($parts) == 3) {

$buckets[$parts[0]][] = $anEntry;

$timePart = $parts[2];
$year = substr($timePart, 0, 4);
$month = substr($timePart, 4, 2);
$day = substr($timePart, 6, 2);
$hour = substr($timePart,8,2);
$minute = substr($timePart,10,2);
$timeStamp = mktime($hour, $minute, 0, $month, $day, $year);

$timeStamps[$anEntry] = date("D, j M Y H:i (O)", $timeStamp);

if ($timeStamp > $latestTimeStamp[$parts[0]]) {
$latestTimeStamp[$parts[0]] = $timeStamp;
$latestFile[$parts[0]] = $anEntry;
}
}
}
}

?>

Thanks for any help...


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 04:21 PM

You dont open any directory here....

$aDirectory = dir("");


#3 DrumDude

DrumDude
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 26 September 2006 - 03:35 PM

Thanks that was it.
Keep on drumming !




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users