php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52058 SOAP_PERSISTENCE_SESSION doesnt work if server class is included from external
Submitted: 2010-06-11 23:35 UTC Modified: 2024-05-30 21:09 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: nn at tronix dot pl Assigned:
Status: Duplicate Package: SOAP related
PHP Version: 5.3.2 OS: FreeBSD 6.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nn at tronix dot pl
New email:
PHP Version: OS:

 

 [2010-06-11 23:35 UTC] nn at tronix dot pl
Description:
------------
If server class is included / required (or included/required once) from external file the persistence doesn't work.

I think that the BUG is related to already reported bugs #51561 and #44267. 


Test script:
---------------
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) {
        echo "<PRE>";
        echo $sf;
  }


?>


server.php
--------------

<?php
  session_name('PSESSION');

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

  require('class.bar.php');


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

?>

class.bar.php
--------------
<?php

  class Bar  {
    public $var = 0;

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

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

?>





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


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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-11 23:41 UTC] nn at tronix dot pl
The line 14 in server.php should be changed to:

 $server = new SoapServer(NULL, array('uri' => 'http://localhost/'));
                                               ^^^^^^^^^^^^^^^^^^^^^^
 [2010-06-13 01:12 UTC] felipe@php.net
-Status: Open +Status: Verified
 [2010-06-13 01:12 UTC] felipe@php.net
I can reproduce it.
 [2024-05-30 21:09 UTC] nielsdos@php.net
-Status: Verified +Status: Duplicate
 [2024-05-30 21:09 UTC] nielsdos@php.net
This is indeed a duplicate of #51561, which is mitigated by a proper error on current master branches. Closing this.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 19 04:01:29 2025 UTC