xref: /PHP-8.2/ext/soap/tests/bugs/bug69085.phpt (revision adb45a63)
1--TEST--
2Bug #69085 (SoapClient's __call() type confusion through unserialize())
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9
10#[AllowDynamicProperties]
11class MySoapClient extends SoapClient {
12    public function __doRequest($request, $location, $action, $version, $one_way = 0): string {
13        echo $request, "\n";
14        return '';
15    }
16}
17$dummy = unserialize('O:12:"MySoapClient":5:{s:3:"uri";s:1:"a";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";i:1337;s:15:"__last_response";s:1:"a";s:5:"trace";s:1:"x";}');
18$dummy->whatever();
19?>
20--EXPECTF--
21Fatal error: Uncaught TypeError: Cannot assign int to property SoapClient::$__default_headers of type ?array in %s:%d
22Stack trace:
23#0 %s(%d): unserialize('O:12:"MySoapCli...')
24#1 {main}
25  thrown in %s on line %d
26