1--TEST-- 2Bug #46419 (Elements of associative arrays with NULL value are lost) 3--EXTENSIONS-- 4soap 5--FILE-- 6<?php 7function bar() { 8 return array('a' => 1, 'b' => NULL, 'c' => 2, 'd'=>''); 9} 10 11class LocalSoapClient extends SoapClient { 12 private $server; 13 14 function __construct($wsdl, $options) { 15 parent::__construct($wsdl, $options); 16 $this->server = new SoapServer($wsdl, $options); 17 $this->server->addFunction('bar'); 18 } 19 20 function __doRequest($request, $location, $action, $version, $one_way = 0): string { 21 ob_start(); 22 $this->server->handle($request); 23 $response = ob_get_contents(); 24 ob_end_clean(); 25 return $response; 26 } 27 28} 29 30$x = new LocalSoapClient(NULL,array('location'=>'test://', 31 'uri'=>'http://testuri.org')); 32var_dump($x->bar()); 33?> 34--EXPECT-- 35array(4) { 36 ["a"]=> 37 int(1) 38 ["b"]=> 39 NULL 40 ["c"]=> 41 int(2) 42 ["d"]=> 43 string(0) "" 44} 45