473,748 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is my class throwing warnings?

162 New Member
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::DirTre e() in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 9

Warning: Missing argument 1 for DirTree::DirTre e() in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 9

Warning: Missing argument 1 for DirTree::DirTre e() in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 9

Warning: Missing argument 1 for DirTree::DirTre e() in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 9

Warning: Missing argument 1 for DirTree::DirTre e() in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 8

Notice: Undefined variable: dir_tree in C:\apache2triad \htdocs\flashse rvices_v1.9\ser vices\folder_tr ee\dir_tree2.ph p on line 9
Jun 5 '07 #1
1 1133
epots9
1,351 Recognized Expert Top Contributor
wel your main problem is that your calling DirTree() instead of DirTree(somthin g).

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
5927
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
2612
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 similar behavior. My class looks like this: #ifndef long_int_H #define long_int_H #include <string> using namespace std; typedef valarray<complex<double> > VCD;
822
29621
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 real-time applications. The majority of expert/people recommend Ada for safety critical real-time applications. I've many years of experience in C/C++ (and Delphi) but no Ada knowledge. May I ask if it is too difficult to move from C/C++ to Ada?...
2
2024
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 resolve the warnings and errors. #include <iostream> using namespace std;
6
3564
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 uncaught exception. How to catch an exception that happened before main() try { ... } catch (...) { ... } block? Is there a way?
5
1897
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". Question 28 says:
1
284
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 stream - is provided as the sentry's constructor. Code that needs to be executed last (the "suffix code") - such as throwing exceptions caused by state changes - is provided as the sentry's destructor".
22
2809
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
2613
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 "things which are clearly delimited and accessible to inspection". That should map onto C++ classes - specifically due to overlapping requirements. C++ classes _should_ be "things which are clearly delimited and accessible to inspection". Yet...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8252
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.