Jump to content

Newbie (Problem working with objects)


Rublex

Recommended Posts

Hey guys,

Just starting to play with PHP and got this problem working with objects.

Basically I am storing an object in session and then retrieving it.

Here is the error:

Fatal error: CUserRole::isCached() [<a href='function.isCached'>function.isCached</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "CUserRole" 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 in

Code:

[code]$UserRole = $_SESSION["UserRole_ID_$RoleID"];
$UserRole->Timestamp(); (Throws error) [/code]

Things I have tried:

1) Making sure all requires are before session_start()
2) __autoload()

Here is another interesting thing, in order to see if the CUserRole class is defined I used

[code]print_r(get_declared_classes());[/code]

right before the error line and here is what it returned:

Array ( [0] => stdClass [1] => Exception [2] => ErrorException [3] => COMPersistHelper [4] => com_exception [5] => com_safearray_proxy [6] => variant [7] => com [8] => dotnet [9] => ReflectionException [10] => Reflection [11] => ReflectionFunction [12] => ReflectionParameter [13] => ReflectionMethod [14] => ReflectionClass [15] => ReflectionObject [16] => ReflectionProperty [17] => ReflectionExtension [18] => LibXMLError [19] => __PHP_Incomplete_Class [20] => php_user_filter [21] => Directory [22] => SimpleXMLElement [23] => DOMException [24] => DOMStringList [25] => DOMNameList [26] => DOMImplementationList [27] => DOMImplementationSource [28] => DOMImplementation [29] => DOMNode [30] => DOMNameSpaceNode [31] => DOMDocumentFragment [32] => DOMDocument [33] => DOMNodeList [34] => DOMNamedNodeMap [35] => DOMCharacterData [36] => DOMAttr [37] => DOMElement [38] => DOMText [39] => DOMComment [40] => DOMTypeinfo [41] => DOMUserDataHandler [42] => DOMDomError [43] => DOMErrorHandler [44] => DOMLocator [45] => DOMConfiguration [46] => DOMCdataSection [47] => DOMDocumentType [48] => DOMNotation [49] => DOMEntity [50] => DOMEntityReference [51] => DOMProcessingInstruction [52] => DOMStringExtend [53] => DOMXPath [54] => RecursiveIteratorIterator [55] => FilterIterator [56] => RecursiveFilterIterator [57] => ParentIterator [58] => LimitIterator [59] => CachingIterator [60] => RecursiveCachingIterator [61] => IteratorIterator [62] => NoRewindIterator [63] => AppendIterator [64] => InfiniteIterator [65] => EmptyIterator [66] => ArrayObject [67] => ArrayIterator [68] => RecursiveArrayIterator [69] => SplFileInfo [70] => DirectoryIterator [71] => RecursiveDirectoryIterator [72] => SplFileObject [73] => SplTempFileObject [74] => SimpleXMLIterator [75] => LogicException [76] => BadFunctionCallException [77] => BadMethodCallException [78] => DomainException [79] => InvalidArgumentException [80] => LengthException [81] => OutOfRangeException [82] => RuntimeException [83] => OutOfBoundsException [84] => OverflowException [85] => RangeException [86] => UnderflowException [87] => UnexpectedValueException [88] => SplObjectStorage [89] => XMLReader [90] => XMLWriter [91] => CMisc [92] => CUserStatus [93] => DB [94] => DB_result [95] => DB_row [96] => PEAR [97] => PEAR_Error [98] => DB_Error [b][99] => CUserRole[/b] [100] => CCreditCard [101] => CUser [102] => DB_common [103] => DB_mysql )

Looks like CUserRole is defined.

Another thing is that the exact same code is working with another object. I played with code some more and figured out that if I switch the order of require_once() statements, which ever the first require is that is the object that is working. I don't understand why this is happening since all of this should be defined before any code is executed.

Could somebody help me out on this? Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.