SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast cilverphox's Avatar
    Join Date
    Jan 2005
    Location
    Petoskey, MI
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    incomplete object...

    I'm having one hell of a time trying to firgure out this error I'm recieving, __PHP_Incomplete_Class Object, which I'm sure most have encountered before.. Here's the break down.

    index.php:

    Code:
    include ("log_class.php");
    
    session_start();
    session_register('log');
    ...
    //create log from flat file
    log = new log($name, $database);
    
    //test log was created successfully, and it is
    print_r($log);
    once authenticated: header('Location: admin.php');

    admin.php:
    Code:
    include ("log_class.php");
    session_start();
    
    //test object integrity
    print_r($_SESSION['log']); //This yields _PHP_Incomplete_Class Object
    I can't seem to understand this error, considering there is no object manipulation and everything is seemingly sequential (class definitions before session_start, etc.)

    Any ideas...

    -Cilverphox

  2. #2
    SitePoint Addict mgkimsal's Avatar
    Join Date
    Sep 1999
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you not session_register() on the second page? The whole session_register() thing was always strange to me, and I think the behaviour of that changed a couple years ago. It *seems* (and this is how I was teaching it a couple years ago IIRC) that if you use $_SESSION, just use that all the time - don't bother doing the session_register() stuff.

    In the first one, don't session_register - just do $_SESSION['log'] = ... and see how that works.

    Oh wow - I see you're from Ann Arbor - I just moved from there! Used to run the sempug (PHP user group). There's still a sempug list at yahoogroups.com if you are looking to meet up with other PHP users in the area.
    Michael Kimsal
    =============================
    groovymag.com - for groovy/grails developers
    jsmag.com - for javascript developers

  3. #3
    SitePoint Enthusiast cilverphox's Avatar
    Join Date
    Jan 2005
    Location
    Petoskey, MI
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unfortunately, this does not resolve the problem. I can't figure out how on one page it can be complete and then after a redirection, it isn't complete. I also can't believe that no one else has anything to say about this error. I'm sure almost everyone has had to deal with it.

  4. #4
    SitePoint Enthusiast cilverphox's Avatar
    Join Date
    Jan 2005
    Location
    Petoskey, MI
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok...so I figured it out...
    don't use "session_start()" within a class definition

    -cilverphox

  5. #5
    SitePoint Evangelist
    Join Date
    Feb 2004
    Location
    Sofia, Bulgaria
    Posts
    421
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation

    take care of some notices from PHP Manual:

    Caution:
    If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.

    register_globals: important note:
    Since PHP 4.2.0, the default value for the PHP directive register_globals is off. The PHP community encourages all to not rely on this directive but instead use other means, such as the superglobals.

    Caution:
    If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •