summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/dom/tests/bug37456.phpt22
-rw-r--r--ext/dom/tests/dom.ent8
-rw-r--r--ext/dom/tests/dom.xml8
3 files changed, 38 insertions, 0 deletions
diff --git a/ext/dom/tests/bug37456.phpt b/ext/dom/tests/bug37456.phpt
new file mode 100644
index 0000000000..904712f4b1
--- /dev/null
+++ b/ext/dom/tests/bug37456.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug # 37456 (DOMElement->setAttribute() loops forever)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument();
+$doc->resolveExternals = true;
+$doc->load(dirname(__FILE__)."/dom.xml");
+
+$root = $doc->getElementsByTagName('foo')->item(0);
+$root->setAttribute('bar', '&gt;');
+$attr = $root->setAttribute('bar', 'newval');
+print $attr->nodeValue;
+
+
+?>
+--EXPECT--
+
+newval
+
diff --git a/ext/dom/tests/dom.ent b/ext/dom/tests/dom.ent
new file mode 100644
index 0000000000..987ff9dc0f
--- /dev/null
+++ b/ext/dom/tests/dom.ent
@@ -0,0 +1,8 @@
+<!ENTITY amp "&#38;#38;">
+<!ENTITY gt "&#62;">
+<!ENTITY % coreattrs "title CDATA #IMPLIED">
+<!ENTITY % attrs "%coreattrs;">
+<!ATTLIST foo bar CDATA #IMPLIED>
+<!ELEMENT foo (#PCDATA)>
+<!ELEMENT root (foo)+>
+<!ATTLIST th %attrs; > \ No newline at end of file
diff --git a/ext/dom/tests/dom.xml b/ext/dom/tests/dom.xml
new file mode 100644
index 0000000000..09ac674e55
--- /dev/null
+++ b/ext/dom/tests/dom.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE root [
+<!ENTITY % incent SYSTEM "dom.ent">
+%incent;
+]>
+<root>
+ <foo bar="" />
+</root> \ No newline at end of file