Edit report at http://bugs.php.net/bug.php?id=52058&edit=1

 ID:               52058
 User updated by:  nn at tronix dot pl
 Reported by:      nn at tronix dot pl
 Summary:          SOAP_PERSISTENCE_SESSION doesnt work if server class
                   is included from external
 Status:           Open
 Type:             Bug
 Package:          SOAP related
 Operating System: FreeBSD 6.2
 PHP Version:      5.3.2

 New Comment:

The line 14 in server.php should be changed to:



 $server = new SoapServer(NULL, array('uri' => 'http://localhost/'));

                                               ^^^^^^^^^^^^^^^^^^^^^^


Previous Comments:
------------------------------------------------------------------------
[2010-06-11 23:35:26] 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




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52058&edit=1

Reply via email to