mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 09:34:08 +02:00
Merge pull request #10 from kesselb/master
Add test case for !$reader->read then break
This commit is contained in:
commit
9b78893f83
3 changed files with 38 additions and 3 deletions
|
|
@ -81,9 +81,9 @@ class Operator implements XmlDeserializable {
|
|||
$operator->arguments[] = $argument['value'];
|
||||
}
|
||||
} else {
|
||||
if (!$reader->read()) {
|
||||
break;
|
||||
}
|
||||
if (!$reader->read()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while ($reader->nodeType !== Reader::END_ELEMENT);
|
||||
|
||||
|
|
|
|||
|
|
@ -177,4 +177,17 @@ class QueryParserTest extends TestCase {
|
|||
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::ASC)
|
||||
], $search->orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Sabre\Xml\LibXMLException
|
||||
* @expectedExceptionMessage Opening and ending tag mismatch: prop line 17 and gt
|
||||
* on line 19, column 20
|
||||
*
|
||||
* @throws \Sabre\Xml\ParseException
|
||||
*/
|
||||
public function testParseWhereBroken()
|
||||
{
|
||||
$query = file_get_contents(__DIR__ . '/invalidwherebroken.xml');
|
||||
(new QueryParser())->parse($query, null, $rootElementName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
tests/invalidwherebroken.xml
Normal file
22
tests/invalidwherebroken.xml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0"?>
|
||||
<d:searchrequest xmlns:d="DAV:" xmlns:oc="http://ns.nextcloud.com">
|
||||
<d:basicsearch>
|
||||
<d:select>
|
||||
<d:prop>
|
||||
<d:getcontentlength/>
|
||||
</d:prop>
|
||||
</d:select>
|
||||
<d:from>
|
||||
<d:scope>
|
||||
<d:href>/container1/</d:href>
|
||||
<d:depth>infinity</d:depth>
|
||||
</d:scope>
|
||||
</d:from>
|
||||
<d:where>
|
||||
<d:gt>
|
||||
<d:prop>
|
||||
<d:literal>5</d:literal>
|
||||
</d:gt>
|
||||
</d:where>
|
||||
</d:basicsearch>
|
||||
</d:searchrequest>
|
||||
Loading…
Add table
Add a link
Reference in a new issue