473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Why is my class throwing warnings?

162 100+
Why is this code throwing the following errors? Thanks.

Expand|Select|Wrap|Line Numbers
  1. <?
  2. class DirTree {
  3.  
  4.     /**
  5.      * Get a tree of folders and files from a spec dir
  6.      * @returns An ArrayCollection of Tree
  7.      */
  8.     function DirTree($dir_tree) {
  9.         $_tree = $this->parse_dir($dir_tree);
  10.         return $_tree;
  11.     }
  12.  
  13.     /**
  14.      * Get a tree of folders and files from a spec dir
  15.      * @returns An Array of Tree
  16.      */
  17.     function parse_dir($folder) {
  18.  
  19.         $dir                = @opendir($folder);
  20.         $filecount          = 0;
  21.         $foldercount        = 0;
  22.         $tree                = array();
  23.         $limb                = array();
  24.         $cnt                = 0;
  25.  
  26.         while(false != ($item = @readdir($dir))) {
  27.  
  28.             if($item == "." || $item == "..") continue;
  29.  
  30.             if(is_dir("$folder/$item")){
  31.  
  32.                 $tmpTree = new DirTree();
  33.  
  34.                 $limb['sub_folder'][]['folder_name'] = $item;
  35.                 $limb['sub_folder'][] = $tmpTree->parse_dir("$folder/$item");
  36.  
  37.                 $foldercount++;
  38.                 $limb['folders'][] = $foldercount;
  39.  
  40.                 $filecount++;
  41.                 $limb['files'][] = $filecount;
  42.                 //continue;
  43.  
  44.             }else{
  45.  
  46.                 $limb['file_name'][] = $item;
  47.  
  48.             }
  49.         }
  50.  
  51.         $tree[] = $limb;
  52.         $cnt++;
  53.         return $tree;
  54.  
  55.     }
  56. }
  57.  
  58. $class = new DirTree();
  59.  
  60. /* view array  */
  61. echo "<pre>";
  62. print_r($class->DirTree("../../core/amf/app"));
  63. echo "</pre>*****************************************************************";
  64. ?>
  65.  
Warning: Missing argument 1 for DirTree::DirTree() in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 9

Warning: Missing argument 1 for DirTree::DirTree() in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 9

Warning: Missing argument 1 for DirTree::DirTree() in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 9

Warning: Missing argument 1 for DirTree::DirTree() in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 9

Warning: Missing argument 1 for DirTree::DirTree() in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad\htdocs\flashservices_v1.9\services \folder_tree\dir_tree2.php on line 9
Jun 5 '07 #1
1 1112
epots9
1,351 Expert 1GB
wel your main problem is that your calling DirTree() instead of DirTree(somthing).

your DirTree takes one arg but your giving it nothing so when it try to run it can't find a no-arg version of DirTree so it complains.

on line 58 is where your error starts
[PHP]$class = new DirTree();[/PHP]
Jun 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Gert Van den Eynde | last post by:
Hi all, I'm struggling a bit with Functors generated for an ABC. This is the functor code: class Functor{ public: virtual double operator(double x)=0 }
3
by: Pierre Espenan | last post by:
A have a long integer class. The built integer type within a conditional statement returns bool false for int i=0 and bool true for any other non zero value. I want my long integer class to have...
822
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical...
2
by: gg | last post by:
I am facing some problems with following program. I am using aCC version 03.27 on HP-UX11. The command line I use to compile is - aCC -AA -I. TestTempMethods.C Can anybody pls suggest how to...
6
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows...
5
by: johnbrown105 | last post by:
Hello All, I did try searching the archives, but the topics seemed to be mostly about base and derived classes. I have reached Chapter 8 in Bruce Eckel's "Thinking in C++ 2nd Edition Vol....
1
by: john | last post by:
On Sep 15, 4:50 pm, john <j...@no.spamwrote: To be more precise it is mentioned in TC++PL3,on page 624: "Code that needs to be executed first (the "prefix code") - such as flushing a tied...
22
by: phil.pellouchoud | last post by:
I did some searching online and i couldn't find anything in reference to this. I am using MinGW, gcc 4.3 and am having the following compilation issue: class CFoo { public: ...
37
by: Phlip | last post by:
1230987za wrote: Kanze is a classically-trained "unit tester". In some circles "unit" is a QA concept - specifically, if a test fails, you only need to inspect one unit. So "units" are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.