Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "PHP_ControlPanel" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition
I am trying to include the controlpanel.php file. Can I have an example on how to fix this error. thank you.
include error
Moderator: General Moderators
Re: include error
You'll have to show us the code. The error isn't about "include", it's telling you that there's a syntax error in your class definition. It isn't complete or it is impossible to parse because it is not being defined in the required sequence.stevestark5000 wrote:Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "PHP_ControlPanel" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition
I am trying to include the controlpanel.php file. Can I have an example on how to fix this error. thank you.
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: include error
Code: Select all
if (!isset($GLOBALS['core'])){
header("location:../../");
exit();
}
if(!isset($_SESSION['PHP_ControlPanel'])) {
$_SESSION['PHP_ControlPanel'] = new PHP_ControlPanel;
}
if (isset($_GET['cp_image_toggle'])){
PHP_ControlPanel_Tab::toggleImage($_GET['tab']);
}
if (isset($_GET['cp_desc_toggle'])){
PHP_ControlPanel_Tab::toggleDesc($_GET['tab']);
}
$GLOBALS['CNT_controlpanel']['title'] = $_SESSION['translate']->it('Control Panel');
$_SESSION['PHP_ControlPanel']->display();
Last edited by califdon on Sun Feb 13, 2011 9:20 pm, edited 1 time in total.
Reason: Fixed syntax=php tag
Reason: Fixed syntax=php tag
Re: include error
Uhh, what is that??? That doesn't look to me like it has anything to do with the error you quoted.
Re: include error
http://php.net/manual/en/function.main.php
Perhaps that might explain it?
I've never done an object like that.
can $_SESSION['foo']->method() be called like that?
Perhaps that might explain it?
I've never done an object like that.
can $_SESSION['foo']->method() be called like that?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: include error
It's not so much that there is an error in the class definition as that the class definition cannot be found. Apparently, an object of type PHP_ControlPanel has been created and stored in the session. The object exists but the blueprints are missing, so the object is labeled "incomplete".califdon wrote:The error isn't about "include", it's telling you that there's a syntax error in your class definition.
There must be more to the script than was shown because, while I was able to recreate the error by instantiating an object in the session then excluding its class definition, I was not able to recreate the error without session_start(), which is also absent and necessary to perpetuate the object.
According to this test script, yes.s.dot wrote:can $_SESSION['foo']->method() be called like that?
Code: Select all
<?php
session_start();
class A {
var $n = 0;
function go () {
return (++$this->n);
}
}
if (!(isset($_SESSION['a']) && $_SESSION['a'] instanceof A)) {
$_SESSION['a'] = new A;
}
echo $_SESSION['a']->go();-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: include error
could it be the last line of code? what more do you want be to include for code?
$_SESSION['PHP_ControlPanel']->display();
$_SESSION['PHP_ControlPanel']->display();