1--TEST-- 2SOAP Classmap 4: encoding of objects with __get() 3--EXTENSIONS-- 4soap 5--FILE-- 6<?php 7ini_set("soap.wsdl_cache_enabled",0); 8 9class A { 10 public $a; 11 function __construct($a){ 12 $this->x = $a; 13 } 14 function __get($name) { 15 return @$this->a[$name]; 16 } 17 function __set($name, $val) { 18 $this->a[$name] = $val; 19 } 20 function __unset($name) { 21 unset($this->a[$name]); 22 } 23} 24 25class B extends A { 26 function __construct($a){ 27 parent::__construct($a); 28 $this->y = $a + 1; 29 } 30} 31 32function f(){ 33 return new B(5); 34} 35 36class LocalSoapClient extends SoapClient { 37 private $server; 38 39 function __construct($wsdl, $options) { 40 parent::__construct($wsdl, $options); 41 $this->server = new SoapServer($wsdl, $options); 42 $this->server->addFunction("f"); 43 } 44 45 function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { 46 ob_start(); 47 $this->server->handle($request); 48 $response = ob_get_contents(); 49 ob_end_clean(); 50 return $response; 51 } 52} 53 54$client = new LocalSoapClient(__DIR__."/classmap003.wsdl", 55 array('classmap'=>array('A'=>'A','B'=>'B'))); 56print_r($client->f()); 57?> 58--EXPECT-- 59B Object 60( 61 [a] => Array 62 ( 63 [x] => 5 64 [y] => 6 65 ) 66 67) 68