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