bug46419.phpt 895 B

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