Ho visto che sulla pagina di documentazione delle sessioni su php.net ci sono opinioni discordanti a riguardo della memorizzazione di oggetti in $_SESSION.
La pagina a cui mi sto riferendo è http://www.php.net/manual/en/functio...n-register.php
Secondo alcuni non c'è bisogno di serializzare, secondo altri invece sì...

Fatto sta che ho provato a cambiare il mio codice serializzando e deserializzando esplicitamente l'oggetto che vado a memorizzare in $_SESSION:
Codice PHP:
require_once('VFSclient.class.php');
session_start();

if (isset(
$_POST['submit'])) {
    switch (
$_POST['submit']){
        case 
'Entra':
            
//LOGIN
            
if(doLogin($_POST['username'], $_POST['password'])){
                
//LOGIN OK
                //echo "Login OK - USER = ".$_POST['username']." - PASS = ".$_POST['password']. " - TKEY = ".$_SESSION['vfs']->tkey;
                
header("Location: main.php");
            } else {
                
//LOGIN ERROR
                
$_POST['errmsg'] = $_SESSION['vfs']->getErrorMessage();
                include(
'login.php');
            }
            break;
        case 
'Registrati':
            
//NUOVA REGISTRAZIONE
            
include('register.php');
            break;
        case 
'Procedi':
            if(
doRegister($_POST['username'], $_POST['password'], $_POST['email'])){
                
// USERADD OK - NOW LOGIN
                
include('login.php');
            } else {
                
//FALLISCE LA USERADD
            
}
            break;
    }
} else {
    
//PRIMA VOLTA CHE ACCEDO
    
$vfs = new VFSClient();
    
$svfs serialize($vfs);
    
$_SESSION['vfs'] = $svfs;
    include(
'login.php');
}

function 
doLogin($username$password){
    
$uvfs unserialize($_SESSION['vfs']);
    return 
$uvfs->login($username,$password);
}

function 
doRegister($username$password$email){
    
$uvfs unserialize($_SESSION['vfs']);
    return 
$uvfs->userAdd($username,$password,$email);

Non so se ho tralasciato qualcosa, ma questo codice produce lo stesso risultato di quello precedente:
Fatal error: VFSClient::login() [function.VFSClient-login]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "WebService_VFSiService_VFService" 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 C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\VFSclient\VFSclient.cl ass.php on line 49