xref: /PHP-7.0/ext/wddx/tests/bug71587.phpt (revision b1bd4119)
1--TEST--
2Bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize)
3--SKIPIF--
4<?php
5if (!extension_loaded("wddx")) print "skip";
6?>
7--FILE--
8<?php
9
10$xml = <<<EOF
11<?xml version='1.0' ?>
12<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>
13<wddxPacket version='1.0'>
14    <array>
15         <var name='ML'></var>
16            <string>manhluat</string>
17         <var name='ML2'></var>
18         	<boolean value='a'/>
19         <boolean value='true'/>
20    </array>
21</wddxPacket>
22EOF;
23
24$wddx = wddx_deserialize($xml);
25var_dump($wddx);
26// Print mem leak
27foreach($wddx as $k=>$v)
28	printf("Key: %s\nValue: %s\n",bin2hex($k),bin2hex($v));
29
30?>
31DONE
32--EXPECTF--
33array(2) {
34  [0]=>
35  string(8) "manhluat"
36  [1]=>
37  bool(true)
38}
39Key: 30
40Value: 6d616e686c756174
41Key: 31
42Value: 31
43DONE
44