coldkill Posted September 8, 2006 Share Posted September 8, 2006 Hey folks,I'm having some problems with a class I wrote to execute files and commands. It keeps giving out these errors[code]WARNING [2] Missing argument 1 for action() (Line: 34 of /home/coldkill/public_html/beta/kernel/action.php)WARNING [2] act(/home/coldkill/public_html/beta/source/action/files/.php): failed to open stream: No such file or directory (Line: 60 of /home/coldkill/public_html/beta/kernel/action.php)[/code]Even though the argument is passed to the class (action) and the variable used in the require_once function has the correct value. Both values being page_mod. This doesn't happen with any other code this class executes just this one and I'm truely stumped. Any ideas?Thanks in advance,Cold Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/ Share on other sites More sharing options...
°°Ben³ Posted September 8, 2006 Share Posted September 8, 2006 [quote author=coldkill link=topic=107352.msg430581#msg430581 date=1157724918]Even though the argument is passed to the class (action) and the variable used in the require_once function has the correct value.[/quote]Sounds strange. Maybe you edit the wrong file? ??? ^^ .. Maybe you can post the relevant code here? Thanks. Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88399 Share on other sites More sharing options...
coldkill Posted September 8, 2006 Author Share Posted September 8, 2006 There's not much to it:[code]class action extends main_class{ /*----------------------------------------*/ // Constructor /*----------------------------------------*/ /* * @input $type * @return NULL */ function action( $type ) { /* * INIT: DB */ $this->DB = new db_driver(); /* * Execute the command */ $this->act( $type ); } /*----------------------------------------------------*/ // Act /*----------------------------------------------------*/ /* * Executes the action */ function act( $type ) { /* * Get the file */ require_once( ROOT_PATH."source/action/files/".$type.".php" ); /* * Start the action */ $this->ACTION = new $type; /* * Execute the file */ $this->ACTION->execute(); /* * All done */ return TRUE; }}[/code]This is the part of the calling code:[code]/*----------------------------------------*/// Type?/*----------------------------------------*/if( ! empty( $_POST['type'] ) ){ /* * 'Twas a form! */ $type = $_POST['type'];}elseif( ! empty( $_REQUEST['type'] ) ){ /* * 'Twas a URL! */ $type = $_REQUEST['type'];}else{ fatel_error( "There is no type of action to conduct. There may be an error with the form. Please contact the webmaster.", "Action init failed" );}/*----------------------------------------*/// Start the action/*----------------------------------------*/$action = new action( $type );[/code] Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88429 Share on other sites More sharing options...
Jenk Posted September 8, 2006 Share Posted September 8, 2006 $type === NULLgive it a value. Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88500 Share on other sites More sharing options...
coldkill Posted September 8, 2006 Author Share Posted September 8, 2006 I tried doing $type = "" to give it a value in both functions but it didn't work. Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88604 Share on other sites More sharing options...
°°Ben³ Posted September 8, 2006 Share Posted September 8, 2006 So what does $type contain in the calling file?Try this to get the information[code=php:0]echo '<pre>';var_dump($type);echo '</pre>';[/code]Regards, Ben. Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88615 Share on other sites More sharing options...
coldkill Posted September 8, 2006 Author Share Posted September 8, 2006 It comes from a form and it contains the string "page_mod". I really don't know why it's only this form which doesn't work with the system all the others do :S. Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88623 Share on other sites More sharing options...
coldkill Posted September 8, 2006 Author Share Posted September 8, 2006 Any more ideas on this one? Still don't have a clue. Maybe it's the form:[code]<form action="http://www.domain.com/beta/source/action/exec.php" method="post" name="editform" id="editform"> <table cellpadding="0" border="0" width="100%"> <tr> <td>Title:</td> <td><input name="title" type="text" class="inputhelp" value="" /></td> </tr> <tr> <td></td> <td><input id="use" type="text" value="Help" readonly="true" class="inputhelp" /></td> </tr> <tr> <td>Text:</td> <td><textarea name="post" class="inputarea"></textarea></td> </tr> <tr> <td>Preview page?</td> <td><input name="preview" id="preview" type="checkbox" onclick="javascript:Action()" value="checked" /></td> </tr> <tr> <td>Link name*</td> <td><input name="link" type="text" class="inputhelp" value="" /></td> </tr> <tr> <td>Link Title**</td> <td><input name="link_title" type="text" class="inputhelp" value="" /></td> </tr> <tr> <td>Category***</td> <td><select name="category"> <option value="0" selected>-Select One-</option> <option value="1">AirLift</option><option value="2">Brief</option><option value="3">Community</option> </select></td> </tr> <tr> <td><input name="type" type="hidden" value="testy_blah_blah" /></td> <td><input name="submit" type="submit" value="Submit" class="submitbutton"/></td> </tr> <tr> <td></td> <td>*This appears in the navigation bar and links to the page you are creating <br /> **This appears when you hover over links in the navigation bar <br /> ***This is the category the link will appear under</td> </tr> </table> </form>[/code]Thanks,Cold Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88732 Share on other sites More sharing options...
coldkill Posted September 8, 2006 Author Share Posted September 8, 2006 OK I set the initial values for the action.php functions to NULL and that's gotten rid of the first error message I got (same result as with = ""). But still the second error persists saying it can't include the page. I changed the global names to another one which was defined and it got rid of the include problem but gave me an error it couldn't instanitiate the class "page_mod" it did this for all the forms which previously worked fine. Cold Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88764 Share on other sites More sharing options...
coldkill Posted September 9, 2006 Author Share Posted September 9, 2006 I still need help with this one I can't seem to find the problem still. Any ideas?Cold Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-88929 Share on other sites More sharing options...
coldkill Posted September 9, 2006 Author Share Posted September 9, 2006 ::BUMP::Still stuck and I really need the help. Anyone got [b]ANY[/b] ideas?Thanks,Cold Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-89101 Share on other sites More sharing options...
coldkill Posted September 9, 2006 Author Share Posted September 9, 2006 [b]::SOLVED::[/b] Link to comment https://forums.phpfreaks.com/topic/20122-solved-class-errror/#findComment-89122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.