php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35972 Not able to use a class in a persistence session
Submitted: 2006-01-11 16:43 UTC Modified: 2006-01-13 10:58 UTC
From: ckl at ecw dot de Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5CVS-2006-01-11 (5.1.2) (snap) OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ckl at ecw dot de
New email:
PHP Version: OS:

 

 [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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-12 09:12 UTC] dmitry@php.net
Could you please provide full example with client, server, "Log5.php" and 'SOAPSMSServer.wsdl'.

I created my own test-case, but it works fine for me.
 [2006-01-12 09:30 UTC] ckl at ecw dot de
The four files are located in http://wrclan9.ecw.de/bug.txt
Thanks in advance,
Christopher Klein
 [2006-01-13 09:18 UTC] dmitry@php.net
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();
...


 [2006-01-13 10:58 UTC] ckl at ecw dot de
Thank you for your reply, but this change just fixes ONE error message.
Plase remove the comment-signs from LogHandler.php5 in method callLogHandler (throw new Exception...) and you will see, that  the class has lost the whole content of the property $instancesLog between the __construct(), method1() and method2().
Any ideas?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC