xref: /PHP-8.0/ext/soap/tests/bugs/bug41004.phpt (revision f8d79582)
1--TEST--
2Bug #41004 (minOccurs="0" and null class member variable)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7ini_set('soap.wsdl_cache_enabled', false);
8
9class EchoBean{
10    public $mandatoryElement;
11    public $optionalElement;
12
13}
14
15class EchoRequest{
16    public $in;
17}
18
19class EchoResponse{
20    public $out;
21}
22
23$wsdl = __DIR__."/bug41004.wsdl";
24$classmap = array('EchoBean'=>'EchoBean','echo'=>'EchoRequest','echoResponse'=>'EchoResponse');
25$client = new SoapClient($wsdl, array('location'=>'test://',"classmap" => $classmap, 'exceptions'=>0, 'trace'=>1));
26$echo=new EchoRequest();
27$in=new EchoBean();
28$in->mandatoryElement="REV";
29$in->optionalElement=NULL;
30$echo->in=$in;
31$client->echo($echo);
32echo $client->__getLastRequest();
33?>
34--EXPECT--
35<?xml version="1.0" encoding="UTF-8"?>
36<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Formation"><SOAP-ENV:Body><ns1:echo><in><mandatoryElement>REV</mandatoryElement></in></ns1:echo></SOAP-ENV:Body></SOAP-ENV:Envelope>
37