xref: /PHP-8.2/ext/soap/tests/bugs/bug42326.phpt (revision 7f2f0c00)
1--TEST--
2Bug #42326 (SoapServer crash)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9$request = <<<EOF
10<?xml version="1.0" encoding="UTF-8"?>
11<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com/"><SOAP-ENV:Body><ns1:GetProductsRequest><time></time></ns1:GetProductsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
12EOF;
13
14
15$soap_admin_classmap = array('productDetailsType' => 'SOAP_productDetailsType',
16                             'GetProductsRequest' => 'SOAP_GetProductsRequest',
17                             'GetProductsResponse' => 'SOAP_GetProductsResponse');
18
19class SOAP_productDetailsType {
20    public $id = 0;
21}
22
23class SOAP_GetProductsRequest {
24    public $time = '';
25}
26
27class SOAP_GetProductsResponse {
28    public $products;
29    function __construct(){
30        $this->products = new SOAP_productDetailsType();
31
32    }
33}
34
35class SOAP_Admin {
36    public function GetProducts($time){
37        return new SOAP_GetProductsResponse();
38    }
39}
40
41$soap = new SoapServer(__DIR__.'/bug42326.wsdl', array('classmap' => $soap_admin_classmap));
42$soap->setClass('SOAP_Admin');
43ob_start();
44$soap->handle($request);
45ob_end_clean();
46echo "ok\n";
47?>
48--EXPECT--
49ok
50