]> granicus.if.org Git - php/commitdiff
Add regression test for bug #73053
authorChristoph M. Becker <cmbecker69@gmx.de>
Sat, 10 Sep 2016 22:06:45 +0000 (00:06 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sat, 10 Sep 2016 22:06:45 +0000 (00:06 +0200)
The test succeeds with libxml < 2.9.4, and is supposed to succeed with
libxml > 2.9.4. Unfortunately, we can't conditionally mark a test case
as XFAIL, so we're simply skipping the test for libxml 2.9.4 instead.

ext/xmlreader/tests/bug73053.phpt [new file with mode: 0644]
ext/xmlreader/tests/bug73053.xml [new file with mode: 0644]
ext/xmlreader/tests/bug73053.xsd [new file with mode: 0644]

diff --git a/ext/xmlreader/tests/bug73053.phpt b/ext/xmlreader/tests/bug73053.phpt
new file mode 100644 (file)
index 0000000..4a7ace5
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+Bug #73053 (XML reader with setSchema now fails under 5.6.25)
+--SKIPIF--
+<?php
+if (!extension_loaded('xmlreader')) die('skip xmlreader extension not available');
+if (LIBXML_VERSION === 20904) die('skip fails with libxml 2.9.4');
+?>
+--FILE--
+<?php
+$xmlfile = __DIR__ . DIRECTORY_SEPARATOR . 'bug73053.xml';
+$xsdfile = __DIR__ . DIRECTORY_SEPARATOR . 'bug73053.xsd';
+
+$xml = new XMLReader();
+var_dump($xml->open($xmlfile, null, LIBXML_PARSEHUGE));
+$xml->setSchema($xsdfile);
+while($xml->read());
+?>
+===DONE===
+--EXPECT--
+bool(true)
+===DONE===
diff --git a/ext/xmlreader/tests/bug73053.xml b/ext/xmlreader/tests/bug73053.xml
new file mode 100644 (file)
index 0000000..8f29dc2
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<x:books xmlns:x="urn:books">
+   <book id="1">
+      <author>Writer</author>
+      <title>The First Book</title>
+      <genre>Fiction</genre>
+      <price>44.95</price>
+      <pub_date>2000-10-01</pub_date>
+      <review>An amazing story of nothing.</review>
+   </book>
+</x:books>
diff --git a/ext/xmlreader/tests/bug73053.xsd b/ext/xmlreader/tests/bug73053.xsd
new file mode 100644 (file)
index 0000000..bbfe42c
--- /dev/null
@@ -0,0 +1,27 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="urn:books"
+            xmlns:bks="urn:books">
+
+  <xsd:element name="books" type="bks:BooksForm"/>
+
+  <xsd:complexType name="BooksForm">
+    <xsd:sequence>
+      <xsd:element name="book" 
+                  type="bks:BookForm" 
+                  minOccurs="0" 
+                  maxOccurs="unbounded"/>
+      </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="BookForm">
+    <xsd:sequence>
+      <xsd:element name="author"   type="xsd:string"/>
+      <xsd:element name="title"    type="xsd:string"/>
+      <xsd:element name="genre"    type="xsd:string"/>
+      <xsd:element name="price"    type="xsd:float" />
+      <xsd:element name="pub_date" type="xsd:date" />
+      <xsd:element name="review"   type="xsd:string"/>
+    </xsd:sequence>
+    <xsd:attribute name="id"   type="xsd:positiveInteger"/>
+  </xsd:complexType>
+</xsd:schema>