xref: /PHP-7.0/ext/xmlrpc/tests/bug70728.phpt (revision 9f389ccc)
1--TEST--
2Bug #70728 (Type Confusion Vulnerability in PHP_to_XMLRPC_worker)
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlrpc")) print "skip";
6if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
7?>
8--FILE--
9<?php
10$obj = new stdClass;
11$obj->xmlrpc_type = 'base64';
12$obj->scalar = 0x1122334455;
13var_dump(xmlrpc_encode($obj));
14var_dump($obj);
15?>
16--EXPECTF--
17string(135) "<?xml version="1.0" encoding="utf-8"?>
18<params>
19<param>
20 <value>
21  <base64>NzM1ODgyMjkyMDU=&#10;</base64>
22 </value>
23</param>
24</params>
25"
26object(stdClass)#1 (2) {
27  ["xmlrpc_type"]=>
28  string(6) "base64"
29  ["scalar"]=>
30  float(73588229205)
31}
32