phpbar.de logo

Mailinglisten-Archive

AW: [php] Session fressen Objekt (nicht)

AW: [php] Session fressen Objekt (nicht)

Jan Harders php_(at)_phpcenter.de
Fri, 12 Apr 2002 07:28:20 +0200


> Fatal error: The script tried to execute a method or access a property
> of an incomplete object. Please ensure that the class definition cart
> of
> the object you are trying to operate on was loaded _before_ the
> session
> was started in d:\htdocs\test\sm\htdocs\sess.php on line 7
>
> Was läuft da falsch???
>
> Der Code dazu ist denkbar einfach;
>
> sess.php
> --------
>
> require ('classtest.inc');
>
> if (!is_object($CART)) { #echo "NEW OBJEKT!";
>   $CART = new cart;
>   session_register('CART');
> }
>
> $CART->add(10,5);
>
> echo 'CARTCONTENT: <br>';
>
> foreach ( $CART->cart as $k => $v ) {
>
>   echo 'ID: '.$k.' - NUM: '.$v['num'].'<br>';
>
> }
>
> echo '<a href="sess.php">AGAIN</a>';

Wo kommt denn das session_start()?
Das Include der Klassen-Datei unbedingt VOR diesem Aufruf gemacht
werden.

Gruß Jan


php::bar PHP Wiki   -   Listenarchive