2009-08-02 5 views
1

私はこのエラーを参照していますが、一般的な問題はinclude()またはrequire() BEFORE session_start()。php "スクリプトがメソッドを実行しようとしました、または不完全なオブジェクトのプロパティにアクセスしようとしました"エラー

しかし、これは私の場合ではありません。

私は、次のエラーを取得しています:

致命的なエラー:Zend_Http_Clientの::リクエスト()[Zendの-HTTP-client.request]:スクリプトは、メソッドを実行したり、不完全なオブジェクトのプロパティにアクセスしようとしました。////ホーム/コンテンツでクラス定義をロードするために呼ばれるか__autoload()関数を提供します)あなたが上で動作しようとしているオブジェクトのクラス定義" Zend_Http_Client_Adapter_Socketを"は(前にアンシリアライズロードされたことを確認してください*/*****/html/ZendGdata-1.8.4PL1/library/Zend/Http/Client.php on line 865

なぜか?ここで

は3つの関連ファイルです:login.php、members.php、とのfunctions.php ...

login.php:

$newIncludePath = array(); 
$newIncludePath[] = '../ZendGdata-1.8.4PL1/library'; 
$newIncludePath = implode($newIncludePath); 
set_include_path($newIncludePath); 

// load classes 
require_once 'Zend/Loader.php'; 
Zend_Loader::loadClass('Zend_Gdata'); 
Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); 
Zend_Loader::loadClass('Zend_Gdata_Calendar'); 
Zend_Loader::loadClass('Zend_Http_Client'); 
Zend_Loader::loadClass('Zend_Gdata_AuthSub'); 

session_start(); 


$serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name ('cl') for calendar 
$applicationName = 'yourCompany-yourAppName-v1'; 

// Create an authenticated HTTP client 
$httpClient = Zend_Gdata_ClientLogin::getHttpClient('*****@gmail.com', '*****', $serviceName, null, $applicationName); 
$client = new Zend_Gdata_Calendar($httpClient, $applicationName); // Create an instance of the Calendar service 

$_SESSION['gdataCal'] = $client; 

members.php:

$newIncludePath = array(); 
$newIncludePath[] = '../ZendGdata-1.8.4PL1/library'; 
$newIncludePath = implode($newIncludePath); 
set_include_path($newIncludePath); 

// load classes 
require_once 'Zend/Loader.php'; 
Zend_Loader::loadClass('Zend_Gdata'); 
Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); 
Zend_Loader::loadClass('Zend_Gdata_Calendar'); 
Zend_Loader::loadClass('Zend_Http_Client'); 
Zend_Loader::loadClass('Zend_Gdata_AuthSub'); 

session_start(); 

$g_url = add_gcal($_SESSION['gdataCal'], $_SESSION['title'].....etc.); 

functions.php:

<?php 

$newIncludePath = array(); 
$newIncludePath[] = '../ZendGdata-1.8.4PL1/library'; 
$newIncludePath = implode($newIncludePath); 
set_include_path($newIncludePath); 

// load classes 
require_once 'Zend/Loader.php'; 
Zend_Loader::loadClass('Zend_Gdata'); 
Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); 
Zend_Loader::loadClass('Zend_Gdata_Calendar'); 
Zend_Loader::loadClass('Zend_Http_Client'); 

session_start(); 

function add_gcal($gdataCal, $title....etc.){ 

try { 

    $newEvent = $gdataCal->newEventEntry(); 

    $newEvent->title = $gdataCal->newTitle($title); 
    $newEvent->where = array($gdataCal->newWhere($where)); 
    $newEvent->content = $gdataCal->newContent("$desc"); 

    $when = $gdataCal->newWhen(); 
    $when->startTime = $date; 
    $when->endTime = $date; 
    $newEvent->when = array($when); 

    $createdEvent = $gdataCal->insertEvent($newEvent); 
    return $createdEvent->id->text; 

    } catch (Zend_Gdata_App_Exception $e) { 
     return NULL; 
    } 

} 

答えて

3

あなたはこのメッセージを得る:だから

Please ensure that the class definition " Zend_Http_Client_Adapter_Socket " of the object you are trying to operate on was loaded before unserialize() gets called

を、私はsession_start前に、あなたがロードする必要があり、あなたがそうZend_Http_Client_Adapter_Socket

のインスタンスである(直列化された形式でストアを意味する)のセッションで何かを持っていると仮定しますそのインスタンスのために、使用してクラス、このような何か:Zend Frameworkのようにこれは、この問題を解決する必要があり

Zend_Loader::loadClass('Zend_Http_Client_Adapter_Socket'); 

...しかしは、各Oに依存しているクラスの多くを持っています代わりにlocadingクラスのことは自分をZend_Loader::loadClassで、あなただけの/登録することができアクティベート:その他は、あなたがのためにこれらのエラーを取り除く方法は、Zend Frameworkののオートローダーを使用することです...別のものに


を実行する可能性があります必要なときに自動的にクラスを自動的に読み込みます。あまりにもZFのオートローダの詳細情報について

:-) session_startへの呼び出しの前に行わなければならないことを

クーゼの

、あなたはthis page of the manualを見てみることができます。

+1

それを修正しました、ありがとう! – littleK

+0

クラスをロードする前に明示的に 'session_start()'を呼び出さずに '$ _SESSION'を変更しても、この動作が起こることを発見しました。 – jray

関連する問題