|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2006-01-11 16:43 UTC] ckl at ecw dot de
 Description:
------------
I get a strange problem when creating a web-service. The second call on the web-service crashes.
Reproduce code:
---------------
<?php
  include_once("Log.php5);
  class SOAPSMSServer
  {
    function __construct() {
      $this->objLog = new Log();
    }
    
    public function method1() {
      $this->objLog->log("Method 1 called");
    }
    public function method2() {
      $this->objLog->log("Method 2 called"); // << crashes
  }
  $soapServer = new SoapServer('SOAPSMSServer.wsdl');
  $soapServer->setClass('SOAPSMSServer');
  $soapServer->addFunction(array('method1','method2'));
  $soapServer->setPersistence(SOAP_PERSISTENCE_SESSION);
  $soapServer->handle();
?>
Expected result:
----------------
In my opinion the script should do following:
a) Client connects to SOAP-Server
b) Server executes __construct()
c) Server executes method1()
     calls the log-method
d) Server executes method2()
     calls the log-method
The client is ok - it works if I disable logging.
Actual result:
--------------
The error is:
"The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Log" 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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
You should include files with class definition before starting session. The following modification makes it works fine SOAPSMSServer.php5: <?php include_once("LogHandler.php5"); include_once("LogHandler.File.php5"); session_start(); ...