xref: /plugin/davcal/vendor/sabre/xml/tests/Sabre/Xml/InfiteLoopTest.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\Xml;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehlerclass InfiteLoopTest extends \PHPUnit_Framework_TestCase {
6*a1a3b679SAndreas Boehler
7*a1a3b679SAndreas Boehler    /**
8*a1a3b679SAndreas Boehler     * This particular xml body caused the parser to go into an infinite loop.
9*a1a3b679SAndreas Boehler     * Need to know why.
10*a1a3b679SAndreas Boehler     */
11*a1a3b679SAndreas Boehler    function testDeserialize() {
12*a1a3b679SAndreas Boehler
13*a1a3b679SAndreas Boehler        $body = '<?xml version="1.0"?>
14*a1a3b679SAndreas Boehler<d:propertyupdate xmlns:d="DAV:" xmlns:s="http://sabredav.org/NS/test">
15*a1a3b679SAndreas Boehler  <d:set><d:prop></d:prop></d:set>
16*a1a3b679SAndreas Boehler  <d:set><d:prop></d:prop></d:set>
17*a1a3b679SAndreas Boehler</d:propertyupdate>';
18*a1a3b679SAndreas Boehler
19*a1a3b679SAndreas Boehler        $reader = new Reader();
20*a1a3b679SAndreas Boehler        $reader->elementMap = [
21*a1a3b679SAndreas Boehler            '{DAV:}set' => 'Sabre\\Xml\\Element\\KeyValue',
22*a1a3b679SAndreas Boehler        ];
23*a1a3b679SAndreas Boehler        $reader->xml($body);
24*a1a3b679SAndreas Boehler
25*a1a3b679SAndreas Boehler        $output = $reader->parse();
26*a1a3b679SAndreas Boehler
27*a1a3b679SAndreas Boehler        $this->assertEquals([
28*a1a3b679SAndreas Boehler            'name'  => '{DAV:}propertyupdate',
29*a1a3b679SAndreas Boehler            'value' => [
30*a1a3b679SAndreas Boehler                [
31*a1a3b679SAndreas Boehler                    'name'  => '{DAV:}set',
32*a1a3b679SAndreas Boehler                    'value' => [
33*a1a3b679SAndreas Boehler                        '{DAV:}prop' => null,
34*a1a3b679SAndreas Boehler                    ],
35*a1a3b679SAndreas Boehler                    'attributes' => [],
36*a1a3b679SAndreas Boehler                ],
37*a1a3b679SAndreas Boehler                [
38*a1a3b679SAndreas Boehler                    'name'  => '{DAV:}set',
39*a1a3b679SAndreas Boehler                    'value' => [
40*a1a3b679SAndreas Boehler                        '{DAV:}prop' => null,
41*a1a3b679SAndreas Boehler                    ],
42*a1a3b679SAndreas Boehler                    'attributes' => [],
43*a1a3b679SAndreas Boehler                ],
44*a1a3b679SAndreas Boehler            ],
45*a1a3b679SAndreas Boehler            'attributes' => [],
46*a1a3b679SAndreas Boehler        ], $output);
47*a1a3b679SAndreas Boehler
48*a1a3b679SAndreas Boehler    }
49*a1a3b679SAndreas Boehler
50*a1a3b679SAndreas Boehler}
51