Re: Passing Objects Vol II

From: Date: Fri, 11 May 2001 07:56:28 +0000
Subject: Re: Passing Objects Vol II
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52417@lists.php.net to get a copy of this message
In index2.php change the line $myInstance=urldecode ( unserialize($passedClass) ); to $myInstance=unserialize ( urldecode($passedClass) ); and you should be happy... I also assume you have register_globals turned on in php.ini. Pavel ----- Original Message ----- From: <tcuhost@hotmail.com> To: "Php-General (E-mail)" <php-general@lists.php.net> Sent: Friday, May 11, 2001 4:21 AM Subject: [PHP] Passing Objects Vol II > hmm well I tried it.... perhaps another step is in order. Once I can see it > work once I will be happy. > > //#################### > // index.php contains: > //#################### > <pre> > <?php > > include( "classes.inc" ); > $myInstance=new Main( $REMOTE_HOST , "nick" , "zzyzx" , true); > > echo $myInstance->client . "\n"; > echo $myInstance->user . "\n"; > echo $myInstance->password . "\n"; > echo $myInstance->allowed . "\n"; > > ?> > <a href=" <?php echo "index2.php?passedClass=" . > urlencode(serialize($myInstance)) ; ?> "> Test </a> > </pre> > > //#################### > // index2.php contains: > //#################### > <pre> > <?php > > include("classes.inc"); > $myInstance=urldecode ( unserialize($passedClass) ); > > echo $myInstance->client . "\n"; > echo $myInstance->user . "\n"; > echo $myInstance->password . "\n"; > echo $myInstance->allowed . "\n"; > > ?> > </pre> > > //#################### > // classes.inc contains: > //#################### > <?php > class Main > { > > var $client; > var $user; > var $password; > var $allowed; > > function Main( $client="0.0.0.0" , $user= "" , $password="" , > $allowed = > false) > { > $this->client= $client; > $this->user = $user; > $this->password = $password; > $this->allowed = $allowed; > } > > } > ?> > > > //#################### > // THE MSG I GET > //#################### > > Warning: unserialize() failed at offset 3 of 130 bytes <path to file here> > on line 6 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#52417) next »