unserialize()...函数spl_autoload_call()尚未定义它所调用的类

I'm using factory to create an object and the static method to unserialize this object:

public static function factory($idText) {
    $fetchedObject = self::fetchStoredObject($idText);
    return $fetchedObject;
}

private static function fetchStoredObject($idText) {
    $fetchedText = DB::select()
                    ->from(table)
                    ->where('idText', '=', $idText)
                    ->execute()->as_array();
    if (!empty($fetchedText)) {
        return unserialize(base64_decode($fetchedText[0]['txtContent']));
    } else {
        return NULL;
    }
}

The object is created in this way:

$text = Article::factory($idText);

But I get the following error:

unserialize() [<a href='function.unserialize'>function.unserialize</a>]: 
Function spl_autoload_call() hasn't defined the class it was called for

On this line of fetchStoredObject method:

return unserialize(base64_decode($fetchedText[0]['txtContent']));

Why does this error occur?

EDIT

My class has the following structure:

class Article {
    private $phpMorphy;
    private $words; //contains instances of class Word
    ...
    private function __construct($idText) {
        $this->initPhpMorphy(); // $this->phpMorphy gets reference to the object here
    }

    public function __sleep() {
        return Array(
            'rawText',
            'idText',
            'properties',
            'words',
            'links'
        );
    }

public function __wakeup() {
    $this->initPhpMorphy();
}

}

The Word class doesn't contain the reference to phpMorphy as own property, but uses it in its methods as function parameter. Here is the part of the serialized string:

" Article words";a:107:{i:0;O:4:"Word":10:{s:5:" * id";O:9:"phpMorphy":7:{s:18:" * storage_factory";O:25:

It appears the phpMorphy is serialized with connectrion to the Word class. Am I right?

What version of PHP did you use? Where did you store your Article class? Try to require() it manually.

The error occurs because inside your serialized string there is a reference to a class that hasn't been included yet - so the PHP autoloading mechanism is triggered to load that class, and this fails for some reason.

Your steps for debugging would be:

  1. Identify which class is included in that serialized string.
  2. Check if you have code for that class somewhere.
  3. Make sure this code can be loaded via autoloading. Alternatively make sure that code is included before unserializing.

The problem is fixed thanks to Sven suggestions. The object of class Word (part of the class Article) contained reference to the phpMorphy class (which happened because I changed parameters order when creating an instance of the word!).