diff --git a/hphp/test/zend/bad/ext-simplexml/000.php b/hphp/test/zend/bad/ext-simplexml/000.php
new file mode 100644
index 000000000..d12090f4e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/000.php
@@ -0,0 +1,34 @@
+elem1');
+test('sxe->elem1[0]');
+test('sxe->elem1[0]->elem2');
+test('sxe->elem1[0]->elem2->bla');
+if (!ini_get("unicode_semantics")) test('sxe->elem1[0]["attr1"]');
+test('sxe->elem1[0]->attr1');
+test('sxe->elem1[1]');
+test('sxe->elem1[2]');
+test('sxe->elem11');
+test('sxe->elem11->elem111');
+test('sxe->elem11->elem111->elem1111');
+test('sxe->elem22');
+test('sxe->elem22->elem222');
+test('sxe->elem22->attr22');
+test('sxe->elem22["attr22"]');
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/000.php.expectf b/hphp/test/zend/bad/ext-simplexml/000.php.expectf
new file mode 100644
index 000000000..1e13ae880
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/000.php.expectf
@@ -0,0 +1,214 @@
+===sxe
+bool(true)
+bool(true)
+int(3)
+object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(3) "123"
+ }
+ ["elem1"]=>
+ array(2) {
+ [0]=>
+ string(36) "There is some text.Here is some more"
+ [1]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(2) {
+ ["attr1"]=>
+ string(2) "11"
+ ["attr2"]=>
+ string(2) "12"
+ }
+ }
+ }
+ ["elem11"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem111"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem1111"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+}
+===sxe->elem1
+bool(true)
+bool(true)
+int(2)
+object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(2) {
+ ["attr1"]=>
+ string(5) "first"
+ ["attr2"]=>
+ string(6) "second"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(2) {
+ ["att25"]=>
+ string(2) "25"
+ ["att42"]=>
+ string(2) "42"
+ }
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+}
+===sxe->elem1[0]
+bool(true)
+bool(true)
+int(1)
+object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(2) {
+ ["attr1"]=>
+ string(5) "first"
+ ["attr2"]=>
+ string(6) "second"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(2) {
+ ["att25"]=>
+ string(2) "25"
+ ["att42"]=>
+ string(2) "42"
+ }
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+}
+===sxe->elem1[0]->elem2
+bool(true)
+bool(true)
+int(1)
+object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(2) {
+ ["att25"]=>
+ string(2) "25"
+ ["att42"]=>
+ string(2) "42"
+ }
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+}
+===sxe->elem1[0]->elem2->bla
+bool(false)
+bool(false)
+int(0)
+object(SimpleXMLElement)#%d (0) {
+}
+===sxe->elem1[0]["attr1"]
+bool(true)
+bool(true)
+int(0)
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "first"
+}
+===sxe->elem1[0]->attr1
+bool(false)
+bool(false)
+int(0)
+object(SimpleXMLElement)#%d (0) {
+}
+===sxe->elem1[1]
+bool(true)
+bool(true)
+int(0)
+object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(2) {
+ ["attr1"]=>
+ string(2) "11"
+ ["attr2"]=>
+ string(2) "12"
+ }
+}
+===sxe->elem1[2]
+bool(false)
+bool(false)
+int(0)
+NULL
+===sxe->elem11
+bool(true)
+bool(true)
+int(1)
+object(SimpleXMLElement)#%d (1) {
+ ["elem111"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem1111"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+}
+===sxe->elem11->elem111
+bool(true)
+bool(true)
+int(1)
+object(SimpleXMLElement)#%d (1) {
+ ["elem1111"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+}
+===sxe->elem11->elem111->elem1111
+bool(true)
+bool(true)
+int(1)
+object(SimpleXMLElement)#%d (0) {
+}
+===sxe->elem22
+bool(false)
+bool(false)
+int(0)
+object(SimpleXMLElement)#%d (0) {
+}
+===sxe->elem22->elem222
+bool(false)
+bool(false)
+int(0)
+NULL
+===sxe->elem22->attr22
+bool(false)
+bool(false)
+int(0)
+NULL
+===sxe->elem22["attr22"]
+bool(false)
+bool(false)
+int(0)
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/001.php b/hphp/test/zend/bad/ext-simplexml/001.php
new file mode 100644
index 000000000..8c536711b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/001.php
@@ -0,0 +1,6 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/001.php.expectf b/hphp/test/zend/bad/ext-simplexml/001.php.expectf
new file mode 100644
index 000000000..075407628
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/001.php.expectf
@@ -0,0 +1,31 @@
+object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/002.php b/hphp/test/zend/bad/ext-simplexml/002.php
new file mode 100644
index 000000000..781fc31db
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/002.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+$copy = clone $sxe;
+
+var_dump($copy);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/002.php.expectf b/hphp/test/zend/bad/ext-simplexml/002.php.expectf
new file mode 100644
index 000000000..075407628
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/002.php.expectf
@@ -0,0 +1,31 @@
+object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/003.php b/hphp/test/zend/bad/ext-simplexml/003.php
new file mode 100644
index 000000000..89b155f3f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/003.php
@@ -0,0 +1,27 @@
+
+
+]>
+
+ Plain text.
+
+
+
+
+ &included-entity;
+
+
+
+
+
+
+
+EOF;
+
+var_dump(simplexml_load_string($xml));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/003.php.expectf b/hphp/test/zend/bad/ext-simplexml/003.php.expectf
new file mode 100644
index 000000000..38297b358
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/003.php.expectf
@@ -0,0 +1,36 @@
+object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (2) {
+ ["included-entity"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["included-entity"]=>
+ string(36) "This is text included from an entity"
+ }
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/004.php b/hphp/test/zend/bad/ext-simplexml/004.php
new file mode 100644
index 000000000..929eb7490
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/004.php
@@ -0,0 +1,30 @@
+
+
+
+ Plain text.
+
+
+
+
+
+
+
+
+
+
+
+
+EOF
+);
+
+var_dump($sxe);
+
+$elem1 = $sxe->elem1;
+$elem2 = $elem1->elem2;
+var_dump(trim((string)$elem2));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/004.php.expectf b/hphp/test/zend/bad/ext-simplexml/004.php.expectf
new file mode 100644
index 000000000..a403bdda4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/004.php.expectf
@@ -0,0 +1,32 @@
+object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+ }
+}
+string(11) "CDATA block"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/005.php b/hphp/test/zend/bad/ext-simplexml/005.php
new file mode 100644
index 000000000..d280bfe41
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/005.php
@@ -0,0 +1,30 @@
+
+
+
+ Plain text.
+
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+EOF
+);
+
+var_dump(trim($sxe->elem1->elem2));
+var_dump(trim($sxe->elem1->elem2->elem3));
+var_dump(trim($sxe->elem1->elem2->elem3->elem4));
+
+echo "---Done---\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/005.php.expectf b/hphp/test/zend/bad/ext-simplexml/005.php.expectf
new file mode 100644
index 000000000..4a298ee6a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/005.php.expectf
@@ -0,0 +1,4 @@
+string(28) "Here we have some text data."
+string(19) "And here some more."
+string(15) "Wow once again."
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/006.php b/hphp/test/zend/bad/ext-simplexml/006.php
new file mode 100644
index 000000000..1a76cf143
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/006.php
@@ -0,0 +1,58 @@
+
+
+
+ Plain text.
+
+ Bla bla 1.
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+ Bla bla 2.
+
+ Foo Bar
+
+
+
+EOF
+);
+
+foreach($sxe as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+echo "===CLONE===\n";
+
+foreach(clone $sxe as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+echo "===ELEMENT===\n";
+
+foreach($sxe->elem11 as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+echo "===COMMENT===\n";
+
+foreach($sxe->elem1 as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/006.php.expectf b/hphp/test/zend/bad/ext-simplexml/006.php.expectf
new file mode 100644
index 000000000..70593edef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/006.php.expectf
@@ -0,0 +1,16 @@
+string(5) "elem1"
+string(10) "Bla bla 1."
+string(6) "elem11"
+string(10) "Bla bla 2."
+===CLONE===
+string(5) "elem1"
+string(10) "Bla bla 1."
+string(6) "elem11"
+string(10) "Bla bla 2."
+===ELEMENT===
+string(6) "elem11"
+string(10) "Bla bla 2."
+===COMMENT===
+string(5) "elem1"
+string(10) "Bla bla 1."
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/007.php b/hphp/test/zend/bad/ext-simplexml/007.php
new file mode 100644
index 000000000..3f3d23609
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/007.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+echo "===Property===\n";
+var_dump($sxe->elem1);
+echo "===Array===\n";
+var_dump($sxe['id']);
+var_dump($sxe->elem1['attr1']);
+echo "===Set===\n";
+$sxe['id'] = "Changed1";
+var_dump($sxe['id']);
+$sxe->elem1['attr1'] = 12;
+var_dump($sxe->elem1['attr1']);
+echo "===Unset===\n";
+unset($sxe['id']);
+var_dump($sxe['id']);
+unset($sxe->elem1['attr1']);
+var_dump($sxe->elem1['attr1']);
+echo "===Misc.===\n";
+$a = 4;
+var_dump($a);
+$dummy = $sxe->elem1[$a];
+var_dump($a);
+?>
+===Done===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/007.php.expectf b/hphp/test/zend/bad/ext-simplexml/007.php.expectf
new file mode 100644
index 000000000..f83ba7e0d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/007.php.expectf
@@ -0,0 +1,48 @@
+===Property===
+object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem3"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+ }
+ }
+}
+===Array===
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "elem1"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "first"
+}
+===Set===
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(8) "Changed1"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "12"
+}
+===Unset===
+NULL
+NULL
+===Misc.===
+int(4)
+int(4)
+===Done===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/008.php b/hphp/test/zend/bad/ext-simplexml/008.php
new file mode 100644
index 000000000..4f2fe5149
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/008.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump($sxe->xpath("elem1/elem2/elem3/elem4"));
+//valid expression
+var_dump($sxe->xpath("***"));
+//invalid expression
+var_dump($sxe->xpath("**"));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/008.php.expectf b/hphp/test/zend/bad/ext-simplexml/008.php.expectf
new file mode 100644
index 000000000..5e8cf7c38
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/008.php.expectf
@@ -0,0 +1,13 @@
+array(1) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+ }
+}
+array(0) {
+}
+HipHop Warning: %a
+HipHop Warning: %a
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/009b.php b/hphp/test/zend/bad/ext-simplexml/009b.php
new file mode 100644
index 000000000..744ea167c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/009b.php
@@ -0,0 +1,17 @@
+
+
+
+ Plain text.
+ Bla bla 1.
+ Here we have some text data.
+
+ Bla bla 2.
+
+EOF
+);
+var_dump($sxe->children());
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/009b.php.expectf b/hphp/test/zend/bad/ext-simplexml/009b.php.expectf
new file mode 100644
index 000000000..ca8035074
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/009b.php.expectf
@@ -0,0 +1,12 @@
+object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ string(10) "Bla bla 1."
+ ["elem11"]=>
+ string(10) "Bla bla 2."
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/012.php b/hphp/test/zend/bad/ext-simplexml/012.php
new file mode 100644
index 000000000..637512ad4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/012.php
@@ -0,0 +1,24 @@
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+
+$sxe[""] = "warning";
+$sxe["attr"] = "value";
+
+echo $sxe->asXML();
+
+$sxe["attr"] = "new value";
+
+echo $sxe->asXML();
+
+$sxe[] = "error";
+
+__HALT_COMPILER();
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/012.php.expectf b/hphp/test/zend/bad/ext-simplexml/012.php.expectf
new file mode 100644
index 000000000..aec9e1889
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/012.php.expectf
@@ -0,0 +1,6 @@
+HipHop Warning: %a
+
+
+
+
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/013.php b/hphp/test/zend/bad/ext-simplexml/013.php
new file mode 100644
index 000000000..8048d3a81
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/013.php
@@ -0,0 +1,13 @@
+
+barbar
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump((string)$sxe);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/013.php.expectf b/hphp/test/zend/bad/ext-simplexml/013.php.expectf
new file mode 100644
index 000000000..b8b272a1e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/013.php.expectf
@@ -0,0 +1,2 @@
+string(6) "barbar"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/014.php b/hphp/test/zend/bad/ext-simplexml/014.php
new file mode 100644
index 000000000..e3bcc022a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/014.php
@@ -0,0 +1,27 @@
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person['name']);
+var_dump($people->person['age']);
+$person = $people->person;
+$person['name'] = "XXX";
+var_dump($people->person['name']);
+$people->person['age'] = 30;
+var_dump($people->person['age']);
+echo "---Unset:---\n";
+unset($people->person['age']);
+echo "---Unset?---\n";
+var_dump($people->person['age']);
+var_dump(isset($people->person['age']));
+$people->person['age'] = 30;
+echo "---Unsupported---\n";
+var_dump($people->person['age']);
+$people->person['age'] += 5;
+var_dump($people->person['age']);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/014.php.expectf b/hphp/test/zend/bad/ext-simplexml/014.php.expectf
new file mode 100644
index 000000000..4bd30db8f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/014.php.expectf
@@ -0,0 +1,27 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+NULL
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "XXX"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "30"
+}
+---Unset:---
+---Unset?---
+NULL
+bool(false)
+---Unsupported---
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "30"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "35"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/014a.php b/hphp/test/zend/bad/ext-simplexml/014a.php
new file mode 100644
index 000000000..4d6d280b1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/014a.php
@@ -0,0 +1,26 @@
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person[0]['name']);
+var_dump($people->person[0]['age']);
+$person = $people->person[0];
+$person['name'] = "XXX";
+var_dump($people->person[0]['name']);
+$people->person[0]['age'] = 30;
+var_dump($people->person[0]['age']);
+echo "---Unset:---\n";
+unset($people->person[0]['age']);
+echo "---Unset?---\n";
+var_dump($people->person[0]['age']);
+var_dump(isset($people->person[0]['age']));
+echo "---Unsupported---\n";
+var_dump($people->person[0]['age']);
+$people->person['age'] += 5;
+var_dump($people->person[0]['age']);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/014a.php.expectf b/hphp/test/zend/bad/ext-simplexml/014a.php.expectf
new file mode 100644
index 000000000..aef7e21e0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/014a.php.expectf
@@ -0,0 +1,24 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+NULL
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "XXX"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "30"
+}
+---Unset:---
+---Unset?---
+NULL
+bool(false)
+---Unsupported---
+NULL
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(1) "5"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/014b.php b/hphp/test/zend/bad/ext-simplexml/014b.php
new file mode 100644
index 000000000..6e1553fa1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/014b.php
@@ -0,0 +1,26 @@
+
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person[0]['name']);
+var_dump($people->person[1]['age']);
+$person = $people->person[1];
+$person['name'] = "XXX";
+var_dump($people->person[1]['name']);
+$people->person[1]['age'] = 30;
+var_dump($people->person[1]['age']);
+echo "---Unset:---\n";
+unset($people->person[1]['age']);
+echo "---Unset?---\n";
+var_dump($people->person[1]['age']);
+var_dump(isset($people->person[1]['age']));
+echo "---Unsupported---\n";
+$people->person[1]['age'] += 5;
+var_dump($people->person[1]['age']);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/014b.php.expectf b/hphp/test/zend/bad/ext-simplexml/014b.php.expectf
new file mode 100644
index 000000000..4c571e015
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/014b.php.expectf
@@ -0,0 +1,23 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+NULL
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "XXX"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "30"
+}
+---Unset:---
+---Unset?---
+NULL
+bool(false)
+---Unsupported---
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(1) "5"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/015.php b/hphp/test/zend/bad/ext-simplexml/015.php
new file mode 100644
index 000000000..b74d20ede
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/015.php
@@ -0,0 +1,33 @@
+
+
+
+EOF;
+
+$xml2 =<<
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person['name']);
+var_dump($people->person[0]['name']);
+//$people->person['name'] = "XXX";
+//var_dump($people->person['name']);
+//var_dump($people->person[0]['name']);
+//$people->person[0]['name'] = "YYY";
+//var_dump($people->person['name']);
+//var_dump($people->person[0]['name']);
+//unset($people->person[0]['name']);
+//var_dump($people->person['name']);
+//var_dump($people->person[0]['name']);
+//var_dump(isset($people->person['name']));
+//var_dump(isset($people->person[0]['name']));
+$people = simplexml_load_string($xml2);
+var_dump($people->person[0]['name']);
+var_dump($people->person[1]['name']);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/015.php.expectf b/hphp/test/zend/bad/ext-simplexml/015.php.expectf
new file mode 100644
index 000000000..3bcae6cbc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/015.php.expectf
@@ -0,0 +1,17 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Boe"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/016.php b/hphp/test/zend/bad/ext-simplexml/016.php
new file mode 100644
index 000000000..5fde9b939
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/016.php
@@ -0,0 +1,25 @@
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person['name']);
+$people->person['name'] = $people->person['name'] . 'Foo';
+var_dump($people->person['name']);
+$people->person['name'] .= 'Bar';
+var_dump($people->person['name']);
+
+echo "---[0]---\n";
+
+$people = simplexml_load_string($xml);
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] = $people->person[0]['name'] . 'Foo';
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] .= 'Bar';
+var_dump($people->person[0]['name']);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/016.php.expectf b/hphp/test/zend/bad/ext-simplexml/016.php.expectf
new file mode 100644
index 000000000..200dce586
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/016.php.expectf
@@ -0,0 +1,26 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(6) "JoeFoo"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(9) "JoeFooBar"
+}
+---[0]---
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Joe"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(6) "JoeFoo"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(9) "JoeFooBar"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/016a.php b/hphp/test/zend/bad/ext-simplexml/016a.php
new file mode 100644
index 000000000..a05027eb8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/016a.php
@@ -0,0 +1,14 @@
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+var_dump($people->person['name']);
+$people->person['name'] .= 'Bar';
+var_dump($people->person['name']);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/016a.php.expectf b/hphp/test/zend/bad/ext-simplexml/016a.php.expectf
new file mode 100644
index 000000000..4b8f23266
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/016a.php.expectf
@@ -0,0 +1,9 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(3) "Foo"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(6) "FooBar"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/017.php b/hphp/test/zend/bad/ext-simplexml/017.php
new file mode 100644
index 000000000..fcb406cb9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/017.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+EOF;
+$xml1 =<<
+
+
+
+
+EOF;
+
+function print_xml($xml) {
+ foreach($xml->children() as $person) {
+ echo "person: ".$person['name']."\n";
+ foreach($person->children() as $child) {
+ echo " child: ".$child['name']."\n";
+ }
+ }
+}
+
+function print_xml2($xml) {
+ $persons = 2;
+ for ($i=0;$i<$persons;$i++) {
+ echo "person: ".$xml->person[$i]['name']."\n";
+ $children = 2;
+ for ($j=0;$j<$children;$j++) {
+ echo " child: ".$xml->person[$i]->child[$j]['name']."\n";
+ }
+ }
+}
+
+echo "---11---\n";
+print_xml(simplexml_load_string($xml));
+echo "---12---\n";
+print_xml(simplexml_load_string($xml1));
+echo "---21---\n";
+print_xml2(simplexml_load_string($xml));
+echo "---22---\n";
+print_xml2(simplexml_load_string($xml1));
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/017.php.expectf b/hphp/test/zend/bad/ext-simplexml/017.php.expectf
new file mode 100644
index 000000000..e6eb06319
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/017.php.expectf
@@ -0,0 +1,27 @@
+---11---
+person: Joe
+ child: Ann
+ child: Marray
+person: Boe
+ child: Joe
+ child: Ann
+---12---
+person: Joe
+ child: Ann
+---21---
+person: Joe
+ child: Ann
+ child: Marray
+person: Boe
+ child: Joe
+ child: Ann
+---22---
+person: Joe
+ child: Ann
+ child:
+person:
+HipHop Notice: %a
+ child:
+HipHop Notice: %a
+ child:
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/018.php b/hphp/test/zend/bad/ext-simplexml/018.php
new file mode 100644
index 000000000..e84634a89
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/018.php
@@ -0,0 +1,41 @@
+
+
+ Text1
+
+ Text2
+
+ Text3
+
+
+
+
+
+
+EOF;
+$xml1 =<<
+
+
+
+
+EOF;
+
+function traverse_xml($pad,$xml) {
+ foreach($xml->children() as $name => $node) {
+ echo $pad."<$name";
+ foreach($node->attributes() as $attr => $value) {
+ echo " $attr=\"$value\"";
+ }
+ echo ">\n";
+ traverse_xml($pad." ",$node);
+ echo $pad."$name>\n";
+ }
+}
+
+traverse_xml("",simplexml_load_string($xml));
+echo "----------\n";
+traverse_xml("",simplexml_load_string($xml1));
+echo "---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/018.php.expectf b/hphp/test/zend/bad/ext-simplexml/018.php.expectf
new file mode 100644
index 000000000..63987cad6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/018.php.expectf
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+----------
+
+
+
+
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/019.php b/hphp/test/zend/bad/ext-simplexml/019.php
new file mode 100644
index 000000000..910cc8ae1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/019.php
@@ -0,0 +1,58 @@
+
+
+
+ Plain text.
+
+ Bla bla 1.
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+ Bla bla 2.
+
+ Foo Bar
+
+
+
+EOF
+);
+
+foreach($sxe->children() as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+echo "===CLONE===\n";
+
+foreach(clone $sxe->children() as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+echo "===ELEMENT===\n";
+
+foreach($sxe->elem11->children() as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+echo "===COMMENT===\n";
+
+foreach($sxe->elem1->children() as $name => $data) {
+ var_dump($name);
+ var_dump(trim($data));
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/019.php.expectf b/hphp/test/zend/bad/ext-simplexml/019.php.expectf
new file mode 100644
index 000000000..7caa5bf91
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/019.php.expectf
@@ -0,0 +1,16 @@
+string(5) "elem1"
+string(10) "Bla bla 1."
+string(6) "elem11"
+string(10) "Bla bla 2."
+===CLONE===
+string(5) "elem1"
+string(10) "Bla bla 1."
+string(6) "elem11"
+string(10) "Bla bla 2."
+===ELEMENT===
+string(7) "elem111"
+string(7) "Foo Bar"
+===COMMENT===
+string(5) "elem2"
+string(28) "Here we have some text data."
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/022.php b/hphp/test/zend/bad/ext-simplexml/022.php
new file mode 100644
index 000000000..5ab8f5c97
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/022.php
@@ -0,0 +1,24 @@
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+echo "===CONTENT===\n";
+var_dump($sxe->content);
+
+echo "===FILE===\n";
+var_dump($sxe->content->file);
+
+echo "===FOREACH===\n";
+foreach($sxe->content->file as $file)
+{
+ var_dump($file);
+ var_dump($file['glob']);
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/022.php.expectf b/hphp/test/zend/bad/ext-simplexml/022.php.expectf
new file mode 100644
index 000000000..feb36d884
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/022.php.expectf
@@ -0,0 +1,32 @@
+===CONTENT===
+object(SimpleXMLElement)#%d (1) {
+ ["file"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["glob"]=>
+ string(11) "slide_*.xml"
+ }
+ }
+}
+===FILE===
+object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["glob"]=>
+ string(11) "slide_*.xml"
+ }
+}
+===FOREACH===
+object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["glob"]=>
+ string(11) "slide_*.xml"
+ }
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(11) "slide_*.xml"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/023.php b/hphp/test/zend/bad/ext-simplexml/023.php
new file mode 100644
index 000000000..a304e30a0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/023.php
@@ -0,0 +1,18 @@
+
+
+
+
+]>
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump($sxe);
+var_dump($sxe['attr']);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/023.php.expectf b/hphp/test/zend/bad/ext-simplexml/023.php.expectf
new file mode 100644
index 000000000..fb8741574
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/023.php.expectf
@@ -0,0 +1,12 @@
+object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr"]=>
+ string(%d) "foo%sbar%sbaz"
+ }
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(%d) "foo%sbar%sbaz"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/024.php b/hphp/test/zend/bad/ext-simplexml/024.php
new file mode 100644
index 000000000..c5a90ec90
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/024.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+function test($xpath)
+{
+ global $sxe;
+
+ echo "===$xpath===\n";
+ var_dump($sxe->xpath($xpath));
+}
+
+test('elem/@attr2');
+test('//@attr2');
+test('//@*');
+test('elem[2]/@attr2');
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/024.php.expectf b/hphp/test/zend/bad/ext-simplexml/024.php.expectf
new file mode 100644
index 000000000..f59a83071
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/024.php.expectf
@@ -0,0 +1,141 @@
+===elem/@attr2===
+array(3) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "12"
+ }
+ }
+ [1]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "22"
+ }
+ }
+ [2]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "32"
+ }
+ }
+}
+===//@attr2===
+array(3) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "12"
+ }
+ }
+ [1]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "22"
+ }
+ }
+ [2]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "32"
+ }
+ }
+}
+===//@*===
+array(9) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(2) "11"
+ }
+ }
+ [1]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "12"
+ }
+ }
+ [2]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr3"]=>
+ string(2) "13"
+ }
+ }
+ [3]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(2) "21"
+ }
+ }
+ [4]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "22"
+ }
+ }
+ [5]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr3"]=>
+ string(2) "23"
+ }
+ }
+ [6]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(2) "31"
+ }
+ }
+ [7]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "32"
+ }
+ }
+ [8]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr3"]=>
+ string(2) "33"
+ }
+ }
+}
+===elem[2]/@attr2===
+array(1) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr2"]=>
+ string(2) "22"
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/027.php b/hphp/test/zend/bad/ext-simplexml/027.php
new file mode 100644
index 000000000..a6b6f0e4e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/027.php
@@ -0,0 +1,40 @@
+
+EOF;
+
+function traverse_xml($xml, $pad = '')
+{
+ $name = $xml->getName();
+ echo "$pad<$name";
+ foreach($xml->attributes() as $attr => $value)
+ {
+ echo " $attr=\"$value\"";
+ }
+ echo ">" . trim($xml) . "\n";
+ foreach($xml->children() as $node)
+ {
+ traverse_xml($node, $pad.' ');
+ }
+ echo $pad."$name>\n";
+}
+
+
+$people = simplexml_load_string($xml);
+traverse_xml($people);
+$people->person = 'Joe';
+$people->person['gender'] = 'male';
+traverse_xml($people);
+$people->person = 'Jane';
+traverse_xml($people);
+$people->person['gender'] = 'female';
+$people->person[1] = 'Joe';
+$people->person[1]['gender'] = 'male';
+traverse_xml($people);
+$people->person[3] = 'Minni-me';
+$people->person[2]['gender'] = 'male';
+traverse_xml($people);
+$people->person[3]['gender'] = 'error';
+traverse_xml($people);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/027.php.expectf b/hphp/test/zend/bad/ext-simplexml/027.php.expectf
new file mode 100644
index 000000000..2da8baa19
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/027.php.expectf
@@ -0,0 +1,36 @@
+
+
+
+ Joe
+
+
+
+ Jane
+
+
+
+ Jane
+
+ Joe
+
+
+HipHop Warning: %a
+
+ Jane
+
+ Joe
+
+ Minni-me
+
+
+
+ Jane
+
+ Joe
+
+ Minni-me
+
+
+
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/028.php b/hphp/test/zend/bad/ext-simplexml/028.php
new file mode 100644
index 000000000..298c5ea50
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/028.php
@@ -0,0 +1,29 @@
+
+EOF;
+
+function traverse_xml($xml, $pad = '')
+{
+ $name = $xml->getName();
+ echo "$pad<$name";
+ foreach($xml->attributes() as $attr => $value)
+ {
+ echo " $attr=\"$value\"";
+ }
+ echo ">" . trim($xml) . "\n";
+ foreach($xml->children() as $node)
+ {
+ traverse_xml($node, $pad.' ');
+ }
+ echo $pad."$name>\n";
+}
+
+
+$people = simplexml_load_string($xml);
+traverse_xml($people);
+$people->person['name'] = 'John';
+traverse_xml($people);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/028.php.expectf b/hphp/test/zend/bad/ext-simplexml/028.php.expectf
new file mode 100644
index 000000000..7ed899804
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/028.php.expectf
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/029.php b/hphp/test/zend/bad/ext-simplexml/029.php
new file mode 100644
index 000000000..473c461e4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/029.php
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+EOF;
+
+$people = simplexml_load_string($xml);
+
+foreach($people as $person)
+{
+ var_dump((string)$person['name']);
+ var_dump(count($people));
+ var_dump(count($person));
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/029.php.expectf b/hphp/test/zend/bad/ext-simplexml/029.php.expectf
new file mode 100644
index 000000000..5495dfb03
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/029.php.expectf
@@ -0,0 +1,10 @@
+string(3) "Joe"
+int(3)
+int(0)
+string(4) "John"
+int(3)
+int(1)
+string(4) "Jane"
+int(3)
+int(0)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/030.php b/hphp/test/zend/bad/ext-simplexml/030.php
new file mode 100644
index 000000000..c3bd40e30
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/030.php
@@ -0,0 +1,28 @@
+
+ test
+ test 2
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+echo $sxe->child1[0]."\n";
+echo $sxe->child1[1]."\n\n";
+
+var_dump(isset($sxe->child1[1]));
+unset($sxe->child1[1]);
+var_dump(isset($sxe->child1[1]));
+echo "\n";
+
+$atts = $sxe->attributes("urn::test");
+var_dump(isset($atts[0]));
+unset($atts[0]);
+var_dump(isset($atts[0]));
+var_dump(isset($atts[TRUE]));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/030.php.expectf b/hphp/test/zend/bad/ext-simplexml/030.php.expectf
new file mode 100644
index 000000000..e9812b05f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/030.php.expectf
@@ -0,0 +1,10 @@
+test
+test 2
+
+bool(true)
+bool(false)
+
+bool(true)
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/032.php b/hphp/test/zend/bad/ext-simplexml/032.php
new file mode 100644
index 000000000..3cedc681d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/032.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+EOF;
+
+$xml1 =<<
+
+
+
+
+
+
+
+EOF;
+
+
+$people = simplexml_load_string($xml);
+$people1 = simplexml_load_string($xml);
+$people2 = simplexml_load_string($xml1);
+
+var_dump($people1 == $people);
+var_dump($people2 == $people);
+var_dump($people2 == $people1);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/032.php.expectf b/hphp/test/zend/bad/ext-simplexml/032.php.expectf
new file mode 100644
index 000000000..fac42add0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/032.php.expectf
@@ -0,0 +1,4 @@
+bool(false)
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/033.php b/hphp/test/zend/bad/ext-simplexml/033.php
new file mode 100644
index 000000000..486953bd3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/033.php
@@ -0,0 +1,33 @@
+
+test
+
+
+
+
+
+
+
+
+EOF;
+
+$foo = simplexml_load_string( "" );
+$people = simplexml_load_string($xml);
+
+var_dump((bool)$foo);
+var_dump((bool)$people);
+var_dump((int)$foo);
+var_dump((int)$people);
+var_dump((double)$foo);
+var_dump((double)$people);
+var_dump((string)$foo);
+var_dump((string)$people);
+var_dump((array)$foo);
+var_dump((array)$people);
+var_dump((object)$foo);
+var_dump((object)$people);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/033.php.expectf b/hphp/test/zend/bad/ext-simplexml/033.php.expectf
new file mode 100644
index 000000000..9bf44241a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/033.php.expectf
@@ -0,0 +1,98 @@
+bool(false)
+bool(true)
+int(0)
+int(0)
+float(0)
+float(0)
+string(0) ""
+string(15) "
+test
+
+
+
+"
+array(0) {
+}
+array(1) {
+ ["person"]=>
+ array(3) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Joe"
+ }
+ }
+ [1]=>
+ object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(4) "John"
+ }
+ ["children"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["person"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Joe"
+ }
+ }
+ }
+ }
+ [2]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(4) "Jane"
+ }
+ }
+ }
+}
+object(SimpleXMLElement)#%d (0) {
+}
+object(SimpleXMLElement)#%d (1) {
+ ["person"]=>
+ array(3) {
+ [0]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Joe"
+ }
+ }
+ [1]=>
+ object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(4) "John"
+ }
+ ["children"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["person"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Joe"
+ }
+ }
+ }
+ }
+ [2]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["name"]=>
+ string(4) "Jane"
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/034.php b/hphp/test/zend/bad/ext-simplexml/034.php
new file mode 100644
index 000000000..596f6d091
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/034.php
@@ -0,0 +1,15 @@
+
+
+ Blah 1
+ Blah 2
+ Blah 3
+ Blah 4
+
+';
+$foo = simplexml_load_string($string);
+$p = $foo->bar->p;
+echo count($p);
+$p = (array)$foo->bar->p;
+echo count($p);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/034.php.expectf b/hphp/test/zend/bad/ext-simplexml/034.php.expectf
new file mode 100644
index 000000000..dc7b54ad0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/034.php.expectf
@@ -0,0 +1 @@
+33
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/036.php b/hphp/test/zend/bad/ext-simplexml/036.php
new file mode 100644
index 000000000..d41805d26
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/036.php
@@ -0,0 +1,13 @@
+asdfghjk';
+$sxe = new SXE($str);
+var_dump(count($sxe));
+?>
+==Done==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/036.php.expectf b/hphp/test/zend/bad/ext-simplexml/036.php.expectf
new file mode 100644
index 000000000..067dc0f3b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/036.php.expectf
@@ -0,0 +1,3 @@
+Called Count!
+int(2)
+==Done==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/SimpleXMLElement_addAttribute_basic.php b/hphp/test/zend/bad/ext-simplexml/SimpleXMLElement_addAttribute_basic.php
new file mode 100644
index 000000000..45f294d26
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/SimpleXMLElement_addAttribute_basic.php
@@ -0,0 +1,7 @@
+addAttribute('type','novels');
+
+ var_dump($simple->attributes());
+ echo "Done";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/SimpleXMLElement_addAttribute_basic.php.expectf b/hphp/test/zend/bad/ext-simplexml/SimpleXMLElement_addAttribute_basic.php.expectf
new file mode 100644
index 000000000..eb7075f61
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/SimpleXMLElement_addAttribute_basic.php.expectf
@@ -0,0 +1,8 @@
+object(SimpleXMLElement)#2 (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["type"]=>
+ string(6) "novels"
+ }
+}
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug27010.php b/hphp/test/zend/bad/ext-simplexml/bug27010.php
new file mode 100644
index 000000000..00ea72dc3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug27010.php
@@ -0,0 +1,23 @@
+
+ Coffee
+ Tea
+ Cola
+ Juice
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+foreach ($sxe as $element_name => $element) {
+ print "$element_name is $element->name\n";
+}
+
+foreach ($sxe->children('http://www.example.com/hot') as $element_name => $element) {
+ print "$element_name is $element->name\n";
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug27010.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug27010.php.expectf
new file mode 100644
index 000000000..38ace25fb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug27010.php.expectf
@@ -0,0 +1,5 @@
+drink is Cola
+drink is Juice
+drink is Coffee
+drink is Tea
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug35785.php b/hphp/test/zend/bad/ext-simplexml/bug35785.php
new file mode 100644
index 000000000..d87ef5afd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug35785.php
@@ -0,0 +1,16 @@
+");
+$xml->bla->posts->name = "FooBar";
+echo $xml->asXML();
+$xml = simplexml_load_string("");
+$count = count($xml->bla->posts);
+var_dump($count);
+$xml->bla->posts[$count]->name = "FooBar";
+echo $xml->asXML();
+$xml = simplexml_load_string("");
+$xml->bla->posts[]->name = "FooBar";
+echo $xml->asXML();
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug35785.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug35785.php.expectf
new file mode 100644
index 000000000..2de09909d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug35785.php.expectf
@@ -0,0 +1,8 @@
+
+FooBar
+int(0)
+
+FooBar
+
+FooBar
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug36611.php b/hphp/test/zend/bad/ext-simplexml/bug36611.php
new file mode 100644
index 000000000..19044c188
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug36611.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+EOD;
+
+$xml = simplexml_load_string ($xml_str) ;
+
+$val = 1;
+
+var_dump($val);
+$zml->pos["act_idx"] = $val;
+var_dump($val) ;
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug36611.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug36611.php.expectf
new file mode 100644
index 000000000..e66869c5c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug36611.php.expectf
@@ -0,0 +1,3 @@
+int(1)
+int(1)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug37076_1.php b/hphp/test/zend/bad/ext-simplexml/bug37076_1.php
new file mode 100644
index 000000000..427f72918
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug37076_1.php
@@ -0,0 +1,6 @@
+");
+$xml->{""} .= "bar";
+print $xml->asXML();
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug37076_1.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug37076_1.php.expectf
new file mode 100644
index 000000000..44c7ac544
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug37076_1.php.expectf
@@ -0,0 +1,5 @@
+HipHop Warning: %a
+HipHop Warning: %a
+
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug37386.php b/hphp/test/zend/bad/ext-simplexml/bug37386.php
new file mode 100644
index 000000000..1149f5fa7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug37386.php
@@ -0,0 +1,14 @@
+");
+
+$sx1->node[0] = 'node1';
+$sx1->node[1] = 'node2';
+
+print $sx1->asXML()."\n";
+$node = $sx1->node[0];
+$node[0] = 'New Value';
+
+print $sx1->asXML();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug37386.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug37386.php.expectf
new file mode 100644
index 000000000..cf15b86a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug37386.php.expectf
@@ -0,0 +1,5 @@
+
+node1node2
+
+
+New Valuenode2
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug37565.php b/hphp/test/zend/bad/ext-simplexml/bug37565.php
new file mode 100644
index 000000000..0455a9c05
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug37565.php
@@ -0,0 +1,18 @@
+', 'Setting'));
+
+Reflection::export(simplexml_load_file('data:,', 'Setting'));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug37565.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug37565.php.expectf
new file mode 100644
index 000000000..f38e7da04
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug37565.php.expectf
@@ -0,0 +1,7 @@
+Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
+Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
+Error: Reflection::export() expects parameter 1 to be Reflector, null given
+Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
+Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
+Error: Reflection::export() expects parameter 1 to be Reflector, null given
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug38347.php b/hphp/test/zend/bad/ext-simplexml/bug38347.php
new file mode 100644
index 000000000..9359d2e62
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug38347.php
@@ -0,0 +1,16 @@
+item as $item) {
+ echo "This code will crash!";
+ }
+}
+
+$xmlstr = "- Item 1
- Item 2
";
+$xml = simplexml_load_string($xmlstr);
+iterate($xml->unknown);
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug38347.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug38347.php.expectf
new file mode 100644
index 000000000..18e3f5091
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug38347.php.expectf
@@ -0,0 +1,5 @@
+SimpleXMLElement Object
+(
+)
+HipHop Warning: %a
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug38406.php b/hphp/test/zend/bad/ext-simplexml/bug38406.php
new file mode 100644
index 000000000..9142a3583
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug38406.php
@@ -0,0 +1,14 @@
+');
+$item->attribute = b'something';
+var_dump($item->attribute);
+
+$item->otherAttribute = $item->attribute;
+var_dump($item->otherAttribute);
+
+$a = array();
+$item->$a = new stdclass;
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug38406.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug38406.php.expectf
new file mode 100644
index 000000000..26374e303
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug38406.php.expectf
@@ -0,0 +1,11 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(9) "something"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(9) "something"
+}
+HipHop Notice: %a
+HipHop Warning: %a
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug39662.php b/hphp/test/zend/bad/ext-simplexml/bug39662.php
new file mode 100644
index 000000000..393385293
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug39662.php
@@ -0,0 +1,15 @@
+
+
+
+';
+
+$root = simplexml_load_string($xml);
+$clone = clone $root;
+var_dump($root);
+var_dump($clone);
+var_dump($clone->asXML());
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug39662.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug39662.php.expectf
new file mode 100644
index 000000000..8149f4ea5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug39662.php.expectf
@@ -0,0 +1,16 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "
+
+"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(2) "
+
+"
+}
+string(15) "
+
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug39760.php b/hphp/test/zend/bad/ext-simplexml/bug39760.php
new file mode 100644
index 000000000..a681be8c6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug39760.php
@@ -0,0 +1,21 @@
+
+
+
+ text1
+ text2
+
+';
+$test = simplexml_load_string($xml);
+
+var_dump($test->level1->level2a);
+
+$test2 = clone $test;
+var_dump($test2->level1->level2a);
+
+$test3 = clone $test->level1->level2a;
+var_dump($test3);
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug39760.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug39760.php.expectf
new file mode 100644
index 000000000..06379ecaf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug39760.php.expectf
@@ -0,0 +1,13 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "text1"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "text1"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "text1"
+}
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug41582.php b/hphp/test/zend/bad/ext-simplexml/bug41582.php
new file mode 100644
index 000000000..140ffdb61
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug41582.php
@@ -0,0 +1,11 @@
+
+');
+
+$xml->movie[]->characters->character[0]->name = 'Miss Coder';
+
+echo($xml->asXml());
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug41582.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug41582.php.expectf
new file mode 100644
index 000000000..3069837bf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug41582.php.expectf
@@ -0,0 +1,3 @@
+
+Miss Coder
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug41861.php b/hphp/test/zend/bad/ext-simplexml/bug41861.php
new file mode 100644
index 000000000..20ccfa35d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug41861.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+');
+
+$name = $xml->getName();
+$namespaces = $xml->getNamespaces(True);
+echo "root(recursive): '$name' -- namespaces: ", implode(', ', $namespaces), "\n";
+$namespaces = $xml->getNamespaces(False);
+echo "root(non-recursive): '$name' -- namespaces: ", implode(', ', $namespaces), "\n";
+
+foreach (array(null, '#ns1', '#ns2', '#ns3') as $ns)
+{
+ foreach ($xml->children($ns) as $child)
+ {
+ $name = $child->getName();
+ $namespaces = $child->getNamespaces(false);
+
+ echo "children($ns): '$name' -- namespaces: ", implode(', ', $namespaces), "\n";
+ }
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug41861.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug41861.php.expectf
new file mode 100644
index 000000000..5b0c2fe79
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug41861.php.expectf
@@ -0,0 +1,8 @@
+root(recursive): 'root' -- namespaces: #ns1, #ns2, #ns3
+root(non-recursive): 'root' -- namespaces:
+children(): 'first_node_no_ns' -- namespaces:
+children(): 'last_node_no_ns' -- namespaces:
+children(#ns1): 'node1' -- namespaces: #ns1
+children(#ns2): 'node2' -- namespaces: #ns2
+children(#ns3): 'node3' -- namespaces: #ns3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug42259.php b/hphp/test/zend/bad/ext-simplexml/bug42259.php
new file mode 100644
index 000000000..6daf0b37c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug42259.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EOF;
+
+$sxe = new SimpleXMLIterator($xml);
+$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::LEAVES_ONLY);
+foreach ($rit as $child) {
+ $path = '';
+ $ancestry = $child->xpath('ancestor-or-self::*');
+ foreach ($ancestry as $ancestor) {
+ $path .= $ancestor->getName() . '/';
+ }
+ $path = substr($path, 0, strlen($path) - 1);
+ echo count($ancestry) . ' steps: ' . $path . PHP_EOL;
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug42259.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug42259.php.expectf
new file mode 100644
index 000000000..189b75582
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug42259.php.expectf
@@ -0,0 +1,8 @@
+3 steps: xml/fieldset1/field1
+3 steps: xml/fieldset1/field2
+4 steps: xml/fieldset2/options/option1
+4 steps: xml/fieldset2/options/option2
+4 steps: xml/fieldset2/options/option3
+3 steps: xml/fieldset2/field1
+3 steps: xml/fieldset2/field2
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug43221.php b/hphp/test/zend/bad/ext-simplexml/bug43221.php
new file mode 100644
index 000000000..79a48f635
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug43221.php
@@ -0,0 +1,9 @@
+');
+$n = $xml->addChild("node", "value");
+$n->addAttribute("a", "b");
+$n->addAttribute("c", "d", "http://bar.com");
+$n->addAttribute("foo:e", "f", "http://bar.com");
+print_r($xml->asXml());
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug43221.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug43221.php.expectf
new file mode 100644
index 000000000..bb3dd5836
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug43221.php.expectf
@@ -0,0 +1,4 @@
+HipHop Warning: %a
+
+value
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug45553.php b/hphp/test/zend/bad/ext-simplexml/bug45553.php
new file mode 100644
index 000000000..fcaf483a6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug45553.php
@@ -0,0 +1,23 @@
+
+ test1
+ test2
+
+XML;
+
+$x = simplexml_load_string($xml);
+$x->registerXPathNamespace("a", "http://a");
+
+$atts = $x->xpath("/xml/data/@a:label");
+echo $atts[0] . "\n";
+$atts = $x->xpath("/xml/a:data");
+echo $atts[0]->attributes() . "\n";
+$atts = $x->xpath("/xml/a:data/@a:label");
+echo $atts[0] . "\n";
+$atts = $x->xpath("/xml/a:data/@label");
+echo $atts[0] . "\n";
+$atts = $x->xpath("/xml/data/@label");
+echo $atts[0] . "\n";
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug45553.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug45553.php.expectf
new file mode 100644
index 000000000..aaa8cee37
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug45553.php.expectf
@@ -0,0 +1,6 @@
+I am A
+I am a:Nothing
+I am a:A
+I am a:Nothing
+I am Nothing
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug46048.php b/hphp/test/zend/bad/ext-simplexml/bug46048.php
new file mode 100644
index 000000000..4143a366b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug46048.php
@@ -0,0 +1,10 @@
+
+ value
+
+';
+$obj = simplexml_load_string($xml);
+print_r(get_object_vars($obj));
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug46048.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug46048.php.expectf
new file mode 100644
index 000000000..48b673533
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug46048.php.expectf
@@ -0,0 +1,10 @@
+Array
+(
+ [@attributes] => Array
+ (
+ [id] => 1
+ )
+
+ [key] => value
+)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug48601.php b/hphp/test/zend/bad/ext-simplexml/bug48601.php
new file mode 100644
index 000000000..bf221cc6e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug48601.php
@@ -0,0 +1,13 @@
+1');
+
+$nodes = $sxe->xpath("/root/node2/@test");
+
+if (! is_array($nodes)) {
+ echo "An error occurred\n";
+} else {
+ echo "Result Count: " . count($nodes) . "\n";
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug48601.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug48601.php.expectf
new file mode 100644
index 000000000..78d5f2665
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug48601.php.expectf
@@ -0,0 +1 @@
+Result Count: 0
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug51615.php b/hphp/test/zend/bad/ext-simplexml/bug51615.php
new file mode 100644
index 000000000..d72f71c6c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug51615.php
@@ -0,0 +1,13 @@
+loadHTML('xx');
+$html = simplexml_import_dom($dom);
+
+var_dump($html->body->span);
+
+foreach ($html->body->span as $obj) {
+ var_dump((string)$obj->title);
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/bug51615.php.expectf b/hphp/test/zend/bad/ext-simplexml/bug51615.php.expectf
new file mode 100644
index 000000000..ac4da9b9a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/bug51615.php.expectf
@@ -0,0 +1,17 @@
+HipHop Warning: %a
+HipHop Warning: %a
+object(SimpleXMLElement)#%d (3) {
+ ["@attributes"]=>
+ array(2) {
+ ["title"]=>
+ string(0) ""
+ ["y"]=>
+ string(0) ""
+ }
+ [0]=>
+ string(1) "x"
+ [1]=>
+ string(1) "x"
+}
+string(0) ""
+string(0) ""
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/feature55218.php b/hphp/test/zend/bad/ext-simplexml/feature55218.php
new file mode 100644
index 000000000..b4acdd2d0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/feature55218.php
@@ -0,0 +1,43 @@
+
+
+
+ John Doe
+
+ Susie Q. Public
+
+ jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk
+
+');
+
+echo "getDocNamespaces\n";
+echo "\nBackwards Compatibility:\n";
+echo "recursion:\n";
+
+var_dump ( $x->getDocNamespaces(true) ) ;
+var_dump( $x->person[0]->getDocNamespaces(true) );
+var_dump( $x->person[1]->getDocNamespaces(true) );
+
+echo "\nnon recursive:\n";
+
+var_dump( $x->getDocNamespaces(false) );
+var_dump( $x->person[0]->getDocNamespaces(false) );
+var_dump( $x->person[1]->getDocNamespaces(false) );
+
+echo "\n\nUsing new 'from_root' bool set to false:\n";
+echo "recursion:\n";
+
+var_dump ( $x->getDocNamespaces(true, false) ) ;
+var_dump( $x->person[0]->getDocNamespaces(true, false) );
+var_dump( $x->person[1]->getDocNamespaces(true, false) );
+
+echo "\nnon recursive:\n";
+
+var_dump( $x->getDocNamespaces(false, false) );
+var_dump( $x->person[0]->getDocNamespaces(false, false) );
+var_dump( $x->person[1]->getDocNamespaces(false, false) );
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/feature55218.php.expectf b/hphp/test/zend/bad/ext-simplexml/feature55218.php.expectf
new file mode 100644
index 000000000..162fbeb00
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/feature55218.php.expectf
@@ -0,0 +1,65 @@
+getDocNamespaces
+
+Backwards Compatibility:
+recursion:
+array(2) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+ ["t"]=>
+ string(20) "http://example.org/t"
+}
+array(2) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+ ["t"]=>
+ string(20) "http://example.org/t"
+}
+array(2) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+ ["t"]=>
+ string(20) "http://example.org/t"
+}
+
+non recursive:
+array(1) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+}
+array(1) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+}
+array(1) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+}
+
+
+Using new 'from_root' bool set to false:
+recursion:
+array(2) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+ ["t"]=>
+ string(20) "http://example.org/t"
+}
+array(1) {
+ ["t"]=>
+ string(20) "http://example.org/t"
+}
+array(0) {
+}
+
+non recursive:
+array(1) {
+ ["p"]=>
+ string(20) "http://example.org/p"
+}
+array(1) {
+ ["t"]=>
+ string(20) "http://example.org/t"
+}
+array(0) {
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile05.php b/hphp/test/zend/bad/ext-simplexml/profile05.php
new file mode 100644
index 000000000..39b88825a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile05.php
@@ -0,0 +1,11 @@
+
+
+ Hello
+
+');
+
+echo $root->children('reserved')->child;
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile05.php.expectf b/hphp/test/zend/bad/ext-simplexml/profile05.php.expectf
new file mode 100644
index 000000000..5a2285eb6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile05.php.expectf
@@ -0,0 +1 @@
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile08.php b/hphp/test/zend/bad/ext-simplexml/profile08.php
new file mode 100644
index 000000000..1e8318201
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile08.php
@@ -0,0 +1,11 @@
+
+
+
+
+');
+
+echo $root->child['attribute'];
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile08.php.expectf b/hphp/test/zend/bad/ext-simplexml/profile08.php.expectf
new file mode 100644
index 000000000..5a2285eb6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile08.php.expectf
@@ -0,0 +1 @@
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile09.php b/hphp/test/zend/bad/ext-simplexml/profile09.php
new file mode 100644
index 000000000..bf0724a95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile09.php
@@ -0,0 +1,11 @@
+
+
+ Hello
+
+');
+
+echo $root->child;
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile09.php.expectf b/hphp/test/zend/bad/ext-simplexml/profile09.php.expectf
new file mode 100644
index 000000000..5a2285eb6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile09.php.expectf
@@ -0,0 +1 @@
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile11.php b/hphp/test/zend/bad/ext-simplexml/profile11.php
new file mode 100644
index 000000000..d3c8e1aa2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile11.php
@@ -0,0 +1,16 @@
+
+
+ Hello
+ World
+
+');
+
+var_dump($root->children('reserved-ns')->child);
+var_dump($root->children('special-ns')->child);
+var_dump((string)$root->children('reserved-ns')->child);
+var_dump((string)$root->children('special-ns')->child);
+var_dump($root->child);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile11.php.expectf b/hphp/test/zend/bad/ext-simplexml/profile11.php.expectf
new file mode 100644
index 000000000..6e416a006
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile11.php.expectf
@@ -0,0 +1,13 @@
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "Hello"
+}
+object(SimpleXMLElement)#%d (1) {
+ [0]=>
+ string(5) "World"
+}
+string(5) "Hello"
+string(5) "World"
+object(SimpleXMLElement)#%d (0) {
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile12.php b/hphp/test/zend/bad/ext-simplexml/profile12.php
new file mode 100644
index 000000000..78e8617f4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile12.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+$nsl = $sxe->getNamespaces();
+var_dump($nsl);
+
+$sxe = simplexml_load_string($xml, NULL, 0, $nsl['soap']);
+var_dump($sxe->Body);
+var_dump($sxe->Body->children(''));
+var_dump($sxe->Body->children('')->businessList);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile12.php.expectf b/hphp/test/zend/bad/ext-simplexml/profile12.php.expectf
new file mode 100644
index 000000000..a6ae34529
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile12.php.expectf
@@ -0,0 +1,40 @@
+array(1) {
+ ["soap"]=>
+ string(41) "http://schemas.xmlsoap.org/soap/envelope/"
+}
+object(SimpleXMLElement)#%s (0) {
+}
+object(SimpleXMLElement)#%s (1) {
+ ["businessList"]=>
+ object(SimpleXMLElement)#%s (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["foo"]=>
+ string(3) "bar"
+ }
+ ["businessInfo"]=>
+ object(SimpleXMLElement)#%s (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["businessKey"]=>
+ string(3) "bla"
+ }
+ }
+ }
+}
+object(SimpleXMLElement)#%s (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["foo"]=>
+ string(3) "bar"
+ }
+ ["businessInfo"]=>
+ object(SimpleXMLElement)#%s (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["businessKey"]=>
+ string(3) "bla"
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile13.php b/hphp/test/zend/bad/ext-simplexml/profile13.php
new file mode 100644
index 000000000..a353daa0b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile13.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+var_dump($sxe->children('soap', 1));
+
+$sxe = simplexml_load_string($xml, NULL, 0, 'soap', 1);
+var_dump($sxe->Body);
+var_dump($sxe->Body->children(''));
+var_dump($sxe->Body->children('')->businessList);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/profile13.php.expectf b/hphp/test/zend/bad/ext-simplexml/profile13.php.expectf
new file mode 100644
index 000000000..07d8ec050
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/profile13.php.expectf
@@ -0,0 +1,41 @@
+object(SimpleXMLElement)#%d (1) {
+ ["Body"]=>
+ object(SimpleXMLElement)#%d (0) {
+ }
+}
+object(SimpleXMLElement)#%d (0) {
+}
+object(SimpleXMLElement)#%d (1) {
+ ["businessList"]=>
+ object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["foo"]=>
+ string(3) "bar"
+ }
+ ["businessInfo"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["businessKey"]=>
+ string(3) "bla"
+ }
+ }
+ }
+}
+object(SimpleXMLElement)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["foo"]=>
+ string(3) "bar"
+ }
+ ["businessInfo"]=>
+ object(SimpleXMLElement)#%d (1) {
+ ["@attributes"]=>
+ array(1) {
+ ["businessKey"]=>
+ string(3) "bla"
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/simplexml_import_dom.php b/hphp/test/zend/bad/ext-simplexml/simplexml_import_dom.php
new file mode 100644
index 000000000..d6f9ad86f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/simplexml_import_dom.php
@@ -0,0 +1,13 @@
+load(dirname(__FILE__)."/book.xml");
+if(!$dom) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+$s = simplexml_import_dom($dom);
+$books = $s->book;
+foreach ($books as $book) {
+ echo "{$book->title} was written by {$book->author}\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/simplexml_import_dom.php.expectf b/hphp/test/zend/bad/ext-simplexml/simplexml_import_dom.php.expectf
new file mode 100644
index 000000000..c2e7ec95e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/simplexml_import_dom.php.expectf
@@ -0,0 +1,2 @@
+The Grapes of Wrath was written by John Steinbeck
+The Pearl was written by John Steinbeck
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/simplexml_load_file.php b/hphp/test/zend/bad/ext-simplexml/simplexml_load_file.php
new file mode 100644
index 000000000..1c891c946
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/simplexml_load_file.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/simplexml_load_file.php.expectf b/hphp/test/zend/bad/ext-simplexml/simplexml_load_file.php.expectf
new file mode 100644
index 000000000..c9c3f53da
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/simplexml_load_file.php.expectf
@@ -0,0 +1,20 @@
+object(SimpleXMLElement)#1 (1) {
+ ["book"]=>
+ array(2) {
+ [0]=>
+ object(SimpleXMLElement)#2 (2) {
+ ["title"]=>
+ string(19) "The Grapes of Wrath"
+ ["author"]=>
+ string(14) "John Steinbeck"
+ }
+ [1]=>
+ object(SimpleXMLElement)#3 (2) {
+ ["title"]=>
+ string(9) "The Pearl"
+ ["author"]=>
+ string(14) "John Steinbeck"
+ }
+ }
+}
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_001.php b/hphp/test/zend/bad/ext-simplexml/sxe_001.php
new file mode 100644
index 000000000..24b54747c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_001.php
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EOF;
+
+var_dump(simplexml_load_string((binary)$xml, 'SimpleXMLIterator'));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_001.php.expectf b/hphp/test/zend/bad/ext-simplexml/sxe_001.php.expectf
new file mode 100644
index 000000000..2380c3cfa
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_001.php.expectf
@@ -0,0 +1,31 @@
+object(SimpleXMLIterator)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ object(SimpleXMLIterator)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(SimpleXMLIterator)#%d (0) {
+ }
+ ["elem2"]=>
+ object(SimpleXMLIterator)#%d (1) {
+ ["elem3"]=>
+ object(SimpleXMLIterator)#%d (1) {
+ ["elem4"]=>
+ object(SimpleXMLIterator)#%d (1) {
+ ["test"]=>
+ object(SimpleXMLIterator)#%d (0) {
+ }
+ }
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_002.php b/hphp/test/zend/bad/ext-simplexml/sxe_002.php
new file mode 100644
index 000000000..e606538cc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_002.php
@@ -0,0 +1,44 @@
+
+
+
+ Plain text.
+
+ Bla bla 1.
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+ Bla bla 2.
+
+ Foo Bar
+
+
+
+EOF;
+
+$sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
+
+foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) {
+ var_dump($name);
+ var_dump(get_class($data));
+ var_dump(trim($data));
+}
+
+echo "===DUMP===\n";
+
+var_dump(get_class($sxe));
+var_dump(trim($sxe->elem1));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_002.php.expectf b/hphp/test/zend/bad/ext-simplexml/sxe_002.php.expectf
new file mode 100644
index 000000000..48174b0bd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_002.php.expectf
@@ -0,0 +1,22 @@
+string(5) "elem1"
+string(17) "SimpleXMLIterator"
+string(10) "Bla bla 1."
+string(5) "elem2"
+string(17) "SimpleXMLIterator"
+string(28) "Here we have some text data."
+string(5) "elem3"
+string(17) "SimpleXMLIterator"
+string(19) "And here some more."
+string(5) "elem4"
+string(17) "SimpleXMLIterator"
+string(15) "Wow once again."
+string(6) "elem11"
+string(17) "SimpleXMLIterator"
+string(10) "Bla bla 2."
+string(7) "elem111"
+string(17) "SimpleXMLIterator"
+string(7) "Foo Bar"
+===DUMP===
+string(17) "SimpleXMLIterator"
+string(10) "Bla bla 1."
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_003.php b/hphp/test/zend/bad/ext-simplexml/sxe_003.php
new file mode 100644
index 000000000..f15b03701
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_003.php
@@ -0,0 +1,52 @@
+
+
+
+ Plain text.
+
+ Bla bla 1.
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+ Bla bla 2.
+
+ Foo Bar
+
+
+
+EOF;
+
+$sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
+
+foreach($sxe->getChildren() as $name => $data) {
+ var_dump($name);
+ var_dump(get_class($data));
+ var_dump(trim($data));
+}
+
+echo "===RESET===\n";
+
+for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
+ var_dump($sxe->hasChildren());
+ var_dump(trim($sxe->key()));
+ var_dump(trim($sxe->current()));
+ foreach($sxe->getChildren() as $name => $data) {
+ var_dump($name);
+ var_dump(get_class($data));
+ var_dump(trim($data));
+ }
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_003.php.expectf b/hphp/test/zend/bad/ext-simplexml/sxe_003.php.expectf
new file mode 100644
index 000000000..d2dd30893
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_003.php.expectf
@@ -0,0 +1,15 @@
+HipHop Warning: %a
+===RESET===
+bool(true)
+string(5) "elem1"
+string(10) "Bla bla 1."
+string(5) "elem2"
+string(17) "SimpleXMLIterator"
+string(28) "Here we have some text data."
+bool(true)
+string(6) "elem11"
+string(10) "Bla bla 2."
+string(7) "elem111"
+string(17) "SimpleXMLIterator"
+string(7) "Foo Bar"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_004.php b/hphp/test/zend/bad/ext-simplexml/sxe_004.php
new file mode 100644
index 000000000..f0a05d268
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_004.php
@@ -0,0 +1,78 @@
+
+
+
+ Plain text.
+
+ Bla bla 1.
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+ Bla bla 2.
+
+ Foo Bar
+
+
+
+EOF;
+
+class SXETest extends SimpleXMLIterator
+{
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ return parent::rewind();
+ }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ return parent::next();
+ }
+ function hasChildren()
+ {
+ echo __METHOD__ . "\n";
+ return parent::hasChildren();
+ }
+ function getChildren()
+ {
+ echo __METHOD__ . "\n";
+ return parent::getChildren();
+ }
+}
+
+$sxe = new SXETest((binary)$xml);
+$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST);
+
+foreach($rit as $data) {
+ var_dump(get_class($data));
+ var_dump(trim($data));
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_004.php.expectf b/hphp/test/zend/bad/ext-simplexml/sxe_004.php.expectf
new file mode 100644
index 000000000..f38add56b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_004.php.expectf
@@ -0,0 +1,58 @@
+SXETest::rewind
+SXETest::valid
+SXETest::hasChildren
+SXETest::valid
+SXETest::current
+string(7) "SXETest"
+string(10) "Bla bla 1."
+SXETest::getChildren
+SXETest::rewind
+SXETest::valid
+SXETest::hasChildren
+SXETest::valid
+SXETest::current
+string(7) "SXETest"
+string(28) "Here we have some text data."
+SXETest::getChildren
+SXETest::rewind
+SXETest::valid
+SXETest::hasChildren
+SXETest::valid
+SXETest::current
+string(7) "SXETest"
+string(19) "And here some more."
+SXETest::getChildren
+SXETest::rewind
+SXETest::valid
+SXETest::hasChildren
+SXETest::valid
+SXETest::current
+string(7) "SXETest"
+string(15) "Wow once again."
+SXETest::next
+SXETest::valid
+SXETest::next
+SXETest::valid
+SXETest::next
+SXETest::valid
+SXETest::next
+SXETest::valid
+SXETest::hasChildren
+SXETest::valid
+SXETest::current
+string(7) "SXETest"
+string(10) "Bla bla 2."
+SXETest::getChildren
+SXETest::rewind
+SXETest::valid
+SXETest::hasChildren
+SXETest::valid
+SXETest::current
+string(7) "SXETest"
+string(7) "Foo Bar"
+SXETest::next
+SXETest::valid
+SXETest::next
+SXETest::valid
+SXETest::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_005.php b/hphp/test/zend/bad/ext-simplexml/sxe_005.php
new file mode 100644
index 000000000..6e4b91ba4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_005.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+EOF;
+
+class SXETest extends SimpleXMLIterator
+{
+ function count()
+ {
+ echo __METHOD__ . "\n";
+ return parent::count();
+ }
+}
+
+$sxe = new SXETest((binary)$xml);
+
+var_dump(count($sxe));
+var_dump(count($sxe->elem1));
+var_dump(count($sxe->elem2));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-simplexml/sxe_005.php.expectf b/hphp/test/zend/bad/ext-simplexml/sxe_005.php.expectf
new file mode 100644
index 000000000..11a0e69d5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-simplexml/sxe_005.php.expectf
@@ -0,0 +1,7 @@
+SXETest::count
+int(3)
+SXETest::count
+int(1)
+SXETest::count
+int(2)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/009.php b/hphp/test/zend/good/ext-simplexml/009.php
new file mode 100644
index 000000000..dfa6e10c2
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/009.php
@@ -0,0 +1,32 @@
+
+
+
+ Plain text.
+
+ Bla bla 1.
+
+
+ Here we have some text data.
+
+ And here some more.
+
+ Wow once again.
+
+
+
+
+
+ Bla bla 2.
+
+
+EOF
+);
+foreach($sxe->children() as $name=>$val) {
+ var_dump($name);
+ var_dump(get_class($val));
+ var_dump(trim($val));
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/009.php.expectf b/hphp/test/zend/good/ext-simplexml/009.php.expectf
new file mode 100644
index 000000000..4d26602cb
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/009.php.expectf
@@ -0,0 +1,7 @@
+string(5) "elem1"
+string(16) "SimpleXMLElement"
+string(10) "Bla bla 1."
+string(6) "elem11"
+string(16) "SimpleXMLElement"
+string(10) "Bla bla 2."
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/010.php b/hphp/test/zend/good/ext-simplexml/010.php
new file mode 100644
index 000000000..273a492c5
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/010.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EOF;
+
+var_dump(simplexml_load_string($xml, 'simplexml_inherited'));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/010.php.expectf b/hphp/test/zend/good/ext-simplexml/010.php.expectf
new file mode 100644
index 000000000..17042f37f
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/010.php.expectf
@@ -0,0 +1,31 @@
+object(simplexml_inherited)#%d (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["id"]=>
+ string(5) "elem1"
+ }
+ ["elem1"]=>
+ object(simplexml_inherited)#%d (3) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr1"]=>
+ string(5) "first"
+ }
+ ["comment"]=>
+ object(simplexml_inherited)#%d (0) {
+ }
+ ["elem2"]=>
+ object(simplexml_inherited)#%d (1) {
+ ["elem3"]=>
+ object(simplexml_inherited)#%d (1) {
+ ["elem4"]=>
+ object(simplexml_inherited)#%d (1) {
+ ["test"]=>
+ object(simplexml_inherited)#%d (0) {
+ }
+ }
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/011.php b/hphp/test/zend/good/ext-simplexml/011.php
new file mode 100644
index 000000000..247cf68bb
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/011.php
@@ -0,0 +1,30 @@
+
+
+ bar
+ baz1
+ baz2
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+echo "===BAR===\n";
+echo $sxe->bar;
+echo "\n";
+
+echo "===BAZ===\n";
+echo $sxe->baz;
+echo "\n";
+
+echo "===BAZ0===\n";
+echo $sxe->baz[0];
+echo "\n";
+
+echo "===BAZ1===\n";
+print $sxe->baz[1];
+echo "\n";
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/011.php.expectf b/hphp/test/zend/good/ext-simplexml/011.php.expectf
new file mode 100644
index 000000000..dbf841e21
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/011.php.expectf
@@ -0,0 +1,9 @@
+===BAR===
+bar
+===BAZ===
+baz1
+===BAZ0===
+baz1
+===BAZ1===
+baz2
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/020.php b/hphp/test/zend/good/ext-simplexml/020.php
new file mode 100644
index 000000000..cc6933908
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/020.php
@@ -0,0 +1,12 @@
+bar');
+print $doc->name["attr"];
+print "\n";
+if ($doc->name["attr"] == "foo") {
+ print "Works\n";
+} else {
+ print "Error\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/020.php.expectf b/hphp/test/zend/good/ext-simplexml/020.php.expectf
new file mode 100644
index 000000000..d23030dce
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/020.php.expectf
@@ -0,0 +1,3 @@
+foo
+Works
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/021.php b/hphp/test/zend/good/ext-simplexml/021.php
new file mode 100644
index 000000000..1fcbb76c9
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/021.php
@@ -0,0 +1,17 @@
+foo');
+if(!isset($doc->exists)) {
+ $ok *= 0;
+}
+if(isset($doc->doesnotexist)) {
+ $ok *= 0;
+}
+if ($ok) {
+ print "Works\n";
+} else {
+ print "Error\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/021.php.expectf b/hphp/test/zend/good/ext-simplexml/021.php.expectf
new file mode 100644
index 000000000..eca68cb79
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/021.php.expectf
@@ -0,0 +1,2 @@
+Works
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/025.php b/hphp/test/zend/good/ext-simplexml/025.php
new file mode 100644
index 000000000..64b7c36db
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/025.php
@@ -0,0 +1,45 @@
+
+
+bla
+
+bla
+
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump($sxe->getNamespaces());
+var_dump($sxe->getNamespaces(true));
+var_dump($sxe->getDocNamespaces());
+var_dump($sxe->getDocNamespaces(true));
+
+$xml =<<
+
+bla
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump($sxe->getNamespaces());
+var_dump($sxe->getDocNamespaces());
+
+$xml =<<
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump($sxe->getNamespaces());
+var_dump($sxe->getDocNamespaces());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/025.php.expectf b/hphp/test/zend/good/ext-simplexml/025.php.expectf
new file mode 100644
index 000000000..249da7d27
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/025.php.expectf
@@ -0,0 +1,41 @@
+array(1) {
+ ["xhtml"]=>
+ string(31) "http://www.w3.org/TR/REC-html40"
+}
+array(3) {
+ ["xhtml"]=>
+ string(31) "http://www.w3.org/TR/REC-html40"
+ ["html"]=>
+ string(28) "http://www.w3.org/1999/xhtml"
+ ["foo"]=>
+ string(6) "foobar"
+}
+array(2) {
+ ["html"]=>
+ string(28) "http://www.w3.org/1999/xhtml"
+ ["xhtml"]=>
+ string(31) "http://www.w3.org/TR/REC-html40"
+}
+array(4) {
+ ["html"]=>
+ string(28) "http://www.w3.org/1999/xhtml"
+ ["xhtml"]=>
+ string(31) "http://www.w3.org/TR/REC-html40"
+ ["foo"]=>
+ string(6) "foobar"
+ ["baz"]=>
+ string(9) "foobarbaz"
+}
+array(1) {
+ [""]=>
+ string(28) "http://www.w3.org/1999/xhtml"
+}
+array(1) {
+ [""]=>
+ string(28) "http://www.w3.org/1999/xhtml"
+}
+array(0) {
+}
+array(0) {
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/026.php b/hphp/test/zend/good/ext-simplexml/026.php
new file mode 100644
index 000000000..735fef9b9
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/026.php
@@ -0,0 +1,29 @@
+
+ Jane
+
+EOF;
+
+function traverse_xml($xml, $pad = '')
+{
+ $name = $xml->getName();
+ echo "$pad<$name";
+ foreach($xml->attributes() as $attr => $value)
+ {
+ echo " $attr=\"$value\"";
+ }
+ echo ">" . trim($xml) . "\n";
+ foreach($xml->children() as $node)
+ {
+ traverse_xml($node, $pad.' ');
+ }
+ echo $pad."$name>\n";
+}
+
+
+$people = simplexml_load_string($xml);
+traverse_xml($people);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/026.php.expectf b/hphp/test/zend/good/ext-simplexml/026.php.expectf
new file mode 100644
index 000000000..e4bb4ff95
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/026.php.expectf
@@ -0,0 +1,5 @@
+
+ Jane
+
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/031.php b/hphp/test/zend/good/ext-simplexml/031.php
new file mode 100644
index 000000000..ee15ac2e0
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/031.php
@@ -0,0 +1,41 @@
+
+ test
+ test 2
+
+
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+/* Add new attribute in a new namespace */
+$sxe->addAttribute('v:att11', 'xxx', 'urn::test-v');
+
+/* Try to add attribute again -> display warning as method is for new Attr only */
+$sxe->addAttribute('v:att11', 'xxx', 'urn::test-v');
+
+/* Add new attribute w/o namespace */
+$sxe->addAttribute('att2', 'no-ns');
+
+$d = $sxe->attributes();
+/* Try to add element to attribute -> display warning and do not add */
+$d->addChild('m:test', 'myval', 'urn::test');
+
+
+/* Test adding elements in various configurations */
+$sxe->addChild('m:test1', 'myval', 'urn::test');
+
+/* New namespace test */
+$n = $sxe->addChild('m:test2', 'myval', 'urn::testnew');
+
+$sxe->addChild('test3', 'myval', 'urn::testnew');
+$sxe->addChild('test4', 'myval');
+
+/* Does not add prefix here although name is valid (but discouraged) - change behavior? */
+$sxe->addChild('s:test5', 'myval');
+
+echo $sxe->asXML();
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/031.php.expectf b/hphp/test/zend/good/ext-simplexml/031.php.expectf
new file mode 100644
index 000000000..8490ffc89
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/031.php.expectf
@@ -0,0 +1,9 @@
+HipHop Warning: %a
+HipHop Warning: %a
+
+
+ test
+ test 2
+
+myvalmyvalmyvalmyvalmyval
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/035.php b/hphp/test/zend/good/ext-simplexml/035.php
new file mode 100644
index 000000000..c982ec872
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/035.php
@@ -0,0 +1,16 @@
+
+
+ Blah 1
+ Blah 2
+ Blah 3
+ Blah 4
+
+';
+$foo = simplexml_load_string($string);
+$p = $foo->bar->p;
+echo $p."\n";
+echo $p->__toString()."\n";
+echo $p."\n";
+?>
+==Done==
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/035.php.expectf b/hphp/test/zend/good/ext-simplexml/035.php.expectf
new file mode 100644
index 000000000..38baea4f4
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/035.php.expectf
@@ -0,0 +1,4 @@
+Blah 1
+Blah 1
+Blah 1
+==Done==
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/SimpleXMLElement_addAttribute_required_attribute_name.php b/hphp/test/zend/good/ext-simplexml/SimpleXMLElement_addAttribute_required_attribute_name.php
new file mode 100644
index 000000000..676b959c2
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/SimpleXMLElement_addAttribute_required_attribute_name.php
@@ -0,0 +1,5 @@
+testfest");
+$a->addAttribute( "", "" );
+echo $a->asXML();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/SimpleXMLElement_addAttribute_required_attribute_name.php.expectf b/hphp/test/zend/good/ext-simplexml/SimpleXMLElement_addAttribute_required_attribute_name.php.expectf
new file mode 100644
index 000000000..d7c04d873
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/SimpleXMLElement_addAttribute_required_attribute_name.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+
+testfest
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug24392.php b/hphp/test/zend/good/ext-simplexml/bug24392.php
new file mode 100644
index 000000000..a117f1f46
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug24392.php
@@ -0,0 +1,6 @@
+item as $item) {
+ echo $item->title . "\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug24392.php.expectf b/hphp/test/zend/good/ext-simplexml/bug24392.php.expectf
new file mode 100644
index 000000000..70188f0ad
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug24392.php.expectf
@@ -0,0 +1,10 @@
+EU Parliament to Vote on New Patent Rules
+Most Powerful Amateur Rocket in Canada
+GF FX 5900 Ultra vs. ATi Radeon 9800 Pro
+PHP 5 Beta 1
+Engaging with the OSS Community
+Pure Math, Pure Joy
+Windows Tech Writer Looks at Linux
+US Cell Phone Users Discover SMS Spam
+Verizon Sues Nextel For Espionage
+Introduction to Debian
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug24392.xml b/hphp/test/zend/good/ext-simplexml/bug24392.xml
new file mode 100644
index 000000000..d669f1df4
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug24392.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+Slashdot
+http://slashdot.org/
+News for nerds, stuff that matters
+
+
+
+Slashdot
+http://images.slashdot.org/topics/topicslashdot.gif
+http://slashdot.org/
+
+
+-
+EU Parliament to Vote on New Patent Rules
+http://slashdot.org/article.pl?sid=03/06/30/002211
+
+
+-
+Most Powerful Amateur Rocket in Canada
+http://slashdot.org/article.pl?sid=03/06/29/2121211
+
+
+-
+GF FX 5900 Ultra vs. ATi Radeon 9800 Pro
+http://slashdot.org/article.pl?sid=03/06/29/202218
+
+
+-
+PHP 5 Beta 1
+http://slashdot.org/article.pl?sid=03/06/29/1957253
+
+
+-
+Engaging with the OSS Community
+http://slashdot.org/article.pl?sid=03/06/29/1913235
+
+
+-
+Pure Math, Pure Joy
+http://slashdot.org/article.pl?sid=03/06/29/183258
+
+
+-
+Windows Tech Writer Looks at Linux
+http://slashdot.org/article.pl?sid=03/06/29/1554201
+
+
+-
+US Cell Phone Users Discover SMS Spam
+http://slashdot.org/article.pl?sid=03/06/29/1542249
+
+
+-
+Verizon Sues Nextel For Espionage
+http://slashdot.org/article.pl?sid=03/06/29/1443230
+
+
+-
+Introduction to Debian
+http://slashdot.org/article.pl?sid=03/06/29/1424213
+
+
+
+Search Slashdot
+Search Slashdot stories
+query
+http://slashdot.org/search.pl
+
+
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug26976.php b/hphp/test/zend/good/ext-simplexml/bug26976.php
new file mode 100644
index 000000000..97b07869c
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug26976.php
@@ -0,0 +1,18 @@
+
+
+ a
+ b
+ c
+ d
+
+');
+
+echo $root->child[0], "\n";
+echo $root->child[1], "\n";
+echo $root->child[2], "\n";
+echo $root->child[3], "\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug26976.php.expectf b/hphp/test/zend/good/ext-simplexml/bug26976.php.expectf
new file mode 100644
index 000000000..27a7ea605
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug26976.php.expectf
@@ -0,0 +1,4 @@
+a
+b
+c
+d
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug37076.php b/hphp/test/zend/good/ext-simplexml/bug37076.php
new file mode 100644
index 000000000..e6877a9d4
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug37076.php
@@ -0,0 +1,7 @@
+");
+$xml->foo = "foo";
+$xml->foo .= "bar";
+print $xml->asXML();
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug37076.php.expectf b/hphp/test/zend/good/ext-simplexml/bug37076.php.expectf
new file mode 100644
index 000000000..2ff0ac23c
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug37076.php.expectf
@@ -0,0 +1,3 @@
+
+foobar
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug38354.php b/hphp/test/zend/good/ext-simplexml/bug38354.php
new file mode 100644
index 000000000..0fb1a66fe
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug38354.php
@@ -0,0 +1,14 @@
+
+ Item Two
+'
+);
+
+foreach ($xml->xpath("//*") as $element) {
+ var_dump($element->asXML());
+}
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug38354.php.expectf b/hphp/test/zend/good/ext-simplexml/bug38354.php.expectf
new file mode 100644
index 000000000..5eb41a977
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug38354.php.expectf
@@ -0,0 +1,8 @@
+string(101) "
+
+ Item Two
+
+"
+string(62) "Item Two"
+string(25) "Item Two"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug38424.php b/hphp/test/zend/good/ext-simplexml/bug38424.php
new file mode 100644
index 000000000..1772b9415
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug38424.php
@@ -0,0 +1,18 @@
+');
+
+$str = "abc & def" ;
+
+$xml["a1"] = "" ;
+$xml["a1"] = htmlspecialchars($str,ENT_NOQUOTES) ;
+
+$xml["a2"] = htmlspecialchars($str,ENT_NOQUOTES) ;
+
+$xml["a3"] = "" ;
+$xml["a3"] = $str ;
+
+$xml["a4"] = $str ;
+
+echo $xml->asXML();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug38424.php.expectf b/hphp/test/zend/good/ext-simplexml/bug38424.php.expectf
new file mode 100644
index 000000000..99ad9ee5c
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug38424.php.expectf
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug40451.php b/hphp/test/zend/good/ext-simplexml/bug40451.php
new file mode 100644
index 000000000..c4482af7f
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug40451.php
@@ -0,0 +1,16 @@
+
+
+ host.server.com
+
+XML;
+
+$xml = simplexml_load_string($string);
+
+$add = $xml->addChild('Host');
+$add->Host->addAttribute('enable', 'true');
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug40451.php.expectf b/hphp/test/zend/good/ext-simplexml/bug40451.php.expectf
new file mode 100644
index 000000000..48734b894
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug40451.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug41175.php b/hphp/test/zend/good/ext-simplexml/bug41175.php
new file mode 100644
index 000000000..02d3223df
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug41175.php
@@ -0,0 +1,9 @@
+");
+$xml->addAttribute("src", "foo");
+$xml->addAttribute("alt", "");
+echo $xml->asXML();
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug41175.php.expectf b/hphp/test/zend/good/ext-simplexml/bug41175.php.expectf
new file mode 100644
index 000000000..74bf6eccc
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug41175.php.expectf
@@ -0,0 +1,3 @@
+
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug41867.php b/hphp/test/zend/good/ext-simplexml/bug41867.php
new file mode 100644
index 000000000..109a44b57
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug41867.php
@@ -0,0 +1,8 @@
+");
+echo $a->getName()."\n";
+echo $a->b->getName()."\n";
+echo $a->b->c->getName()."\n";
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug41867.php.expectf b/hphp/test/zend/good/ext-simplexml/bug41867.php.expectf
new file mode 100644
index 000000000..754ff1b1c
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug41867.php.expectf
@@ -0,0 +1,4 @@
+a
+b
+c
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug41947.php b/hphp/test/zend/good/ext-simplexml/bug41947.php
new file mode 100644
index 000000000..a95c66699
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug41947.php
@@ -0,0 +1,10 @@
+');
+$grandchild = $xml->addChild('child', null, 'http://myns')->addChild('grandchild', 'hello', '');
+
+$gchild = $xml->xpath("//grandchild");
+if (count($gchild) > 0) {
+ echo $gchild[0]."\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug41947.php.expectf b/hphp/test/zend/good/ext-simplexml/bug41947.php.expectf
new file mode 100644
index 000000000..896d985e4
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug41947.php.expectf
@@ -0,0 +1,2 @@
+hello
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug42369.php b/hphp/test/zend/good/ext-simplexml/bug42369.php
new file mode 100644
index 000000000..6fe7ae110
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug42369.php
@@ -0,0 +1,16 @@
+';
+ $x = simplexml_load_string($xml . "foo
");
+
+ echo 'explicit conversion' . PHP_EOL;
+ for ($i = 0; $i < 100000; $i++) {
+ md5(strval($x->x));
+ }
+
+ echo 'no conversion' . PHP_EOL;
+ for ($i = 0; $i < 100000; $i++) {
+ md5($x->x);
+ }
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug42369.php.expectf b/hphp/test/zend/good/ext-simplexml/bug42369.php.expectf
new file mode 100644
index 000000000..42f66ee5f
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug42369.php.expectf
@@ -0,0 +1,3 @@
+explicit conversion
+no conversion
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug44478.php b/hphp/test/zend/good/ext-simplexml/bug44478.php
new file mode 100644
index 000000000..3acb7775c
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug44478.php
@@ -0,0 +1,15 @@
+');
+$xml_element->node1 = 'a & b';
+print $xml_element->node1."\n";
+$xml_element->node1 = 'a & b';
+print $xml_element->node1."\n";
+$xml_element->addChild('node2','a & b');
+print $xml_element->node2."\n";
+$xml_element->node2 = 'a & b';
+print $xml_element->node2."\n";
+
+print $xml_element->asXML();
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug44478.php.expectf b/hphp/test/zend/good/ext-simplexml/bug44478.php.expectf
new file mode 100644
index 000000000..e1e1f44f1
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug44478.php.expectf
@@ -0,0 +1,7 @@
+a & b
+a & b
+a & b
+a & b
+
+a & ba & b
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug46003.php b/hphp/test/zend/good/ext-simplexml/bug46003.php
new file mode 100644
index 000000000..4e668f795
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug46003.php
@@ -0,0 +1,21 @@
+
+ Test
+
+
+
+
+
+XML;
+
+$x = simplexml_load_string($xml);
+
+var_dump(isset($x->p));
+var_dump(isset($x->p->o));
+var_dump(isset($x->o->yy));
+var_dump(isset($x->o->zz));
+var_dump(isset($x->o->text));
+var_dump(isset($x->o->xx));
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug46003.php.expectf b/hphp/test/zend/good/ext-simplexml/bug46003.php.expectf
new file mode 100644
index 000000000..4e2a2ceef
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug46003.php.expectf
@@ -0,0 +1,7 @@
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug46047.php b/hphp/test/zend/good/ext-simplexml/bug46047.php
new file mode 100644
index 000000000..109593506
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug46047.php
@@ -0,0 +1,12 @@
+',
+ LIBXML_NOCDATA);
+print_r($xml);
+
+$xml = new SimpleXMLElement('');
+print_r($xml);
+
+$xml = new SimpleXMLElement('');
+print_r($xml);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/bug46047.php.expectf b/hphp/test/zend/good/ext-simplexml/bug46047.php.expectf
new file mode 100644
index 000000000..3c27e4f74
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/bug46047.php.expectf
@@ -0,0 +1,34 @@
+SimpleXMLElement Object
+(
+ [bar] => SimpleXMLElement Object
+ (
+ )
+
+ [baz] => SimpleXMLElement Object
+ (
+ )
+
+)
+SimpleXMLElement Object
+(
+ [bar] => SimpleXMLElement Object
+ (
+ )
+
+ [baz] => SimpleXMLElement Object
+ (
+ )
+
+)
+SimpleXMLElement Object
+(
+ [bar] => SimpleXMLElement Object
+ (
+ )
+
+ [baz] => SimpleXMLElement Object
+ (
+ )
+
+)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile01.php b/hphp/test/zend/good/ext-simplexml/profile01.php
new file mode 100644
index 000000000..9cae96ad9
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile01.php
@@ -0,0 +1,10 @@
+
+
+ Hello
+
+');
+
+echo $root->child;
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile01.php.expectf b/hphp/test/zend/good/ext-simplexml/profile01.php.expectf
new file mode 100644
index 000000000..c63f8c6b6
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile01.php.expectf
@@ -0,0 +1,2 @@
+Hello
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile02.php b/hphp/test/zend/good/ext-simplexml/profile02.php
new file mode 100644
index 000000000..ae484521d
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile02.php
@@ -0,0 +1,13 @@
+
+
+ Hello
+ World
+
+');
+
+foreach ($root->child as $child) {
+ echo "$child ";
+}
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile02.php.expectf b/hphp/test/zend/good/ext-simplexml/profile02.php.expectf
new file mode 100644
index 000000000..b13139db2
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile02.php.expectf
@@ -0,0 +1,2 @@
+Hello World
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile03.php b/hphp/test/zend/good/ext-simplexml/profile03.php
new file mode 100644
index 000000000..75b68ae0e
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile03.php
@@ -0,0 +1,10 @@
+
+
+
+
+');
+
+echo $root->child['attribute'];
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile03.php.expectf b/hphp/test/zend/good/ext-simplexml/profile03.php.expectf
new file mode 100644
index 000000000..547bd9875
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile03.php.expectf
@@ -0,0 +1,2 @@
+Sample
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile04.php b/hphp/test/zend/good/ext-simplexml/profile04.php
new file mode 100644
index 000000000..c6661fd81
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile04.php
@@ -0,0 +1,10 @@
+
+
+ Hello
+
+');
+
+echo $root->children('reserved-ns')->child;
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile04.php.expectf b/hphp/test/zend/good/ext-simplexml/profile04.php.expectf
new file mode 100644
index 000000000..c63f8c6b6
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile04.php.expectf
@@ -0,0 +1,2 @@
+Hello
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile06.php b/hphp/test/zend/good/ext-simplexml/profile06.php
new file mode 100644
index 000000000..cc188b8fd
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile06.php
@@ -0,0 +1,12 @@
+
+
+
+
+');
+
+$attr = $root->child->attributes('reserved-ns');
+echo $attr['attribute'];
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile06.php.expectf b/hphp/test/zend/good/ext-simplexml/profile06.php.expectf
new file mode 100644
index 000000000..547bd9875
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile06.php.expectf
@@ -0,0 +1,2 @@
+Sample
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile07.php b/hphp/test/zend/good/ext-simplexml/profile07.php
new file mode 100644
index 000000000..9b14e21d5
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile07.php
@@ -0,0 +1,15 @@
+
+
+
+
+');
+
+$rsattr = $root->child->attributes('reserved');
+$myattr = $root->child->attributes('reserved-ns');
+
+echo $rsattr['attribute'];
+echo $myattr['attribute'];
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile07.php.expectf b/hphp/test/zend/good/ext-simplexml/profile07.php.expectf
new file mode 100644
index 000000000..547bd9875
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile07.php.expectf
@@ -0,0 +1,2 @@
+Sample
+---Done---
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile10.php b/hphp/test/zend/good/ext-simplexml/profile10.php
new file mode 100644
index 000000000..41d7df92f
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile10.php
@@ -0,0 +1,16 @@
+
+
+
+
+');
+
+$rsattr = $root->child->attributes('reserved-ns');
+$spattr = $root->child->attributes('special-ns');
+
+echo $rsattr['attribute'];
+echo "\n";
+echo $spattr['attribute'];
+echo "\n---Done---\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-simplexml/profile10.php.expectf b/hphp/test/zend/good/ext-simplexml/profile10.php.expectf
new file mode 100644
index 000000000..e76d39b4d
--- /dev/null
+++ b/hphp/test/zend/good/ext-simplexml/profile10.php.expectf
@@ -0,0 +1,3 @@
+Sample
+Test
+---Done---
\ No newline at end of file
diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py
index 1d58244ce..38c52f500 100755
--- a/hphp/tools/import_zend_test.py
+++ b/hphp/tools/import_zend_test.py
@@ -114,7 +114,6 @@ no_import = (
'/ext/pdo_sqlite',
'/ext/pgsql',
'/ext/posix',
- '/ext/simplexml',
'/ext/soap',
'/ext/spl',
'/ext/sqlite3',
@@ -219,6 +218,7 @@ other_files = (
'/ext-openssl/private.key',
'/ext-openssl/public.key',
'/ext-session/save_handler.inc',
+ '/ext-simplexml/bug24392.xml',
'/tests/quicktester.inc',
)