|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-06 00:35 UTC] brent at jeneral dot com
Description:
------------
Soap persistent sessions (SOAP_PERSISTENCE_SESSION) no longer works in version 5.05 (php5-soap-5.0.5). Downgrading to previous 5.0.4_2 works.
I created a test script that also verified the bug below:
Reproduce code:
---------------
Server Code:
$soap = new SoapServer("sessionTestServer.wsdl");
$soap->setClass("sessionTestServer");
$soap->setPersistence(SOAP_PERSISTENCE_SESSION);
$soap->handle();
Class:
class sessionTestServer {
private $count = 0;
public function count() {
$this->count++;
return $this->count;
}
}
Client:
echo "<br>Count: ".$client->count(); // Should be 1
echo "<br>Count: ".$client->count(); // Should be 2
echo "<br>Count: ".$client->count(); // Should be 3
Expected result:
----------------
Should be 1, 2, 3 but is 1, 1, 1. Session variables are not persistent.
Actual result:
--------------
Should be 1, 2, 3 but is 1, 1, 1. Session variables are not persistent.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
Hi, I would like this to be reopened because I have the same problems: loke:~/Projekter/php/soap/basic$ dpkg -s php5.0 Package: php5.0 Status: install ok installed Priority: optional Section: interpreters Installed-Size: 20 Maintainer: Piotr Roszatycki <dexter@debian.org> Architecture: all Version: 5.0.5-0.8 Provides: php5 Server: <?php session_start(); class HelloServer { private $count; function __construct() { $this->count = 0; } function sayhello() { $this->count++; return $this->count; } } $options = array("uri" => "http://test-uri/"); $server = new SoapServer(NULL, $options); $server->setClass("HelloServer"); $server->setPersistence(SOAP_PERSISTENCE_SESSION); $server->handle(); ?> Client: <?php function format($s) { $s = str_replace("><", ">\n<", $s); return "<pre>" . htmlspecialchars($s) . "</pre>"; } print "<html><head><title>Session Test</title></head><body>"; $option = array( "location" => "http://localhost/~mir/soap/php5/session/soapSessionServer.php", "uri" => "http://test-uri/", "trace" => 1); $client = new SoapClient(NULL, $option); $arg = array(); try { $response = $client->__soapCall("sayhello", $arg); print "<p>Response:<br>$response</p>"; } catch(SoapFault $sf) { print "<p>Response:<br>" . $sf->getMessage() . "</p>\n"; } print format($client->__getLastRequestHeaders()) . "\n"; print format($client->__getLastRequest()) . "\n"; print format($client->__getLastResponseHeaders()) . "\n"; print format($client->__getLastResponse()) . "\n"; print "</body></html>"; ?> Output - first time rune: HTTP/1.1 200 OK Date: Tue, 01 Nov 2005 23:05:25 GMT Server: Apache/2.0.55 (Debian) mod_python/3.1.3 Python/2.3.5 PHP/5.0.5-Debian-0.8 mod_perl/2.0.1 Perl/v5.8.7 X-Powered-By: PHP/5.0.5-Debian-0.8 Set-Cookie: PHPSESSID=c6d215abd0930d3c48bb82dc9645b8ea; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 505 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/xml; charset=utf-8 Output - second time: HTTP/1.1 200 OK Date: Tue, 01 Nov 2005 23:23:09 GMT Server: Apache/2.0.55 (Debian) mod_python/3.1.3 Python/2.3.5 PHP/5.0.5-Debian-0.8 mod_perl/2.0.1 Perl/v5.8.7 X-Powered-By: PHP/5.0.5-Debian-0.8 Set-Cookie: PHPSESSID=94b0f37c8de99c263a74b3f657d12f3a; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 505 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/xml; charset=utf-8 As can be seen the session id changes for every call. Looking for the cookie on the client shows the problem - the cookie is never stored on the client so succeding invocations does not send any session id back which causes the server to think this is a new session.