]> granicus.if.org Git - php/commitdiff
testcase for bug26384
authorChristian Stocker <chregu@php.net>
Sat, 29 Nov 2003 16:38:09 +0000 (16:38 +0000)
committerChristian Stocker <chregu@php.net>
Sat, 29 Nov 2003 16:38:09 +0000 (16:38 +0000)
ext/xsl/tests/area_list.xsl [new file with mode: 0644]
ext/xsl/tests/area_name.xml [new file with mode: 0644]
ext/xsl/tests/bug26384.phpt [new file with mode: 0644]

diff --git a/ext/xsl/tests/area_list.xsl b/ext/xsl/tests/area_list.xsl
new file mode 100644 (file)
index 0000000..45b6cff
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\r
+       \r
+       <xsl:output method="text" encoding="UTF-8"/>\r
+       \r
+       <xsl:key name="area" match="ROW" use="substring(translate(AREA_NAME, '&quot;', ''), 1, 1)"/>\r
+<xsl:template match="*">\r
+    HERE\r
+</xsl:template>\r
+</xsl:stylesheet>\r
diff --git a/ext/xsl/tests/area_name.xml b/ext/xsl/tests/area_name.xml
new file mode 100644 (file)
index 0000000..55e38cd
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<AREA_NAME>\r
+ <ROW>\r
+  <AREA_CODE>13</AREA_CODE>\r
+  <AREA_NAME>&quot;Автово&quot; м.</AREA_NAME>\r
+  <AREA_NAME_ENG>m.&quot;Avtovo&quot;</AREA_NAME_ENG>\r
+ </ROW>\r
+</AREA_NAME>\r
+\r
diff --git a/ext/xsl/tests/bug26384.phpt b/ext/xsl/tests/bug26384.phpt
new file mode 100644 (file)
index 0000000..b8f80f8
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+Bug #26384 (domxslt->process causes segfault with xsl:key)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$dom = new domDocument;
+$dom->load(dirname(__FILE__)."/area_name.xml");
+if(!$dom) {
+  echo "Error while parsing the document\n";
+  exit;
+}
+$xsl = new domDocument;
+$xsl->load(dirname(__FILE__)."/area_list.xsl");
+if(!$xsl) {
+  echo "Error while parsing the document\n";
+  exit;
+}
+$proc = new xsltprocessor;
+if(!$proc) {
+  echo "Error while making xsltprocessor object\n";
+  exit;
+}
+
+$proc->importStylesheet($xsl);
+print $proc->transformToXml($dom);
+
+//this segfaulted before
+print $dom->documentElement->firstChild->nextSibling->nodeName;
+
+--EXPECT--
+HERE
+ROW