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: <[EMAIL PROTECTED]>
To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to