php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44267 soap server not persistence
Submitted: 2008-02-27 14:25 UTC Modified: 2008-10-29 01:00 UTC
Votes:11
Avg. Score:4.7 ± 0.6
Reproduced:11 of 11 (100.0%)
Same Version:4 (36.4%)
Same OS:4 (36.4%)
From: falk dot herrmann at bike24 dot net Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.2.5 OS: Linux 2.6.23
Private report: No CVE-ID: None
 [2008-02-27 14:25 UTC] falk dot herrmann at bike24 dot net
Description:
------------
A soap server with SOAP_PERSISTENCE_SESSION is not persistence if the class Bar extends class Foo and the class Foo was included via include() or required().
If the class Foo is directly in the server code file (server.php), soap server works correct.

Reproduce code:
---------------
server.php
==========
<?php

  session_name('PSESSION');

  if ( $_COOKIE['PSESSION'] ) {
    session_id($_COOKIE['PSESSION']);
  }
  $res = session_start();

  require('Foo.php');

  class Bar extends Foo {
    public $var = 0;

    public function login() {
      return session_id();
    }

    public function incVar() {
      $this->var++;
      return $this->var;
    }
  }

  $server = new SoapServer(NULL, array('uri' => 'http://localhost/'));
  $server->setClass('Bar');
  $server->setPersistence(SOAP_PERSISTENCE_SESSION);
  $server->handle();

?>

client.php
==========
<?php

  # Soap client
  $client = new SoapClient(NULL,
    array(
    "location" => "http://localhost/server.php",
    "uri" => "urn:xmethodsTest",
    'trace' => 1
  ));

  # SOAP requests
  try {

    $session = $client->login();

    $client->__setCookie('PSESSION', $session);

    print $client->incVar(); print "\n";
    print $client->incVar(); print "\n";
    print $client->incVar(); print "\n";
    print $client->incVar(); print "\n";
    print $client->incVar(); print "\n";

  } catch (SoapFault $sf) {
    # ...
  }

?>

Foo.php
=======
<?php
  class Foo {

  }
?>

Expected result:
----------------
1
2
3
4
5


Actual result:
--------------
1
1
1
1
1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-20 16:17 UTC] davy dot defaud at free dot fr
I experienced the same problem on the same version 5.2.5, for a 2.6.24 kernel both on a i586 and a x86_64 systems (but I don't think it's system related).
I already had this problem with an old 5.0.4 PHP but my code was working on a 5.2.1 including Suhosin so I was confident that it would work on my brand new mandriva 2008.1 server with the latest PHP, but it doesn't :-(
This is a really critical bug for those using PHP as a SOAP server.
We really need a quick fix.
 [2008-05-18 20:06 UTC] falk dot herrmann at bike24 dot net
It seems that the code work with PHP 5.2.6
 [2008-07-10 18:48 UTC] davy dot defaud at free dot fr
It still doesn't work for me even in 5.2.6.
I tried everything I could, I'm really lazzy.
 [2008-10-21 11:32 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-10-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-14 20:26 UTC] marcio at invox dot es
I have exactly the same problem in PHP 5.2.11 and 5.2.6-1+lenny3, is it fixed?
How to solve this!??
Thanks a lot!
 [2010-06-11 23:21 UTC] nn at tronix dot pl
I have exactly the same problem in PHP 5.3.2
 [2010-12-08 23:11 UTC] ocyssau at free dot fr
It is the same on 5.3.0
 [2010-12-09 20:54 UTC] ocyssau at free dot fr
circumvent the bug by starting the session after the class definition:

server.php
==========
<?php

require('Foo.php');

session_name('PSESSION');

if ( $_COOKIE['PSESSION'] ) {
	session_id($_COOKIE['PSESSION']);
}
class Bar extends Foo{
	public $var = 0;

	public function login() {
		return session_id();
	}

	public function incVar() {
		$this->var++;
		return $this->var;
	}
}

$res = session_start();

$server = new SoapServer(NULL, array('uri' => 'http://localhost/'));
$server->setClass('Bar');
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
$server->handle();
?>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 07:01:27 2024 UTC