1--TEST-- 2Bug #51561 (SoapServer with a extended class and using sessions, lost the setPersistence()) 3--EXTENSIONS-- 4soap 5session 6--SKIPIF-- 7<?php 8 if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) { 9 echo "skip sapi/cli/tests/php_cli_server.inc required but not found"; 10 } 11?> 12--FILE-- 13<?php 14 15include __DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc"; 16 17$args = ["-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=" . (substr(PHP_OS, 0, 3) == "WIN" ? "php_" : "") . "soap." . PHP_SHLIB_SUFFIX]; 18if (php_ini_loaded_file()) { 19 // Necessary such that it works from a development directory in which case extension_dir might not be the real extension dir 20 $args[] = "-c"; 21 $args[] = php_ini_loaded_file(); 22} 23$code = "session_start();" . 24 "require_once '" . __DIR__ . "/bug51561.inc';" . 25 <<<'PHP' 26 class Server extends Server2 { 27 private $value; 28 public function setValue($param) { $this->value = $param; } 29 public function getValue() { return $this->value; } 30 } 31 $server = new SoapServer(null, array('uri' => "blablabla.com",'encoding' => "ISO-8859-1",'soap_version' => SOAP_1_2)); 32 $server->setClass("Server"); 33 $server->setPersistence(SOAP_PERSISTENCE_SESSION); 34 $server->handle(); 35 PHP; 36 37php_cli_server_start($code, null, $args); 38 39$cli = new SoapClient(null, array('location' => "http://".PHP_CLI_SERVER_ADDRESS, 'uri' => "blablabla.com",'encoding' => "ISO-8859-1",'soap_version' => SOAP_1_2)); 40$cli->setValue(100); 41$response = $cli->getValue(); 42echo "Get = ".$response; 43 44?> 45--EXPECTF-- 46Fatal error: Uncaught SoapFault exception: [env:Receiver] SoapServer class was deserialized from the session prior to loading the class passed to SoapServer::setClass(). Start the session after loading all classes to resolve this issue. in %s:%d 47Stack trace: 48#0 %s(%d): SoapClient->__call('getValue', Array) 49#1 {main} 50 thrown in %s on line %d 51