diff --git a/hphp/test/zend/bad/ext-spl-examples/dualiterator_001.php b/hphp/test/zend/bad/ext-spl-examples/dualiterator_001.php
new file mode 100644
index 000000000..d76714714
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl-examples/dualiterator_001.php
@@ -0,0 +1,31 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl-examples/dualiterator_001.php.expectf b/hphp/test/zend/bad/ext-spl-examples/dualiterator_001.php.expectf
new file mode 100644
index 000000000..b79a586b7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl-examples/dualiterator_001.php.expectf
@@ -0,0 +1,11 @@
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/ArrayObject_unserialize_empty_string.php b/hphp/test/zend/bad/ext-spl/ArrayObject_unserialize_empty_string.php
new file mode 100644
index 000000000..34c8b262c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/ArrayObject_unserialize_empty_string.php
@@ -0,0 +1,4 @@
+unserialize("");
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/ArrayObject_unserialize_empty_string.php.expectf b/hphp/test/zend/bad/ext-spl/ArrayObject_unserialize_empty_string.php.expectf
new file mode 100644
index 000000000..249cadfa6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/ArrayObject_unserialize_empty_string.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s(%d): ArrayObject->unserialize('')
+#1 {main}
+ thrown in %s.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest-002.php b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest-002.php
new file mode 100644
index 000000000..3550ad56a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest-002.php
@@ -0,0 +1,39 @@
+getMessage() . "\n";
+}
+
+try {
+ new CallbackFilterIterator(null);
+} catch(InvalidArgumentException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ new CallbackFilterIterator(new ArrayIterator(array()), null);
+} catch(InvalidArgumentException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ new CallbackFilterIterator(new ArrayIterator(array()), array());
+} catch(InvalidArgumentException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+$it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() {
+ throw new Exception("some message");
+});
+try {
+ foreach($it as $e);
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
diff --git a/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest-002.php.expectf b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest-002.php.expectf
new file mode 100644
index 000000000..864933bb4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest-002.php.expectf
@@ -0,0 +1,6 @@
+CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given
+Argument 1 passed to CallbackFilterIterator::__construct() must implement interface Iterator, null given
+CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given
+CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, no array or string given
+CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, array must have exactly two members
+some message
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest.php b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest.php
new file mode 100644
index 000000000..59260d510
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest.php
@@ -0,0 +1,54 @@
+current()
+ , $key == $inner->key()
+ );
+ return $value === 1 || $value === 4;
+}
+
+$tests = array(
+ 'instance method' => function() { return array(new A, 'test'); },
+ 'static method' => function() { return array('B', 'test'); },
+ 'static method (2)' => function() { return 'B::test'; },
+ 'function' => function() { return 'test'; },
+ 'anonymous function' => function() { return function($value, $key, $inner) { return test($value, $key, $inner); }; },
+);
+
+foreach($tests as $name => $test) {
+
+ $callback = $test();
+ $it = new ArrayIterator(range(1, 5));
+ $it = new CallbackFilterIterator($it, $callback);
+
+ echo " = $name =\n";
+
+ foreach($it as $value) {
+ echo "=> $value\n";
+ }
+
+ // same test, with no reference to callback
+
+ $it = new ArrayIterator(range(1, 5));
+ $it = new CallbackFilterIterator($it, $test());
+ unset($callback);
+
+ foreach($it as $value) {
+ echo "=> $value\n";
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest.php.expectf b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest.php.expectf
new file mode 100644
index 000000000..d023fcdd9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/CallbackFilterIteratorTest.php.expectf
@@ -0,0 +1,75 @@
+= instance method =
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+ = static method =
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+ = static method (2) =
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+ = function =
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+ = anonymous function =
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 1 / 1 / 1
+3 / 2 / 1 / 1
+4 / 3 / 1 / 1
+=> 4
+5 / 4 / 1 / 1
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php b/hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php
new file mode 100644
index 000000000..c12931415
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php.expectf b/hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php.expectf
new file mode 100644
index 000000000..9fb77cab7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s(%d): DirectoryIterator->__construct('')
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_getBasename_pass_array.php b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getBasename_pass_array.php
new file mode 100644
index 000000000..5335fe3dd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getBasename_pass_array.php
@@ -0,0 +1,14 @@
+isFile()) {
+ $dir->next();
+ }
+ echo $dir->getBasename(array());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_getBasename_pass_array.php.expectf b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getBasename_pass_array.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getBasename_pass_array.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_getExtension_basic.php b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getExtension_basic.php
new file mode 100644
index 000000000..c54139def
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getExtension_basic.php
@@ -0,0 +1,31 @@
+getFilename(), $skip)) {
+ continue;
+ }
+ $dit_exts[] = $file->getExtension();
+ $nfo_exts[] = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
+}
+var_dump($dit_exts === $nfo_exts);
+sort($dit_exts);
+var_dump($dit_exts);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_getExtension_basic.php.expectf b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getExtension_basic.php.expectf
new file mode 100644
index 000000000..fe75f6b85
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getExtension_basic.php.expectf
@@ -0,0 +1,13 @@
+bool(true)
+array(5) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(9) "extension"
+ [4]=>
+ string(3) "txt"
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_getInode_error.php b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getInode_error.php
new file mode 100644
index 000000000..0f26a7f4a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getInode_error.php
@@ -0,0 +1,6 @@
+getInode());
+?>
diff --git a/hphp/test/zend/bad/ext-spl/DirectoryIterator_getInode_error.php.expectf b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getInode_error.php.expectf
new file mode 100644
index 000000000..685ea20ea
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/DirectoryIterator_getInode_error.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: SplFileInfo->getInode()
+#1 {main}
+ thrown in %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/RecursiveCallbackFilterIteratorTest.php b/hphp/test/zend/bad/ext-spl/RecursiveCallbackFilterIteratorTest.php
new file mode 100644
index 000000000..1079ac161
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/RecursiveCallbackFilterIteratorTest.php
@@ -0,0 +1,59 @@
+hasChildren()) {
+ return true;
+ }
+ printf("%s / %s / %d / %d\n"
+ , print_r($value, true)
+ , $key
+ , $value == $inner->current()
+ , $key == $inner->key()
+ );
+ return $value === 1 || $value === 4;
+}
+
+$tests = array(
+ 'instance method' => function() { return array(new A, 'test'); },
+ 'static method' => function() { return array('B', 'test'); },
+ 'static method (2)' => function() { return 'B::test'; },
+ 'function' => function() { return 'test'; },
+ 'anonymous function' => function() { return function($value, $key, $inner) { return test($value, $key, $inner); }; },
+);
+
+foreach($tests as $name => $test) {
+
+ $callback = $test();
+ $it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5)));
+ $it = new RecursiveCallbackFilterIterator($it, $callback);
+ $it = new RecursiveIteratorIterator($it);
+
+ echo " = $name =\n";
+
+ foreach($it as $value) {
+ echo "=> $value\n";
+ }
+
+ // same test, with no reference to callback
+
+ $it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5)));
+ $it = new RecursiveCallbackFilterIterator($it, $test());
+ $it = new RecursiveIteratorIterator($it);
+ unset($callback);
+
+ foreach($it as $value) {
+ echo "=> $value\n";
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/RecursiveCallbackFilterIteratorTest.php.expectf b/hphp/test/zend/bad/ext-spl/RecursiveCallbackFilterIteratorTest.php.expectf
new file mode 100644
index 000000000..3ca0cc00d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/RecursiveCallbackFilterIteratorTest.php.expectf
@@ -0,0 +1,75 @@
+= instance method =
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+ = static method =
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+ = static method (2) =
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+ = function =
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+ = anonymous function =
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
+1 / 0 / 1 / 1
+=> 1
+2 / 0 / 1 / 1
+3 / 1 / 1 / 1
+4 / 0 / 1 / 1
+=> 4
+5 / 1 / 1 / 1
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPath_basic.php b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPath_basic.php
new file mode 100644
index 000000000..62e22b463
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPath_basic.php
@@ -0,0 +1,35 @@
+valid()) {
+ $list[] = $it->getSubPath();
+ $it->next();
+}
+asort($list);
+foreach ($list as $item) {
+ echo $item . "\n";
+}
+?>
diff --git a/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPath_basic.php.expectf b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPath_basic.php.expectf
new file mode 100644
index 000000000..1d1e6b105
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPath_basic.php.expectf
@@ -0,0 +1,5 @@
+depth1
+depth1
+depth1%cdepth2
+depth1%cdepth2
+depth1%cdepth2
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPathname_basic.php b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPathname_basic.php
new file mode 100644
index 000000000..f0649cca5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPathname_basic.php
@@ -0,0 +1,38 @@
+rewind(); //see https://bugs.php.net/bug.php?id=62914
+while($it->valid()) {
+ $list[] = $it->getSubPathname();
+ $it->next();
+}
+asort($list);
+foreach ($list as $item) {
+ echo $item . "\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPathname_basic.php.expectf b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPathname_basic.php.expectf
new file mode 100644
index 000000000..a1ed964e0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/RecursiveDirectoryIterator_getSubPathname_basic.php.expectf
@@ -0,0 +1,9 @@
+.
+..
+depth1%c.
+depth1%c..
+depth1%cdepth2%c.
+depth1%cdepth2%c..
+depth1%cdepth2%cgetSubPathname_test_2.tmp
+depth1%cgetSubPathname_test_3.tmp
+getSubPathname_test_1.tmp
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplArray_fromArray.php b/hphp/test/zend/bad/ext-spl/SplArray_fromArray.php
new file mode 100644
index 000000000..3f6312996
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplArray_fromArray.php
@@ -0,0 +1,10 @@
+ 'foo');
+$splArray = new SplFixedArray();
+
+try {
+ $splArray->fromArray($array);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplArray_fromArray.php.expectf b/hphp/test/zend/bad/ext-spl/SplArray_fromArray.php.expectf
new file mode 100644
index 000000000..c288b93a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplArray_fromArray.php.expectf
@@ -0,0 +1 @@
+integer overflow detected
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_array.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_array.php
new file mode 100644
index 000000000..72d95d311
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_array.php
@@ -0,0 +1,7 @@
+push("top");
+$list->bottom(array());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_array.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_array.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_array.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_float.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_float.php
new file mode 100644
index 000000000..304403730
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_float.php
@@ -0,0 +1,7 @@
+push("top");
+$list->bottom(3.14159);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_float.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_float.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_float.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_integer.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_integer.php
new file mode 100644
index 000000000..d41b99dd1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_integer.php
@@ -0,0 +1,7 @@
+push("top");
+$list->bottom(45);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_integer.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_integer.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_integer.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_null.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_null.php
new file mode 100644
index 000000000..606118968
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_null.php
@@ -0,0 +1,7 @@
+push("top");
+$list->bottom(null);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_null.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_null.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_bottom_pass_null.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count.php
new file mode 100644
index 000000000..41026a1ca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count.php
@@ -0,0 +1,5 @@
+count('foo');
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count_param_SplDoublyLinkedList.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count_param_SplDoublyLinkedList.php
new file mode 100644
index 000000000..3a488ce15
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count_param_SplDoublyLinkedList.php
@@ -0,0 +1,4 @@
+count(new SplDoublyLinkedList(2));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count_param_SplDoublyLinkedList.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count_param_SplDoublyLinkedList.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_count_param_SplDoublyLinkedList.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current.php
new file mode 100644
index 000000000..c2fb53dcf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current.php
@@ -0,0 +1,4 @@
+current());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current_empty.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current_empty.php
new file mode 100644
index 000000000..0b29d378f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current_empty.php
@@ -0,0 +1,6 @@
+current());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current_empty.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current_empty.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_current_empty.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_debug-info.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_debug-info.php
new file mode 100644
index 000000000..baf747a81
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_debug-info.php
@@ -0,0 +1,12 @@
+push(1);
+ $dll->push(2);
+ $dll->push(3);
+
+ // Check the debug info
+ print_r($dll);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_debug-info.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_debug-info.php.expectf
new file mode 100644
index 000000000..468956ddc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_debug-info.php.expectf
@@ -0,0 +1,11 @@
+SplDoublyLinkedList Object
+(
+ [flags:SplDoublyLinkedList:private] => 0
+ [dllist:SplDoublyLinkedList:private] => Array
+ (
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ )
+
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode.php
new file mode 100644
index 000000000..7c748ae1d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode.php
@@ -0,0 +1,5 @@
+setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_KEEP);
+echo $list->getIteratorMode();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode.php.expectf
new file mode 100644
index 000000000..c22708346
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode.php.expectf
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode_error.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode_error.php
new file mode 100644
index 000000000..3353a4bea
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode_error.php
@@ -0,0 +1,4 @@
+getIteratorMode(24);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode_error.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_getIteratorMode_error.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty-with-parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty-with-parameter.php
new file mode 100644
index 000000000..76e97790b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty-with-parameter.php
@@ -0,0 +1,6 @@
+isEmpty("test"));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty-with-parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty-with-parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty-with-parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty.php
new file mode 100644
index 000000000..1ce7cef49
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty.php
@@ -0,0 +1,6 @@
+isEmpty());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_empty.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.php
new file mode 100644
index 000000000..6355a967f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.php
@@ -0,0 +1,12 @@
+push(1);
+ $dll->push(2);
+ $dll->push(3);
+ //var_dump($dll);
+
+ var_dump($dll->isEmpty("test"));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty.php
new file mode 100644
index 000000000..241ffa5c2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty.php
@@ -0,0 +1,12 @@
+push(1);
+ $dll->push(2);
+ $dll->push(3);
+ //var_dump($dll);
+
+ var_dump($dll->isEmpty());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty.php.expectf
new file mode 100644
index 000000000..eb28e0c67
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_isEmpty_not-empty.php.expectf
@@ -0,0 +1 @@
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_lifoMode.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_lifoMode.php
new file mode 100644
index 000000000..36c42615f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_lifoMode.php
@@ -0,0 +1,16 @@
+push('o');
+$list->push('o');
+$list->push('f');
+
+$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+
+$list->rewind();
+
+while ($tmp = $list->current()) {
+ echo $tmp;
+ $list->next();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_lifoMode.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_lifoMode.php.expectf
new file mode 100644
index 000000000..191028156
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_lifoMode.php.expectf
@@ -0,0 +1 @@
+foo
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_invalid_parameter.php
new file mode 100644
index 000000000..960eb43a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetExists();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_success.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_success.php
new file mode 100644
index 000000000..88b8f1155
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_success.php
@@ -0,0 +1,22 @@
+push('abc');
+$list->push('def');
+
+// Validate that we can see the first value
+if($list->offsetExists(0) === true) {
+ echo "PASS\n";
+}
+
+// Validate that we can see the second value
+if($list->offsetExists(1) === true) {
+ echo "PASS\n";
+}
+
+// Check that there is no third value
+if($list->offsetExists(2) === false) {
+ echo "PASS\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_success.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_success.php.expectf
new file mode 100644
index 000000000..50616673f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetExists_success.php.expectf
@@ -0,0 +1,3 @@
+PASS
+PASS
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_empty.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_empty.php
new file mode 100644
index 000000000..f8f105a97
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_empty.php
@@ -0,0 +1,7 @@
+offsetGet();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_empty.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_empty.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_empty.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_missing_param.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_missing_param.php
new file mode 100644
index 000000000..f01ba0720
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_missing_param.php
@@ -0,0 +1,7 @@
+push(1);
+$dll->push(2);
+
+var_dump($dll->offsetGet());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_missing_param.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_missing_param.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_missing_param.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php
new file mode 100644
index 000000000..67f2f7d56
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php
@@ -0,0 +1,7 @@
+offsetGet( array( 'fail' ) );
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php.expectf
new file mode 100644
index 000000000..709214567
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php
new file mode 100644
index 000000000..9b2da7736
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php
@@ -0,0 +1,7 @@
+offsetGet( 'fail' );
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php.expectf
new file mode 100644
index 000000000..f5ef49674
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_invalid_parameter.php
new file mode 100644
index 000000000..7ef05da77
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetSet();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_one_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_one_invalid_parameter.php
new file mode 100644
index 000000000..0c731d44f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_one_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetSet(2);
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_one_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_one_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetSet_one_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_greater_than_elements.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_greater_than_elements.php
new file mode 100644
index 000000000..2a3df2d7e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_greater_than_elements.php
@@ -0,0 +1,18 @@
+push('1');
+$ll->push('2');
+$ll->push('3');
+
+try {
+
+$ll->offsetUnset($ll->count() + 1);
+
+var_dump($ll);
+
+} catch(Exception $e) {
+echo $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_greater_than_elements.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_greater_than_elements.php.expectf
new file mode 100644
index 000000000..bbf10ec8a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_greater_than_elements.php.expectf
@@ -0,0 +1 @@
+Offset out of range
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_negative-parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_negative-parameter.php
new file mode 100644
index 000000000..1e89ac29c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_negative-parameter.php
@@ -0,0 +1,16 @@
+push(1);
+ $dll->push(2);
+ $dll->push(3);
+
+ try {
+ $dll->offsetUnset(-1);
+ }
+ catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_negative-parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_negative-parameter.php.expectf
new file mode 100644
index 000000000..bbf10ec8a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_negative-parameter.php.expectf
@@ -0,0 +1 @@
+Offset out of range
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php
new file mode 100644
index 000000000..2f2430204
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php
@@ -0,0 +1,16 @@
+push(1);
+ $dll->push(2);
+ $dll->push(3);
+
+ try {
+ $dll->offsetUnset(3);
+ }
+ catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php.expectf
new file mode 100644
index 000000000..bbf10ec8a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php.expectf
@@ -0,0 +1 @@
+Offset out of range
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_noParams.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_noParams.php
new file mode 100644
index 000000000..6f5bee00f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_noParams.php
@@ -0,0 +1,7 @@
+push(1);
+$ll->push(2);
+
+var_dump($ll->pop(1));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_noParams.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_noParams.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_noParams.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_params.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_params.php
new file mode 100644
index 000000000..ea7a80cad
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_params.php
@@ -0,0 +1,7 @@
+pop( 'param' );
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_params.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_params.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_pop_params.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_push_missing_parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_push_missing_parameter.php
new file mode 100644
index 000000000..19e6e0126
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_push_missing_parameter.php
@@ -0,0 +1,4 @@
+push());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_push_missing_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_push_missing_parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_push_missing_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_serialization.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_serialization.php
new file mode 100644
index 000000000..ea0845bec
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_serialization.php
@@ -0,0 +1,16 @@
+enqueue("a");
+$q->enqueue("b");
+
+var_dump($q, $ss = serialize($q), unserialize($ss));
+
+$s = new SplStack();
+
+$s->push("a");
+$s->push("b");
+
+var_dump($s, $ss = serialize($s), unserialize($ss));
+?>
+==END==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_serialization.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_serialization.php.expectf
new file mode 100644
index 000000000..4779fef62
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_serialization.php.expectf
@@ -0,0 +1,47 @@
+object(SplQueue)#%d (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(4)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+string(42) "C:8:"SplQueue":22:{i:4;:s:1:"a";:s:1:"b";}"
+object(SplQueue)#%d (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(4)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+object(SplStack)#%d (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(6)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+string(42) "C:8:"SplStack":22:{i:6;:s:1:"a";:s:1:"b";}"
+object(SplStack)#%d (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(6)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+==END==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php
new file mode 100644
index 000000000..e679dd49e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php
@@ -0,0 +1,4 @@
+setIteratorMode(new SplDoublyLinkedList(2));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_array.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_array.php
new file mode 100644
index 000000000..729ca44ff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_array.php
@@ -0,0 +1,7 @@
+push("top");
+$list->top(array());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_array.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_array.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_array.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_float.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_float.php
new file mode 100644
index 000000000..acd3b4e91
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_float.php
@@ -0,0 +1,7 @@
+push("top");
+$list->top(3.14159);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_float.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_float.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_float.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_integer.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_integer.php
new file mode 100644
index 000000000..2b47fa887
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_integer.php
@@ -0,0 +1,7 @@
+push("top");
+$list->top(45);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_integer.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_integer.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_integer.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_null.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_null.php
new file mode 100644
index 000000000..7ab92fce2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_null.php
@@ -0,0 +1,7 @@
+push("top");
+$list->top(null);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_null.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_null.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_top_pass_null.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_unshift_missing_parameter.php b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_unshift_missing_parameter.php
new file mode 100644
index 000000000..f8c718120
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_unshift_missing_parameter.php
@@ -0,0 +1,4 @@
+unshift());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_unshift_missing_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_unshift_missing_parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_unshift_missing_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first.php b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first.php
new file mode 100644
index 000000000..1fa185136
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first.php
@@ -0,0 +1,8 @@
+push('oh');
+$list->push('hai');
+$list->push('thar');
+$list->offsetUnset(0);
+var_dump($list);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first.php.expectf
new file mode 100644
index 000000000..074e11559
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first.php.expectf
@@ -0,0 +1,11 @@
+object(SplDoublyLinkedList)#1 (2) {
+ [%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=>
+ int(0)
+ [%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ %string|unicode%(3) "hai"
+ [1]=>
+ %string|unicode%(4) "thar"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first002.php b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first002.php
new file mode 100644
index 000000000..1648f12b4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first002.php
@@ -0,0 +1,9 @@
+push('oh');
+$list->push('hai');
+$list->push('thar');
+echo $list->bottom() . "\n";
+$list->offsetUnset(0);
+echo $list->bottom() . "\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first002.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first002.php.expectf
new file mode 100644
index 000000000..736a23cc4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_first002.php.expectf
@@ -0,0 +1,2 @@
+oh
+hai
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_last.php b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_last.php
new file mode 100644
index 000000000..81f986571
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_last.php
@@ -0,0 +1,8 @@
+push('oh');
+$list->push('hai');
+$list->push('thar');
+$list->offsetUnset(2);
+var_dump($list);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_last.php.expectf b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_last.php.expectf
new file mode 100644
index 000000000..9b435ff49
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplDoublylinkedlist_offsetunset_last.php.expectf
@@ -0,0 +1,11 @@
+object(SplDoublyLinkedList)#1 (2) {
+ [%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=>
+ int(0)
+ [%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ %string|unicode%(2) "oh"
+ [1]=>
+ %string|unicode%(3) "hai"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php b/hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php
new file mode 100644
index 000000000..79accf2d6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php
@@ -0,0 +1,6 @@
+getGroup());
+?>
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php.expectf
new file mode 100644
index 000000000..42dd7af86
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: SplFileInfo->getGroup()
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/SplFileInfo_getGroup_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php b/hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php
new file mode 100644
index 000000000..0f26a7f4a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php
@@ -0,0 +1,6 @@
+getInode());
+?>
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php.expectf
new file mode 100644
index 000000000..a0c03935c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: SplFileInfo->getInode()
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/SplFileInfo_getInode_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php b/hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php
new file mode 100644
index 000000000..df3881ad7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php
@@ -0,0 +1,6 @@
+getOwner());
+?>
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php.expectf
new file mode 100644
index 000000000..d251a1d72
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: SplFileInfo->getOwner()
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/SplFileInfo_getOwner_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getPerms_error.php b/hphp/test/zend/bad/ext-spl/SplFileInfo_getPerms_error.php
new file mode 100644
index 000000000..b3d81d627
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getPerms_error.php
@@ -0,0 +1,6 @@
+getPerms() == 0100557);
+?>
diff --git a/hphp/test/zend/bad/ext-spl/SplFileInfo_getPerms_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileInfo_getPerms_error.php.expectf
new file mode 100644
index 000000000..68cafee19
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileInfo_getPerms_error.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: SplFileInfo->getPerms()
+#1 {main}
+ thrown in %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_current_basic.php b/hphp/test/zend/bad/ext-spl/SplFileObject_current_basic.php
new file mode 100644
index 000000000..e9d08ceeb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_current_basic.php
@@ -0,0 +1,9 @@
+current();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_current_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_current_basic.php.expectf
new file mode 100644
index 000000000..a81436628
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_current_basic.php.expectf
@@ -0,0 +1 @@
+seek(2);
+
+echo $s->current('foo');
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_current_error001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_current_error001.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_current_error001.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_current_variation001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_current_variation001.php
new file mode 100644
index 000000000..567ebe907
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_current_variation001.php
@@ -0,0 +1,11 @@
+seek(2);
+
+echo $s->current();
+echo $s->current();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_current_variation001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_current_variation001.php.expectf
new file mode 100644
index 000000000..ad4ea7344
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_current_variation001.php.expectf
@@ -0,0 +1,2 @@
+//line 3
+//line 3
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fflush_basic_001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fflush_basic_001.php
new file mode 100644
index 000000000..2cb7a5d5b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fflush_basic_001.php
@@ -0,0 +1,32 @@
+fflush());
+
+/*
+ * test a unsuccessful flush
+*/
+//create a basic stream class
+class VariableStream {
+ var $position;
+ var $varname;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ return true;
+ }
+
+ function url_stat() {
+ }
+}
+stream_wrapper_register("SPLtest", "VariableStream");
+$ftruncate_test = "";
+//end creating stream
+
+//open an SplFileObject using the above test stream
+$obj = New SplFileObject("SPLtest://ftruncate_test");
+var_dump($obj->fflush());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fflush_basic_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fflush_basic_001.php.expectf
new file mode 100644
index 000000000..98b68cefa
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fflush_basic_001.php.expectf
@@ -0,0 +1,2 @@
+bool(true)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fpassthru_basic.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fpassthru_basic.php
new file mode 100644
index 000000000..b262b4595
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fpassthru_basic.php
@@ -0,0 +1,4 @@
+fpassthru();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fpassthru_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fpassthru_basic.php.expectf
new file mode 100644
index 000000000..c08d198ac
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fpassthru_basic.php.expectf
@@ -0,0 +1,5 @@
+first,second,third
+1,2,3
+4,5,6
+7,8,9
+0,0,0
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv.php
new file mode 100644
index 000000000..e53a00baf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv.php
@@ -0,0 +1,55 @@
+ 'aaa,bbb',
+ 1 => 'aaa,"bbb"',
+ 2 => '"aaa","bbb"',
+ 3 => 'aaa,bbb',
+ 4 => '"aaa",bbb',
+ 5 => '"aaa", "bbb"',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"aaa"',
+ 9 => '"",""',
+ 10 => '"""""",',
+ 11 => '""""",aaa',
+ 12 => 'aaa,bbb ',
+ 13 => 'aaa,"bbb "',
+ 14 => 'aaa"aaa","bbb"bbb',
+ 15 => 'aaa"aaa""",bbb',
+ 16 => 'aaa,"\\"bbb,ccc',
+ 17 => 'aaa"\\"a","bbb"',
+ 18 => '"\\"","aaa"',
+ 19 => '"\\""",aaa',
+);
+
+foreach ($list as $v) {
+ $fo->fputcsv(explode(',', $v));
+}
+unset($fo);
+
+$res = file($file);
+foreach($res as &$val)
+{
+ $val = substr($val, 0, -1);
+}
+echo '$list = ';var_export($res);echo ";\n";
+
+$fp = fopen($file, "r");
+$res = array();
+while($l=fgetcsv($fp))
+{
+ $res[] = join(',',$l);
+}
+fclose($fp);
+
+echo '$list = ';var_export($res);echo ";\n";
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv.php.expectf
new file mode 100644
index 000000000..298729fb3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv.php.expectf
@@ -0,0 +1,45 @@
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"""bbb"""',
+ 2 => '"""aaa""","""bbb"""',
+ 3 => 'aaa,bbb',
+ 4 => '"""aaa""",bbb',
+ 5 => '"""aaa"""," ""bbb"""',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"""aaa"""',
+ 9 => '"""""",""""""',
+ 10 => '"""""""""""""",',
+ 11 => '"""""""""""",aaa',
+ 12 => 'aaa,"bbb "',
+ 13 => 'aaa,"""bbb """',
+ 14 => '"aaa""aaa""","""bbb""bbb"',
+ 15 => '"aaa""aaa""""""",bbb',
+ 16 => 'aaa,"""\\"bbb",ccc',
+ 17 => '"aaa""\\"a""","""bbb"""',
+ 18 => '"""\\"""","""aaa"""',
+ 19 => '"""\\"""""",aaa',
+);
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"bbb"',
+ 2 => '"aaa","bbb"',
+ 3 => 'aaa,bbb',
+ 4 => '"aaa",bbb',
+ 5 => '"aaa", "bbb"',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"aaa"',
+ 9 => '"",""',
+ 10 => '"""""",',
+ 11 => '""""",aaa',
+ 12 => 'aaa,bbb ',
+ 13 => 'aaa,"bbb "',
+ 14 => 'aaa"aaa","bbb"bbb',
+ 15 => 'aaa"aaa""",bbb',
+ 16 => 'aaa,"\\"bbb,ccc',
+ 17 => 'aaa"\\"a","bbb"',
+ 18 => '"\\"","aaa"',
+ 19 => '"\\""",aaa',
+);
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_002.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_002.php
new file mode 100644
index 000000000..6a1810dad
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_002.php
@@ -0,0 +1,12 @@
+fputcsv($data);
+
+var_dump($data);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_002.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_002.php.expectf
new file mode 100644
index 000000000..7121a2b7d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_002.php.expectf
@@ -0,0 +1,24 @@
+HipHop Notice: %a
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "foo"
+ [3]=>
+ string(4) "haha"
+ [4]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+ }
+ [5]=>
+ float(1.3)
+ [6]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_error.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_error.php
new file mode 100644
index 000000000..6422122f0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_error.php
@@ -0,0 +1,19 @@
+fputcsv() );
+
+// more than expected no. of args
+echo "-- Testing fputcsv() with more than expected number of arguments --\n";
+$fields = array("fld1", "fld2");
+$delim = ";";
+$enclosure ="\"";
+var_dump( $fo->fputcsv($fields, $delim, $enclosure, $fo) );
+
+echo "Done\n";
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_error.php.expectf
new file mode 100644
index 000000000..e6c951d78
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_error.php.expectf
@@ -0,0 +1,8 @@
+*** Testing error conditions ***
+-- Testing fputcsv() with zero argument --
+HipHop Warning: %a
+NULL
+-- Testing fputcsv() with more than expected number of arguments --
+HipHop Warning: %a
+NULL
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation1.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation1.php
new file mode 100644
index 000000000..a60383309
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation1.php
@@ -0,0 +1,63 @@
+fputcsv($csv_field, $delimiter, $enclosure) );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation1.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation1.php.expectf
new file mode 100644
index 000000000..acf40cdfe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation1.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with all parameters specified ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in a+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in w+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in x+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation10.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation10.php
new file mode 100644
index 000000000..cc47bc815
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation10.php
@@ -0,0 +1,56 @@
+fputcsv($csv_field) );
+
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation10.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation10.php.expectf
new file mode 100644
index 000000000..1f922db13
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation10.php.expectf
@@ -0,0 +1,266 @@
+*** Testing fputcsv() : with no CSV format in the field ***
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in r+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in r+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in r+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in a+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in a+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in a+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in w+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in w+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in w+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in x+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in x+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in x+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in r+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in r+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in r+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+
+-- file opened in a+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in a+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in a+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+
+-- file opened in w+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in w+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in w+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+
+-- file opened in x+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in x+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in x+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation11.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation11.php
new file mode 100644
index 000000000..60cbbbd8b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation11.php
@@ -0,0 +1,63 @@
+fputcsv($csv_field, $delimiter) );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation11.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation11.php.expectf
new file mode 100644
index 000000000..27d60bda1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation11.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with default enclosure value ***
+
+-- file opened in r+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in r+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in r+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in a+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in a+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in a+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in w+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in w+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in w+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in x+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in x+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in x+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation12.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation12.php
new file mode 100644
index 000000000..3ebdf2f74
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation12.php
@@ -0,0 +1,64 @@
+fputcsv($csv_field, '+') );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation12.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation12.php.expectf
new file mode 100644
index 000000000..afb55a6e2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation12.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with default enclosure and different delimiter value ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation13.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation13.php
new file mode 100644
index 000000000..dcf7f3c4f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation13.php
@@ -0,0 +1,18 @@
+fputcsv(array('water', 'fruit'), ',,', '"'));
+
+unset($fo);
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation13.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation13.php.expectf
new file mode 100644
index 000000000..f32f0379c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation13.php.expectf
@@ -0,0 +1,4 @@
+*** Testing fputcsv() : with default enclosure & delimiter of two chars ***
+HipHop Warning: %a
+bool(false)
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation14.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation14.php
new file mode 100644
index 000000000..7b01ce245
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation14.php
@@ -0,0 +1,18 @@
+fputcsv(array('water', 'fruit'), ',,', '""'));
+
+unset($fo);
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation14.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation14.php.expectf
new file mode 100644
index 000000000..59c2e3af9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation14.php.expectf
@@ -0,0 +1,4 @@
+*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***
+HipHop Warning: %a
+bool(false)
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation5.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation5.php
new file mode 100644
index 000000000..a780eef0f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation5.php
@@ -0,0 +1,63 @@
+fputcsv($csv_field) );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation5.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation5.php.expectf
new file mode 100644
index 000000000..b8b4d906e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation5.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with default arguments value ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation6.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation6.php
new file mode 100644
index 000000000..66b675854
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation6.php
@@ -0,0 +1,66 @@
+fputcsv($csv_field, '+', '%') );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation6.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation6.php.expectf
new file mode 100644
index 000000000..289f41037
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation6.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with different delimiter and enclosure ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in r+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in r+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in a+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in a+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in a+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in w+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in w+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in w+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in x+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in x+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in x+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation7.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation7.php
new file mode 100644
index 000000000..0f68eac47
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation7.php
@@ -0,0 +1,66 @@
+fputcsv($csv_field, '+', $enclosure) );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation7.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation7.php.expectf
new file mode 100644
index 000000000..ff83e4224
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation7.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with different delimiter and same enclosure ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in a+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in w+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in x+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation8.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation8.php
new file mode 100644
index 000000000..e76dc852b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation8.php
@@ -0,0 +1,66 @@
+fputcsv($csv_field, $delimiter, '+') );
+ // check the file pointer position and eof
+ var_dump( $fo->ftell() );
+ var_dump( $fo->eof() );
+ //close the file
+ unset($fo);
+
+ // print the file contents
+ var_dump( file_get_contents($file) );
+
+ //delete file
+ unlink($file);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation8.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation8.php.expectf
new file mode 100644
index 000000000..5fda91e80
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fputcsv_variation8.php.expectf
@@ -0,0 +1,758 @@
+*** Testing fputcsv() : with same delimiter and different enclosure ***
+
+-- file opened in r+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in r+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in r+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in a+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in a+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in a+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in w+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in w+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in w+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in x+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in x+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in x+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in r+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in r+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in r+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in a+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in a+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in a+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in w+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in w+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in w+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in x+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in x+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in x+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in r+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in r+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in r+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in a+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in a+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in a+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in w+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in w+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in w+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in x+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in x+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in x+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fscanf_basic.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fscanf_basic.php
new file mode 100644
index 000000000..cc8680c51
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fscanf_basic.php
@@ -0,0 +1,4 @@
+fscanf('%s'));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fscanf_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fscanf_basic.php.expectf
new file mode 100644
index 000000000..4265af51f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fscanf_basic.php.expectf
@@ -0,0 +1,4 @@
+array(1) {
+ [0]=>
+ string(18) "first,second,third"
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fseek_error_001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fseek_error_001.php
new file mode 100644
index 000000000..c8af88f63
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fseek_error_001.php
@@ -0,0 +1,5 @@
+fseek(1,2,3);
+$obj->fseek();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fseek_error_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fseek_error_001.php.expectf
new file mode 100644
index 000000000..55529a618
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fseek_error_001.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_ftruncate_error_001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_ftruncate_error_001.php
new file mode 100644
index 000000000..d17b19c2c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_ftruncate_error_001.php
@@ -0,0 +1,27 @@
+ftruncate(1);
+} catch (LogicException $e) {
+ echo($e->getMessage());
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_ftruncate_error_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_ftruncate_error_001.php.expectf
new file mode 100644
index 000000000..3284078ee
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_ftruncate_error_001.php.expectf
@@ -0,0 +1 @@
+Can't truncate file %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fwrite_error_001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_fwrite_error_001.php
new file mode 100644
index 000000000..2038443c9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fwrite_error_001.php
@@ -0,0 +1,5 @@
+fwrite();
+$obj->fwrite('6,6,6',25,null);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_fwrite_error_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_fwrite_error_001.php.expectf
new file mode 100644
index 000000000..55529a618
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_fwrite_error_001.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_getCsvControl_basic_001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_getCsvControl_basic_001.php
new file mode 100644
index 000000000..71a160e02
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_getCsvControl_basic_001.php
@@ -0,0 +1,5 @@
+getCsvControl());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_getCsvControl_basic_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_getCsvControl_basic_001.php.expectf
new file mode 100644
index 000000000..1863f3ee8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_getCsvControl_basic_001.php.expectf
@@ -0,0 +1,6 @@
+array(2) {
+ [0]=>
+ %unicode|string%(1) ","
+ [1]=>
+ %unicode|string%(1) """
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_getchildren_error001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_getchildren_error001.php
new file mode 100644
index 000000000..f4f702632
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_getchildren_error001.php
@@ -0,0 +1,5 @@
+getChildren('string');
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_getchildren_error001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_getchildren_error001.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_getchildren_error001.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_getflags_variation001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_getflags_variation001.php
new file mode 100644
index 000000000..10f3c5a26
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_getflags_variation001.php
@@ -0,0 +1,17 @@
+setFlags(SplFileObject::DROP_NEW_LINE);
+var_dump($fo->getFlags());
+
+$fo->setFlags(SplFileObject::READ_AHEAD);
+var_dump($fo->getFlags());
+
+$fo->setFlags(SplFileObject::SKIP_EMPTY);
+var_dump($fo->getFlags());
+
+$fo->setFlags(SplFileObject::READ_CSV);
+var_dump($fo->getFlags());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_getflags_variation001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_getflags_variation001.php.expectf
new file mode 100644
index 000000000..c26cd0241
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_getflags_variation001.php.expectf
@@ -0,0 +1,4 @@
+int(1)
+int(2)
+int(4)
+int(8)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_haschildren_error001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_haschildren_error001.php
new file mode 100644
index 000000000..f75a016bd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_haschildren_error001.php
@@ -0,0 +1,5 @@
+hasChildren('string');
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_haschildren_error001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_haschildren_error001.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_haschildren_error001.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_basic.php b/hphp/test/zend/bad/ext-spl/SplFileObject_key_basic.php
new file mode 100644
index 000000000..eef54f08f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_basic.php
@@ -0,0 +1,10 @@
+seek(3);
+echo $s->key();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_key_basic.php.expectf
new file mode 100644
index 000000000..e440e5c84
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_basic.php.expectf
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_error001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error001.php
new file mode 100644
index 000000000..45f2353e6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error001.php
@@ -0,0 +1,12 @@
+seek(12);
+$s->next();
+var_dump($s->key());
+var_dump($s->valid());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_error001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error001.php.expectf
new file mode 100644
index 000000000..d11b81214
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error001.php.expectf
@@ -0,0 +1,2 @@
+int(13)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_error002.php b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error002.php
new file mode 100644
index 000000000..e7c8f7aff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error002.php
@@ -0,0 +1,12 @@
+seek(120);
+$s->next();
+var_dump($s->key());
+var_dump($s->valid());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_error002.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error002.php.expectf
new file mode 100644
index 000000000..d11b81214
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error002.php.expectf
@@ -0,0 +1,2 @@
+int(13)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_error003.php b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error003.php
new file mode 100644
index 000000000..de7054a15
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error003.php
@@ -0,0 +1,8 @@
+key(3);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_key_error003.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error003.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_key_error003.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_next_basic.php b/hphp/test/zend/bad/ext-spl/SplFileObject_next_basic.php
new file mode 100644
index 000000000..a1e6e81c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_next_basic.php
@@ -0,0 +1,12 @@
+current();
+$s->next();
+
+echo $s->current();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_next_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_next_basic.php.expectf
new file mode 100644
index 000000000..02335890d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_next_basic.php.expectf
@@ -0,0 +1,2 @@
+seek(13);
+echo $s->current();
+
+$s->next();
+echo $s->current();
+var_dump($s->valid());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation001.php.expectf
new file mode 100644
index 000000000..4c849dc76
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation001.php.expectf
@@ -0,0 +1,2 @@
+?>
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation002.php b/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation002.php
new file mode 100644
index 000000000..e5ef5b195
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation002.php
@@ -0,0 +1,18 @@
+seek(2);
+echo $s->current();
+$s->next();
+echo $s->current();
+
+$s->setFlags(SplFileObject::READ_AHEAD);
+
+$s->seek(2);
+echo $s->current();
+$s->next();
+echo $s->current();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation002.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation002.php.expectf
new file mode 100644
index 000000000..d19788e08
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_next_variation002.php.expectf
@@ -0,0 +1,4 @@
+//line 3
+//line 4
+//line 3
+//line 4
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_basic.php b/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_basic.php
new file mode 100644
index 000000000..9bf76db2f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_basic.php
@@ -0,0 +1,12 @@
+seek(3);
+
+$s->rewind();
+echo $s->current();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_basic.php.expectf
new file mode 100644
index 000000000..a81436628
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_basic.php.expectf
@@ -0,0 +1 @@
+seek(15);
+echo $s->current();
+$s->next();
+echo $s->current();
+var_dump($s->valid());
+$s->rewind();
+var_dump($s->valid());
+echo $s->current();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_variation001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_variation001.php.expectf
new file mode 100644
index 000000000..e8a7e007c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_rewind_variation001.php.expectf
@@ -0,0 +1,4 @@
+?>
+bool(false)
+bool(true)
+seek(2);
+echo $s->current();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_seek_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_basic.php.expectf
new file mode 100644
index 000000000..7d0eb95a8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_basic.php.expectf
@@ -0,0 +1 @@
+//line 3
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error002.php b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error002.php
new file mode 100644
index 000000000..cc00fa6b9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error002.php
@@ -0,0 +1,10 @@
+seek(20);
+echo $s->current();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error002.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error002.php.expectf
new file mode 100644
index 000000000..e69de29bb
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error_001.php b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error_001.php
new file mode 100644
index 000000000..c32daf58a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error_001.php
@@ -0,0 +1,10 @@
+seek(1,2);
+$obj->seek();
+try {
+ $obj->seek(-1);
+} catch (LogicException $e) {
+ echo($e->getMessage());
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error_001.php.expectf
new file mode 100644
index 000000000..b023d0e7e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFileObject_seek_error_001.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+HipHop Warning: %a
+Can't seek file %s to negative line %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_array.php b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_array.php
new file mode 100644
index 000000000..ae4a0c4b4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_array.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_array.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_array.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_array.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_float.php b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_float.php
new file mode 100644
index 000000000..f5fa94a84
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_float.php
@@ -0,0 +1,7 @@
+getSize();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_float.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_float.php.expectf
new file mode 100644
index 000000000..e440e5c84
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_float.php.expectf
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_null.php b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_null.php
new file mode 100644
index 000000000..6d643f6a4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_null.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_null.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_null.php.expectf
new file mode 100644
index 000000000..f0ac41c0b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_null.php.expectf
@@ -0,0 +1,3 @@
+SplFixedArray Object
+(
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_string.php b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_string.php
new file mode 100644
index 000000000..374f925e6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_string.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_string.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_string.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray__construct_param_string.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_construct_param_SplFixedArray.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_construct_param_SplFixedArray.php
new file mode 100644
index 000000000..71fe1a2d3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_construct_param_SplFixedArray.php
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_construct_param_SplFixedArray.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_construct_param_SplFixedArray.php.expectf
new file mode 100644
index 000000000..e7cb54af2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_construct_param_SplFixedArray.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+object(SplFixedArray)#1 (0) {
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_count_checkParams.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_checkParams.php
new file mode 100644
index 000000000..af53457f3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_checkParams.php
@@ -0,0 +1,8 @@
+count(3);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_count_checkParams.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_checkParams.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_checkParams.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_count_param_int.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_param_int.php
new file mode 100644
index 000000000..24027d361
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_param_int.php
@@ -0,0 +1,4 @@
+count(3);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_count_param_int.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_param_int.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_count_param_int.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_current_param.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_current_param.php
new file mode 100644
index 000000000..5929bb22e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_current_param.php
@@ -0,0 +1,13 @@
+current( array("this","should","not","execute") );
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_current_param.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_current_param.php.expectf
new file mode 100644
index 000000000..771ac268e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_current_param.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+HipHop Warning: %a
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_001.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_001.php
new file mode 100644
index 000000000..7415460d4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_001.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_001.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_001.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_002.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_002.php
new file mode 100644
index 000000000..1b564f47c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_002.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_002.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_002.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromArray_invalid_parameter_002.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_indexes.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_indexes.php
new file mode 100644
index 000000000..25861e720
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_indexes.php
@@ -0,0 +1,6 @@
+ 1,
+ 2 => '2',
+ 3 => false));
+var_dump($array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_indexes.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_indexes.php.expectf
new file mode 100644
index 000000000..921f1a31a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_indexes.php.expectf
@@ -0,0 +1,10 @@
+object(SplFixedArray)#1 (4) {
+ [0]=>
+ NULL
+ [1]=>
+ int(1)
+ [2]=>
+ %string|unicode%(1) "2"
+ [3]=>
+ bool(false)
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_non_indexes.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_non_indexes.php
new file mode 100644
index 000000000..c14c1a2ba
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_non_indexes.php
@@ -0,0 +1,7 @@
+ 1,
+ 2 => '2',
+ 3 => false),
+ false);
+var_dump($array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_non_indexes.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_non_indexes.php.expectf
new file mode 100644
index 000000000..dca2412c6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_non_indexes.php.expectf
@@ -0,0 +1,8 @@
+object(SplFixedArray)#1 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ %string|unicode%(1) "2"
+ [2]=>
+ bool(false)
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_boolean.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_boolean.php
new file mode 100644
index 000000000..4b1490418
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_boolean.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_boolean.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_boolean.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_boolean.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_multiarray.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_multiarray.php
new file mode 100644
index 000000000..fe73cfbe8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_multiarray.php
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_multiarray.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_multiarray.php.expectf
new file mode 100644
index 000000000..cf3d6e44e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_fromarray_param_multiarray.php.expectf
@@ -0,0 +1,7 @@
+object(SplFixedArray)#1 (1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ %string|unicode%(1) "1"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_getSize_pass_param.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_getSize_pass_param.php
new file mode 100644
index 000000000..10e37d77e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_getSize_pass_param.php
@@ -0,0 +1,4 @@
+getSize(3);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_getSize_pass_param.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_getSize_pass_param.php.expectf
new file mode 100644
index 000000000..96ec1da1d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_getSize_pass_param.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+*test*
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_key_param.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_param.php
new file mode 100644
index 000000000..e1505ab7b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_param.php
@@ -0,0 +1,13 @@
+key( array("this","should","not","execute") );
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_key_param.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_param.php.expectf
new file mode 100644
index 000000000..771ac268e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_param.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+HipHop Warning: %a
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_key_setsize.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_setsize.php
new file mode 100644
index 000000000..10aaea70e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_setsize.php
@@ -0,0 +1,13 @@
+key( );
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_key_setsize.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_setsize.php.expectf
new file mode 100644
index 000000000..6da806d7a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_key_setsize.php.expectf
@@ -0,0 +1 @@
+0123
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_next_param.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_next_param.php
new file mode 100644
index 000000000..63b945d77
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_next_param.php
@@ -0,0 +1,11 @@
+next( "invalid" );
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_next_param.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_next_param.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_next_param.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_invalid_parameter.php
new file mode 100644
index 000000000..7a7b9c10d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetExists();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_less_than_zero.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_less_than_zero.php
new file mode 100644
index 000000000..e822c98ef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_less_than_zero.php
@@ -0,0 +1,6 @@
+offsetExists(-10) === false) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_less_than_zero.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_less_than_zero.php.expectf
new file mode 100644
index 000000000..465701e34
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetExists_less_than_zero.php.expectf
@@ -0,0 +1 @@
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetGet_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetGet_invalid_parameter.php
new file mode 100644
index 000000000..39bf64c6f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetGet_invalid_parameter.php
@@ -0,0 +1,8 @@
+offsetGet();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetGet_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetGet_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetGet_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_invalid_parameter.php
new file mode 100644
index 000000000..eaf504a70
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetSet();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_one_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_one_invalid_parameter.php
new file mode 100644
index 000000000..b96c54ff8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_one_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetSet(2);
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_one_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_one_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetSet_one_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_invalid_parameter.php
new file mode 100644
index 000000000..3f9feab47
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_invalid_parameter.php
@@ -0,0 +1,7 @@
+offsetUnset();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_invalid_parameter.php.expectf
new file mode 100644
index 000000000..5fa2682c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+PASS
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_string.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_string.php
new file mode 100644
index 000000000..08f665085
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_string.php
@@ -0,0 +1,15 @@
+offsetUnset("4");
+
+ var_dump($fixedArray);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_string.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_string.php.expectf
new file mode 100644
index 000000000..5288b5d22
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_offsetUnset_string.php.expectf
@@ -0,0 +1,12 @@
+object(SplFixedArray)#1 (5) {
+ [0]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [1]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [2]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [3]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [4]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_rewind_param.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_rewind_param.php
new file mode 100644
index 000000000..23ba79cbf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_rewind_param.php
@@ -0,0 +1,11 @@
+rewind( "invalid" );
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_rewind_param.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_rewind_param.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_rewind_param.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_filled_to_smaller.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_filled_to_smaller.php
new file mode 100644
index 000000000..346a3c493
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_filled_to_smaller.php
@@ -0,0 +1,10 @@
+setSize(2);
+var_dump($array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_filled_to_smaller.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_filled_to_smaller.php.expectf
new file mode 100644
index 000000000..8d1869b28
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_filled_to_smaller.php.expectf
@@ -0,0 +1,6 @@
+object(SplFixedArray)#1 (2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_array.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_array.php
new file mode 100644
index 000000000..c173e8f62
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_array.php
@@ -0,0 +1,5 @@
+setSize(array());
+var_dump($fixed_array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_array.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_array.php.expectf
new file mode 100644
index 000000000..c5c56b747
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_array.php.expectf
@@ -0,0 +1,7 @@
+HipHop Warning: %a
+object(SplFixedArray)#1 (2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_float.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_float.php
new file mode 100644
index 000000000..1c755776d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_float.php
@@ -0,0 +1,5 @@
+setSize(3.14159);
+var_dump($fixed_array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_float.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_float.php.expectf
new file mode 100644
index 000000000..2930c89b4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_float.php.expectf
@@ -0,0 +1,8 @@
+object(SplFixedArray)#1 (3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_null.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_null.php
new file mode 100644
index 000000000..a1f755b34
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_null.php
@@ -0,0 +1,5 @@
+setSize(null);
+var_dump($fixed_array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_null.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_null.php.expectf
new file mode 100644
index 000000000..ec1e3d312
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_param_null.php.expectf
@@ -0,0 +1,2 @@
+object(SplFixedArray)#1 (0) {
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_reduce.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_reduce.php
new file mode 100644
index 000000000..6231ea1cf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_reduce.php
@@ -0,0 +1,10 @@
+setSize(3);
+print_r($array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_reduce.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_reduce.php.expectf
new file mode 100644
index 000000000..3ff182c41
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setSize_reduce.php.expectf
@@ -0,0 +1,6 @@
+SplFixedArray Object
+(
+ [0] => a
+ [1] => b
+ [2] => c
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_001.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_001.php
new file mode 100644
index 000000000..5e97759a0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_001.php
@@ -0,0 +1,10 @@
+setSize(2);
+var_dump($array);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_001.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_001.php.expectf
new file mode 100644
index 000000000..79de6945a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_001.php.expectf
@@ -0,0 +1,6 @@
+object(SplFixedArray)#1 (2) {
+ [0]=>
+ %string|unicode%(3) "one"
+ [1]=>
+ %string|unicode%(3) "two"
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_grow.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_grow.php
new file mode 100644
index 000000000..e3042f1c2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_grow.php
@@ -0,0 +1,17 @@
+setSize(4);
+
+$array[2] = "Value 3";
+$array[3] = "Value 4";
+
+print_r($array);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_grow.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_grow.php.expectf
new file mode 100644
index 000000000..90df7cddf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_grow.php.expectf
@@ -0,0 +1,7 @@
+SplFixedArray Object
+(
+ [0] => Value 1
+ [1] => Value 2
+ [2] => Value 3
+ [3] => Value 4
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_shrink.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_shrink.php
new file mode 100644
index 000000000..cf683dcca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_shrink.php
@@ -0,0 +1,12 @@
+setSize(4);
+var_dump($array);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_shrink.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_shrink.php.expectf
new file mode 100644
index 000000000..4fd3e8ab2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_setsize_shrink.php.expectf
@@ -0,0 +1,10 @@
+object(SplFixedArray)#1 (4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_toArray_with-params.php b/hphp/test/zend/bad/ext-spl/SplFixedArray_toArray_with-params.php
new file mode 100644
index 000000000..dbbd803df
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_toArray_with-params.php
@@ -0,0 +1,12 @@
+count(1);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplFixedArray_toArray_with-params.php.expectf b/hphp/test/zend/bad/ext-spl/SplFixedArray_toArray_with-params.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplFixedArray_toArray_with-params.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_count_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplHeap_count_invalid_parameter.php
new file mode 100644
index 000000000..6f7c43c66
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_count_invalid_parameter.php
@@ -0,0 +1,20 @@
+count($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_count_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplHeap_count_invalid_parameter.php.expectf
new file mode 100644
index 000000000..6e7628d38
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_count_invalid_parameter.php.expectf
@@ -0,0 +1,14 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_extract_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplHeap_extract_invalid_parameter.php
new file mode 100644
index 000000000..e25b42ed7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_extract_invalid_parameter.php
@@ -0,0 +1,20 @@
+extract($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_extract_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplHeap_extract_invalid_parameter.php.expectf
new file mode 100644
index 000000000..6e7628d38
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_extract_invalid_parameter.php.expectf
@@ -0,0 +1,14 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_insert_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplHeap_insert_invalid_parameter.php
new file mode 100644
index 000000000..c2cb1a493
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_insert_invalid_parameter.php
@@ -0,0 +1,7 @@
+insert());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_insert_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplHeap_insert_invalid_parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_insert_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty.php b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty.php
new file mode 100644
index 000000000..191317d2d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty.php
@@ -0,0 +1,7 @@
+isEmpty());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty.php.expectf b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty_invalid_parameter.php
new file mode 100644
index 000000000..048cf72a3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty_invalid_parameter.php
@@ -0,0 +1,20 @@
+isEmpty($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty_invalid_parameter.php.expectf
new file mode 100644
index 000000000..6e7628d38
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplHeap_isEmpty_invalid_parameter.php.expectf
@@ -0,0 +1,14 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_addAll_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_addAll_invalid_parameter.php
new file mode 100644
index 000000000..db5d70496
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_addAll_invalid_parameter.php
@@ -0,0 +1,19 @@
+addAll($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_addAll_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_addAll_invalid_parameter.php.expectf
new file mode 100644
index 000000000..2b40cd758
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_addAll_invalid_parameter.php.expectf
@@ -0,0 +1,12 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_attach_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_attach_invalid_parameter.php
new file mode 100644
index 000000000..4f23734ef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_attach_invalid_parameter.php
@@ -0,0 +1,8 @@
+attach(true));
+var_dump($s->attach(new stdClass, true, true));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_attach_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_attach_invalid_parameter.php.expectf
new file mode 100644
index 000000000..b9d470d59
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_attach_invalid_parameter.php.expectf
@@ -0,0 +1,4 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_contains_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_contains_invalid_parameter.php
new file mode 100644
index 000000000..2635d079c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_contains_invalid_parameter.php
@@ -0,0 +1,19 @@
+contains($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_contains_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_contains_invalid_parameter.php.expectf
new file mode 100644
index 000000000..2b40cd758
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_contains_invalid_parameter.php.expectf
@@ -0,0 +1,12 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_current_empty_storage.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_current_empty_storage.php
new file mode 100644
index 000000000..112ec5f29
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_current_empty_storage.php
@@ -0,0 +1,7 @@
+current());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_current_empty_storage.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_current_empty_storage.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_current_empty_storage.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_detach_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_detach_invalid_parameter.php
new file mode 100644
index 000000000..0333590ca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_detach_invalid_parameter.php
@@ -0,0 +1,19 @@
+detach($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_detach_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_detach_invalid_parameter.php.expectf
new file mode 100644
index 000000000..2b40cd758
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_detach_invalid_parameter.php.expectf
@@ -0,0 +1,12 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_getHash.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getHash.php
new file mode 100644
index 000000000..fdb646fd6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getHash.php
@@ -0,0 +1,49 @@
+offsetGet($o1);
+
+class MySplObjectStorage extends SplObjectStorage {
+ public function getHash($obj) {
+ return 2;
+ }
+}
+
+try {
+ $s1 = new MySplObjectStorage;
+ $s1[$o1] = "foo";
+} catch(Exception $e) {
+ echo "caught\n";
+}
+
+class MySplObjectStorage2 extends SplObjectStorage {
+ public function getHash($obj) {
+ throw new Exception("foo");
+ return "asd";
+ }
+}
+
+try {
+ $s2 = new MySplObjectStorage2;
+ $s2[$o2] = "foo";
+} catch(Exception $e) {
+ echo "caught\n";
+}
+
+class MySplObjectStorage3 extends SplObjectStorage {
+ public function getHash($obj) {
+ return "asd";
+ }
+}
+
+$s3 = new MySplObjectStorage3;
+$s3[$o1] = $o1;
+var_dump($s3[$o1]);
+$s3[$o2] = $o2;
+
+var_dump($s3[$o1] === $s3[$o2]);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_getHash.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getHash.php.expectf
new file mode 100644
index 000000000..6048f2ac5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getHash.php.expectf
@@ -0,0 +1,7 @@
+some_value
+caught
+caught
+object(stdClass)#2 (0) {
+}
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_getInfo_empty_storage.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getInfo_empty_storage.php
new file mode 100644
index 000000000..d63c546df
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getInfo_empty_storage.php
@@ -0,0 +1,7 @@
+getInfo());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_getInfo_empty_storage.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getInfo_empty_storage.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_getInfo_empty_storage.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet.php
new file mode 100644
index 000000000..e1c362c9a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet.php
@@ -0,0 +1,9 @@
+offsetGet($o1);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet.php.expectf
new file mode 100644
index 000000000..f18d5a04d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet.php.expectf
@@ -0,0 +1 @@
+some_value
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_invalid_parameter.php
new file mode 100644
index 000000000..cfec71d40
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_invalid_parameter.php
@@ -0,0 +1,21 @@
+offsetGet($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_invalid_parameter.php.expectf
new file mode 100644
index 000000000..2b40cd758
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_invalid_parameter.php.expectf
@@ -0,0 +1,12 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_missing_object.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_missing_object.php
new file mode 100644
index 000000000..12341a8f5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_missing_object.php
@@ -0,0 +1,12 @@
+offsetGet($o1);
+} catch (UnexpectedValueException $e) {
+ echo $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_missing_object.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_missing_object.php.expectf
new file mode 100644
index 000000000..07917ecbd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_offsetGet_missing_object.php.expectf
@@ -0,0 +1 @@
+Object not found
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_basic.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_basic.php
new file mode 100644
index 000000000..070683f02
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_basic.php
@@ -0,0 +1,19 @@
+attach($a);
+ $foo->attach($b);
+
+ $bar = new SplObjectStorage;
+ $bar->attach($b);
+ $bar->attach($c);
+
+ $foo->removeAllExcept($bar);
+ var_dump($foo->contains($a));
+ var_dump($foo->contains($b));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_basic.php.expectf
new file mode 100644
index 000000000..9afc88e48
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_basic.php.expectf
@@ -0,0 +1,2 @@
+bool(false)
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_invalid_parameter.php
new file mode 100644
index 000000000..ca9f8ddbf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_invalid_parameter.php
@@ -0,0 +1,19 @@
+removeAllExcept($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_invalid_parameter.php.expectf
new file mode 100644
index 000000000..2b40cd758
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAllExcept_invalid_parameter.php.expectf
@@ -0,0 +1,12 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAll_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAll_invalid_parameter.php
new file mode 100644
index 000000000..29ffcb6cc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAll_invalid_parameter.php
@@ -0,0 +1,19 @@
+removeAll($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAll_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAll_invalid_parameter.php.expectf
new file mode 100644
index 000000000..2b40cd758
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_removeAll_invalid_parameter.php.expectf
@@ -0,0 +1,12 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_empty_storage.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_empty_storage.php
new file mode 100644
index 000000000..ee0448aad
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_empty_storage.php
@@ -0,0 +1,7 @@
+setInfo('some_value'));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_empty_storage.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_empty_storage.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_empty_storage.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_invalid_parameter.php
new file mode 100644
index 000000000..dcc03c2ff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_invalid_parameter.php
@@ -0,0 +1,7 @@
+setInfo());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_invalid_parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_setInfo_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_bad.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_bad.php
new file mode 100644
index 000000000..69277d116
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_bad.php
@@ -0,0 +1,16 @@
+unserialize($blob);
+ var_dump($so);
+} catch(UnexpectedValueException $e) {
+ echo $e->getMessage()."\n";
+}
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_bad.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_bad.php.expectf
new file mode 100644
index 000000000..60848065d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_bad.php.expectf
@@ -0,0 +1,24 @@
+Error at offset 6 of 34 bytes
+Error at offset 46 of 89 bytes
+object(SplObjectStorage)#2 (1) {
+ ["storage":"SplObjectStorage":private]=>
+ array(2) {
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#3 (0) {
+ }
+ ["inf"]=>
+ int(1)
+ }
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#1 (0) {
+ }
+ ["inf"]=>
+ object(stdClass)#3 (0) {
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter1.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter1.php
new file mode 100644
index 000000000..03b68da25
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter1.php
@@ -0,0 +1,15 @@
+unserialize($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter1.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter1.php.expectf
new file mode 100644
index 000000000..b9d470d59
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter1.php.expectf
@@ -0,0 +1,4 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter2.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter2.php
new file mode 100644
index 000000000..ee89eab4e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter2.php
@@ -0,0 +1,22 @@
+unserialize($input);
+ } catch(UnexpectedValueException $e) {
+ echo $e->getMessage() . PHP_EOL;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter2.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter2.php.expectf
new file mode 100644
index 000000000..ed11bb5a3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter2.php.expectf
@@ -0,0 +1,5 @@
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter3.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter3.php
new file mode 100644
index 000000000..b44df4ee9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter3.php
@@ -0,0 +1,11 @@
+unserialize(NULL);
+} catch(UnexpectedValueException $e) {
+ echo $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter3.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter3.php.expectf
new file mode 100644
index 000000000..5a2d02e63
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_invalid_parameter3.php.expectf
@@ -0,0 +1 @@
+Empty serialized string cannot be empty
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_nested.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_nested.php
new file mode 100644
index 000000000..c39db87bc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_nested.php
@@ -0,0 +1,16 @@
+a = $a;
+
+$so = new SplObjectStorage();
+
+$so[$o] = 1;
+$so[$a] = 2;
+
+$s = serialize($so);
+echo $s."\n";
+
+$so1 = unserialize($s);
+var_dump($so1);
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_nested.php.expectf b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_nested.php.expectf
new file mode 100644
index 000000000..a4ec30892
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_unserialize_nested.php.expectf
@@ -0,0 +1,25 @@
+C:16:"SplObjectStorage":76:{x:i:2;O:8:"stdClass":1:{s:1:"a";O:8:"stdClass":0:{}},i:1;;r:4;,i:2;;m:a:0:{}}
+object(SplObjectStorage)#4 (1) {
+ ["storage":"SplObjectStorage":private]=>
+ array(2) {
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#5 (1) {
+ ["a"]=>
+ object(stdClass)#6 (0) {
+ }
+ }
+ ["inf"]=>
+ int(1)
+ }
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#6 (0) {
+ }
+ ["inf"]=>
+ int(2)
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplObjectStorage_var_dump.php b/hphp/test/zend/bad/ext-spl/SplObjectStorage_var_dump.php
new file mode 100644
index 000000000..8a03c8f26
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplObjectStorage_var_dump.php
@@ -0,0 +1,6 @@
+
+ array(1) {
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#%d (0) {
+ }
+ ["inf"]=>
+ *RECURSION*
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplPriorityQueue_extract_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_extract_invalid_parameter.php
new file mode 100644
index 000000000..87eb653b7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_extract_invalid_parameter.php
@@ -0,0 +1,20 @@
+extract($input));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplPriorityQueue_extract_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_extract_invalid_parameter.php.expectf
new file mode 100644
index 000000000..6e7628d38
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_extract_invalid_parameter.php.expectf
@@ -0,0 +1,14 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplPriorityQueue_insert_invalid_parameter.php b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_insert_invalid_parameter.php
new file mode 100644
index 000000000..c7e22728d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_insert_invalid_parameter.php
@@ -0,0 +1,7 @@
+insert(NULL));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplPriorityQueue_insert_invalid_parameter.php.expectf b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_insert_invalid_parameter.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplPriorityQueue_insert_invalid_parameter.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode.php b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode.php
new file mode 100644
index 000000000..669ed4487
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode.php
@@ -0,0 +1,8 @@
+setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode.php.expectf b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode.php.expectf
new file mode 100644
index 000000000..69ef320c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode.php.expectf
@@ -0,0 +1 @@
+Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode_param_lifo.php b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode_param_lifo.php
new file mode 100644
index 000000000..37ec3eeee
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode_param_lifo.php
@@ -0,0 +1,12 @@
+setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode_param_lifo.php.expectf b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode_param_lifo.php.expectf
new file mode 100644
index 000000000..69ef320c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplQueue_setIteratorMode_param_lifo.php.expectf
@@ -0,0 +1 @@
+Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplStack_setIteratorMode.php b/hphp/test/zend/bad/ext-spl/SplStack_setIteratorMode.php
new file mode 100644
index 000000000..a54fd3e03
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplStack_setIteratorMode.php
@@ -0,0 +1,8 @@
+setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplStack_setIteratorMode.php.expectf b/hphp/test/zend/bad/ext-spl/SplStack_setIteratorMode.php.expectf
new file mode 100644
index 000000000..69ef320c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplStack_setIteratorMode.php.expectf
@@ -0,0 +1 @@
+Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_basic.php b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_basic.php
new file mode 100644
index 000000000..aa712d7fe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_basic.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_basic.php.expectf
new file mode 100644
index 000000000..cb2d9ea53
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_basic.php.expectf
@@ -0,0 +1,12 @@
+object(SplTempFileObject)#1 (5) {
+ ["pathName":"SplFileInfo":private]=>
+ string(10) "php://temp"
+ ["fileName":"SplFileInfo":private]=>
+ string(10) "php://temp"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "w"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_error.php b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_error.php
new file mode 100644
index 000000000..194cf19d8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_error.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_error.php.expectf b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_error.php.expectf
new file mode 100644
index 000000000..719057283
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_error.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: SplTempFileObject->__construct('invalid')
+#1 {main}
+ thrown in %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_maxmemory_basic.php b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_maxmemory_basic.php
new file mode 100644
index 000000000..e5bf7822f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_maxmemory_basic.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_maxmemory_basic.php.expectf b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_maxmemory_basic.php.expectf
new file mode 100644
index 000000000..e11e11860
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_maxmemory_basic.php.expectf
@@ -0,0 +1,12 @@
+object(SplTempFileObject)#1 (5) {
+ ["pathName":"SplFileInfo":private]=>
+ string(25) "php://temp/maxmemory:1024"
+ ["fileName":"SplFileInfo":private]=>
+ string(25) "php://temp/maxmemory:1024"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "w"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_memory_lt1_variation.php b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_memory_lt1_variation.php
new file mode 100644
index 000000000..d10f20a78
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_memory_lt1_variation.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_memory_lt1_variation.php.expectf b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_memory_lt1_variation.php.expectf
new file mode 100644
index 000000000..ae6e07c4d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/SplTempFileObject_constructor_memory_lt1_variation.php.expectf
@@ -0,0 +1,12 @@
+object(SplTempFileObject)#1 (5) {
+ ["pathName":"SplFileInfo":private]=>
+ string(12) "php://memory"
+ ["fileName":"SplFileInfo":private]=>
+ string(12) "php://memory"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "w"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic1.php
new file mode 100644
index 000000000..2006ff5c2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic1.php
@@ -0,0 +1,15 @@
+ No arguments:\n";
+var_dump(new ArrayObject());
+
+echo "--> Object argument:\n";
+$a = new stdClass;
+$a->p = 'hello';
+var_dump(new ArrayObject($a));
+
+echo "--> Array argument:\n";
+var_dump(new ArrayObject(array('key1' => 'val1')));
+
+echo "--> Nested ArrayObject argument:\n";
+var_dump(new ArrayObject(new ArrayObject($a)));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic1.php.expectf
new file mode 100644
index 000000000..00b2f8b0d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic1.php.expectf
@@ -0,0 +1,33 @@
+--> No arguments:
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+--> Object argument:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(stdClass)#1 (1) {
+ ["p"]=>
+ string(5) "hello"
+ }
+}
+--> Array argument:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ ["key1"]=>
+ string(4) "val1"
+ }
+}
+--> Nested ArrayObject argument:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(stdClass)#1 (1) {
+ ["p"]=>
+ string(5) "hello"
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic2.php
new file mode 100644
index 000000000..16966fced
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic2.php
@@ -0,0 +1,45 @@
+ Access prop on instance of ArrayObject:\n";
+$c = new C;
+$ao = new ArrayObject($c);
+testAccess($c, $ao);
+
+echo "\n--> Access prop on instance of MyArrayObject:\n";
+$c = new C;
+$ao = new MyArrayObject($c);
+testAccess($c, $ao);
+
+function testAccess($c, $ao) {
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
+
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
+
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - After:\n";
+ var_dump($ao, $c);
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic2.php.expectf
new file mode 100644
index 000000000..8d5ed9372
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic2.php.expectf
@@ -0,0 +1,51 @@
+--> Access prop on instance of ArrayObject:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+NULL
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed1"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (0) {
+ }
+}
+object(C)#1 (0) {
+}
+
+--> Access prop on instance of MyArrayObject:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+string(24) "MyArrayObject::prop.orig"
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed1"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(MyArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#4 (0) {
+ }
+}
+object(C)#4 (0) {
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic3.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic3.php
new file mode 100644
index 000000000..f3f89cfd8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic3.php
@@ -0,0 +1,45 @@
+ Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:\n";
+$c = new C;
+$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST);
+testAccess($c, $ao);
+
+echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST:\n";
+$c = new C;
+$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST);
+testAccess($c, $ao);
+
+function testAccess($c, $ao) {
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
+
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
+
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - After:\n";
+ var_dump($ao, $c);
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic3.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic3.php.expectf
new file mode 100644
index 000000000..77c756562
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic3.php.expectf
@@ -0,0 +1,51 @@
+--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+NULL
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed1"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (0) {
+ }
+}
+object(C)#1 (0) {
+}
+
+--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+string(24) "MyArrayObject::prop.orig"
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed1"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(MyArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#4 (0) {
+ }
+}
+object(C)#4 (0) {
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic4.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic4.php
new file mode 100644
index 000000000..7ab775143
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic4.php
@@ -0,0 +1,45 @@
+ Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:\n";
+$c = new C;
+$ao = new ArrayObject($c, ArrayObject::ARRAY_AS_PROPS);
+testAccess($c, $ao);
+
+echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::ARRAY_AS_PROPS:\n";
+$c = new C;
+$ao = new MyArrayObject($c, ArrayObject::ARRAY_AS_PROPS);
+testAccess($c, $ao);
+
+function testAccess($c, $ao) {
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
+
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
+
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - After:\n";
+ var_dump($ao, $c);
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic4.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic4.php.expectf
new file mode 100644
index 000000000..9392ebcda
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic4.php.expectf
@@ -0,0 +1,52 @@
+--> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+string(12) "C::prop.orig"
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed2"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (0) {
+ }
+}
+object(C)#1 (0) {
+}
+
+--> Access prop on instance of MyArrayObject with ArrayObject::ARRAY_AS_PROPS:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+string(24) "MyArrayObject::prop.orig"
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed1"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(MyArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#4 (0) {
+ }
+}
+object(C)#4 (0) {
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic5.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic5.php
new file mode 100644
index 000000000..2a968a22d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic5.php
@@ -0,0 +1,45 @@
+ Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
+$c = new C;
+$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
+testAccess($c, $ao);
+
+echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
+$c = new C;
+$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
+testAccess($c, $ao);
+
+function testAccess($c, $ao) {
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
+
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
+
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
+
+ echo " - After:\n";
+ var_dump($ao, $c);
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic5.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic5.php.expectf
new file mode 100644
index 000000000..e4906a154
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic5.php.expectf
@@ -0,0 +1,52 @@
+--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+string(12) "C::prop.orig"
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed2"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (0) {
+ }
+}
+object(C)#1 (0) {
+}
+
+--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:
+ - Iteration:
+ prop=>C::prop.orig
+ - Read:
+string(24) "MyArrayObject::prop.orig"
+string(12) "C::prop.orig"
+ - Write:
+string(8) "changed1"
+string(8) "changed2"
+ - Isset:
+bool(true)
+bool(true)
+ - Unset:
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
+ - After:
+object(MyArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#4 (0) {
+ }
+}
+object(C)#4 (0) {
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic6.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic6.php
new file mode 100644
index 000000000..5f0ce7796
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic6.php
@@ -0,0 +1,20 @@
+p = 1;
+var_dump($ao);
+
+$ao = new ArrayObject(array(1,2,3), ArrayObject::STD_PROP_LIST);
+$ao->p = 1;
+var_dump($ao);
+
+$ao = new MyArrayObject(array(1,2,3));
+var_dump($ao);
+
+$ao = new MyArrayObject(array(1,2,3), ArrayObject::STD_PROP_LIST);
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic6.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic6.php.expectf
new file mode 100644
index 000000000..663289738
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_basic6.php.expectf
@@ -0,0 +1,56 @@
+object(ArrayObject)#1 (2) {
+ ["p"]=>
+ int(1)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+object(ArrayObject)#2 (2) {
+ ["p"]=>
+ int(1)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+object(MyArrayObject)#1 (3) {
+ ["priv1":"MyArrayObject":private]=>
+ string(7) "secret1"
+ ["pub1"]=>
+ string(7) "public1"
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+object(MyArrayObject)#2 (3) {
+ ["priv1":"MyArrayObject":private]=>
+ string(7) "secret1"
+ ["pub1"]=>
+ string(7) "public1"
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_error1.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error1.php
new file mode 100644
index 000000000..12e3bb944
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error1.php
@@ -0,0 +1,17 @@
+p = 1;
+try {
+ var_dump(new ArrayObject($a, 0, "Exception"));
+} catch (InvalidArgumentException $e) {
+ echo $e->getMessage() . "(" . $e->getLine() . ")\n";
+}
+
+echo "Non-existent class:\n";
+try {
+ var_dump(new ArrayObject(new stdClass, 0, "nonExistentClassName"));
+} catch (InvalidArgumentException $e) {
+ echo $e->getMessage() . "(" . $e->getLine() . ")\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_error1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error1.php.expectf
new file mode 100644
index 000000000..02a617969
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error1.php.expectf
@@ -0,0 +1,4 @@
+Bad iterator type:
+ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'Exception' given(6)
+Non-existent class:
+ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClassName' given(13)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_error2.php b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error2.php
new file mode 100644
index 000000000..890a822fe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error2.php
@@ -0,0 +1,16 @@
+getMessage() . "(" . $e->getLine() . ")\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject___construct_error2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error2.php.expectf
new file mode 100644
index 000000000..ce3599b8e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject___construct_error2.php.expectf
@@ -0,0 +1,2 @@
+Too many arguments:
+ArrayObject::__construct() expects at most 3 parameters, 4 given(12)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic1.php
new file mode 100644
index 000000000..d87593ac2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic1.php
@@ -0,0 +1,20 @@
+4,'b'=>2,'c'=>3));
+var_dump($ao1->asort());
+var_dump($ao1);
+var_dump($ao2->asort('blah'));
+var_dump($ao2);
+var_dump($ao2->asort(SORT_NUMERIC));
+var_dump($ao2);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic1.php.expectf
new file mode 100644
index 000000000..065247558
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic1.php.expectf
@@ -0,0 +1,39 @@
+*** Testing ArrayObject::asort() : basic functionality ***
+bool(true)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [0]=>
+ int(4)
+ }
+}
+HipHop Warning: %a
+bool(false)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ ["a"]=>
+ int(4)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ }
+}
+bool(true)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["a"]=>
+ int(4)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic2.php
new file mode 100644
index 000000000..55937fdb9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic2.php
@@ -0,0 +1,22 @@
+asort());
+var_dump($ao1, $c);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic2.php.expectf
new file mode 100644
index 000000000..c4ddccf43
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_asort_basic2.php.expectf
@@ -0,0 +1,26 @@
+*** Testing ArrayObject::asort() : basic functionality ***
+bool(true)
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (4) {
+ ["prop3":"C":private]=>
+ string(1) "a"
+ ["prop1"]=>
+ string(1) "x"
+ ["prop4"]=>
+ string(1) "x"
+ ["prop2"]=>
+ string(1) "z"
+ }
+}
+object(C)#1 (4) {
+ ["prop3":"C":private]=>
+ string(1) "a"
+ ["prop1"]=>
+ string(1) "x"
+ ["prop4"]=>
+ string(1) "x"
+ ["prop2"]=>
+ string(1) "z"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic1.php
new file mode 100644
index 000000000..24551d118
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic1.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic1.php.expectf
new file mode 100644
index 000000000..95de42865
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic1.php.expectf
@@ -0,0 +1,32 @@
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ ["p1"]=>
+ string(35) "new element added to a before clone"
+ ["p2"]=>
+ string(34) "new element added to a after clone"
+}
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ ["new.aa1"]=>
+ string(24) "new element added to aa1"
+ }
+}
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ ["new.aa2"]=>
+ string(24) "new element added to aa2"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic2.php
new file mode 100644
index 000000000..fcd3e6477
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic2.php
@@ -0,0 +1,14 @@
+p1 = 'new prop added to c before clone';
+
+$ao2 = clone $ao1;
+
+$c->p2 = 'new prop added to c after clone';
+$ao1['new.ao1'] = 'new element added to ao1';
+$ao2['new.ao2'] = 'new element added to ao2';
+var_dump($c, $ao1, $ao2);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic2.php.expectf
new file mode 100644
index 000000000..d6f82cbaf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic2.php.expectf
@@ -0,0 +1,28 @@
+object(C)#1 (3) {
+ ["p1"]=>
+ string(32) "new prop added to c before clone"
+ ["p2"]=>
+ string(31) "new prop added to c after clone"
+ ["new.ao1"]=>
+ string(24) "new element added to ao1"
+}
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (3) {
+ ["p1"]=>
+ string(32) "new prop added to c before clone"
+ ["p2"]=>
+ string(31) "new prop added to c after clone"
+ ["new.ao1"]=>
+ string(24) "new element added to ao1"
+ }
+}
+object(ArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ ["p1"]=>
+ string(32) "new prop added to c before clone"
+ ["new.ao2"]=>
+ string(24) "new element added to ao2"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic3.php b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic3.php
new file mode 100644
index 000000000..36da9d468
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic3.php
@@ -0,0 +1,20 @@
+dynamic1 = 'new prop added to $wrappedObject before clone';
+$clonedOuterArrayObject = clone $outerArrayObject;
+$wrappedObject->dynamic2 = 'new prop added to $wrappedObject after clone';
+
+$innerArrayObject['new.iAO'] = 'new element added $innerArrayObject';
+$outerArrayObject['new.oAO'] = 'new element added to $outerArrayObject';
+$clonedOuterArrayObject['new.coAO'] = 'new element added to $clonedOuterArrayObject';
+
+var_dump($wrappedObject, $innerArrayObject, $outerArrayObject, $clonedOuterArrayObject);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic3.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic3.php.expectf
new file mode 100644
index 000000000..beb276ed6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_clone_basic3.php.expectf
@@ -0,0 +1,56 @@
+object(C)#1 (5) {
+ ["p"]=>
+ string(9) "C::p.orig"
+ ["dynamic1"]=>
+ string(45) "new prop added to $wrappedObject before clone"
+ ["dynamic2"]=>
+ string(44) "new prop added to $wrappedObject after clone"
+ ["new.iAO"]=>
+ string(35) "new element added $innerArrayObject"
+ ["new.oAO"]=>
+ string(38) "new element added to $outerArrayObject"
+}
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["p"]=>
+ string(9) "C::p.orig"
+ ["dynamic1"]=>
+ string(45) "new prop added to $wrappedObject before clone"
+ ["dynamic2"]=>
+ string(44) "new prop added to $wrappedObject after clone"
+ ["new.iAO"]=>
+ string(35) "new element added $innerArrayObject"
+ ["new.oAO"]=>
+ string(38) "new element added to $outerArrayObject"
+ }
+}
+object(ArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["p"]=>
+ string(9) "C::p.orig"
+ ["dynamic1"]=>
+ string(45) "new prop added to $wrappedObject before clone"
+ ["dynamic2"]=>
+ string(44) "new prop added to $wrappedObject after clone"
+ ["new.iAO"]=>
+ string(35) "new element added $innerArrayObject"
+ ["new.oAO"]=>
+ string(38) "new element added to $outerArrayObject"
+ }
+ }
+}
+object(ArrayObject)#4 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ ["p"]=>
+ string(9) "C::p.orig"
+ ["dynamic1"]=>
+ string(45) "new prop added to $wrappedObject before clone"
+ ["new.coAO"]=>
+ string(44) "new element added to $clonedOuterArrayObject"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_count_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_count_basic1.php
new file mode 100644
index 000000000..60f40c0a9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_count_basic1.php
@@ -0,0 +1,56 @@
+==ArrayObject==
+count(), $ao->count());
+
+//Extra args are ignored.
+var_dump($ao->count('blah'));
+?>
+==ArrayIterator==
+count(), $ao->count());
+
+//Extra args are ignored.
+var_dump($ao->count('blah'));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_count_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_count_basic1.php.expectf
new file mode 100644
index 000000000..f1b0ba516
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_count_basic1.php.expectf
@@ -0,0 +1,22 @@
+==ArrayObject==
+int(99)
+int(0)
+int(99)
+int(1)
+int(99)
+int(2)
+int(99)
+int(1)
+HipHop Warning: %a
+NULL
+==ArrayIterator==
+int(99)
+int(0)
+int(99)
+int(1)
+int(99)
+int(2)
+int(99)
+int(1)
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic1.php
new file mode 100644
index 000000000..b8673b0af
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic1.php
@@ -0,0 +1,19 @@
+exchangeArray($swapIn);
+
+$ao['a'] = 'adding element to $ao';
+$swapIn['b'] = 'adding element to $swapIn';
+$ao['c'] = 'adding another element to $ao';
+
+echo "\n--> swapIn: ";
+var_dump($swapIn);
+
+echo "\n--> cowRef: ";
+var_dump($cowRef);
+
+echo "\n--> ao: ";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic1.php.expectf
new file mode 100644
index 000000000..724fdb3b2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic1.php.expectf
@@ -0,0 +1,17 @@
+--> swapIn: array(1) {
+ ["b"]=>
+ string(25) "adding element to $swapIn"
+}
+
+--> cowRef: array(0) {
+}
+
+--> ao: object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ ["a"]=>
+ string(21) "adding element to $ao"
+ ["c"]=>
+ string(29) "adding another element to $ao"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic2.php
new file mode 100644
index 000000000..e48e39f33
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic2.php
@@ -0,0 +1,32 @@
+ exchangeArray(array):\n";
+$ao = new ArrayObject();
+$ao->exchangeArray(array('key'=>'original'));
+var_dump($ao['key']);
+var_dump($ao);
+
+echo "\n--> exchangeArray(normal object):\n";
+$obj = new stdClass;
+$obj->key = 'normal object prop';
+$ao->exchangeArray($obj);
+var_dump($ao['key']);
+var_dump($ao);
+
+echo "\n--> exchangeArray(ArrayObject):\n";
+$obj = new ArrayObject(array('key'=>'ArrayObject element'));
+$ao->exchangeArray($obj);
+var_dump($ao['key']);
+var_dump($ao);
+
+echo "\n--> exchangeArray(ArrayIterator):\n";
+$obj = new ArrayIterator(array('key'=>'ArrayIterator element'));
+$ao->exchangeArray($obj);
+var_dump($ao['key']);
+var_dump($ao);
+
+echo "\n--> exchangeArray(nested ArrayObject):\n";
+$obj = new ArrayObject(new ArrayObject(array('key'=>'nested ArrayObject element')));
+$ao->exchangeArray($obj);
+var_dump($ao['key']);
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic2.php.expectf
new file mode 100644
index 000000000..81415d0c8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic2.php.expectf
@@ -0,0 +1,61 @@
+--> exchangeArray(array):
+string(8) "original"
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ ["key"]=>
+ string(8) "original"
+ }
+}
+
+--> exchangeArray(normal object):
+string(18) "normal object prop"
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ object(stdClass)#%d (1) {
+ ["key"]=>
+ string(18) "normal object prop"
+ }
+}
+
+--> exchangeArray(ArrayObject):
+string(19) "ArrayObject element"
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ ["key"]=>
+ string(19) "ArrayObject element"
+ }
+ }
+}
+
+--> exchangeArray(ArrayIterator):
+string(21) "ArrayIterator element"
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(1) {
+ ["key"]=>
+ string(21) "ArrayIterator element"
+ }
+ }
+}
+
+--> exchangeArray(nested ArrayObject):
+string(26) "nested ArrayObject element"
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ ["key"]=>
+ string(26) "nested ArrayObject element"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic3.php b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic3.php
new file mode 100644
index 000000000..f37d31d97
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic3.php
@@ -0,0 +1,48 @@
+ exchangeArray() with objects:\n";
+$original = new C;
+$ao = new ArrayObject($original);
+$swapIn = new C;
+try {
+ $copy = $ao->exchangeArray($swapIn);
+ $copy['addedToCopy'] = 'added To Copy';
+} catch (Exception $e) {
+ echo "Exception:" . $e->getMessage() . "\n";
+}
+$swapIn->addedToSwapIn = 'added To Swap-In';
+$original->addedToOriginal = 'added To Original';
+var_dump($ao, $original, $swapIn, $copy);
+
+
+echo "\n\n--> exchangeArray() with no arg:\n";
+unset($original, $ao, $swapIn, $copy);
+$original = new C;
+$ao = new ArrayObject($original);
+try {
+ $copy = $ao->exchangeArray();
+ $copy['addedToCopy'] = 'added To Copy';
+} catch (Exception $e) {
+ echo "Exception:" . $e->getMessage() . "\n";
+}
+$original->addedToOriginal = 'added To Original';
+var_dump($ao, $original, $copy);
+
+echo "\n\n--> exchangeArray() with bad arg type:\n";
+unset($original, $ao, $swapIn, $copy);
+$original = new C;
+$ao = new ArrayObject($original);
+try {
+ $copy = $ao->exchangeArray(null);
+ $copy['addedToCopy'] = 'added To Copy';
+} catch (Exception $e) {
+ echo "Exception:" . $e->getMessage() . "\n";
+}
+$original->addedToOriginal = 'added To Original';
+var_dump($ao, $original, $copy);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic3.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic3.php.expectf
new file mode 100644
index 000000000..c90fabb95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_exchangeArray_basic3.php.expectf
@@ -0,0 +1,74 @@
+--> exchangeArray() with objects:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#3 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToSwapIn"]=>
+ string(16) "added To Swap-In"
+ }
+}
+object(C)#1 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToOriginal"]=>
+ string(17) "added To Original"
+}
+object(C)#3 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToSwapIn"]=>
+ string(16) "added To Swap-In"
+}
+array(2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToCopy"]=>
+ string(13) "added To Copy"
+}
+
+
+--> exchangeArray() with no arg:
+HipHop Warning: %a
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#3 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToOriginal"]=>
+ string(17) "added To Original"
+ }
+}
+object(C)#3 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToOriginal"]=>
+ string(17) "added To Original"
+}
+array(2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToCopy"]=>
+ string(13) "added To Copy"
+}
+
+
+--> exchangeArray() with bad arg type:
+Exception:Passed variable is not an array or object, using empty array instead
+HipHop Notice: %a
+object(ArrayObject)#3 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#2 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToOriginal"]=>
+ string(17) "added To Original"
+ }
+}
+object(C)#2 (2) {
+ ["pub1"]=>
+ string(7) "public1"
+ ["addedToOriginal"]=>
+ string(17) "added To Original"
+}
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic1.php
new file mode 100644
index 000000000..41444474e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic1.php
@@ -0,0 +1,16 @@
+getFlags());
+
+$ao = new ArrayObject(new ArrayObject(array(1,2,3)), ArrayObject::STD_PROP_LIST);
+var_dump($ao->getFlags());
+
+$ao = new ArrayObject(new ArrayIterator(new ArrayObject()), ArrayObject::ARRAY_AS_PROPS);
+var_dump($ao->getFlags());
+
+$ao = new ArrayObject(new ArrayObject(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
+var_dump($ao->getFlags());
+
+$cao = clone $ao;
+var_dump($cao->getFlags());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic1.php.expectf
new file mode 100644
index 000000000..994cae5f8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic1.php.expectf
@@ -0,0 +1,5 @@
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic2.php
new file mode 100644
index 000000000..8cb48827d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic2.php
@@ -0,0 +1,15 @@
+getFlags());
+
+$ao2 = new ArrayObject($ao);
+var_dump($ao2->getFlags());
+var_dump($ao2->getIterator()->getFlags());
+
+$ai = new ArrayIterator($ao);
+var_dump($ai->getFlags());
+
+$ao2 = new ArrayObject($ao, 0);
+var_dump($ao2->getFlags());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic2.php.expectf
new file mode 100644
index 000000000..fac55ab73
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_getFlags_basic2.php.expectf
@@ -0,0 +1,5 @@
+int(3)
+int(3)
+int(3)
+int(3)
+int(0)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_getIteratorClass_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_getIteratorClass_basic1.php
new file mode 100644
index 000000000..9d4c809d4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_getIteratorClass_basic1.php
@@ -0,0 +1,57 @@
+1,'b'=>2,'c'=>3), 0, "MyIterator");
+
+echo "--> Access using MyIterator:\n";
+var_dump($ao->getIteratorClass());
+var_dump($ao->getIterator());
+foreach($ao as $key=>$value) {
+ echo " $key=>$value\n";
+}
+
+echo "\n\n--> Access using ArrayIterator:\n";
+var_dump($ao->setIteratorClass("ArrayIterator"));
+var_dump($ao->getIteratorClass());
+var_dump($ao->getIterator());
+foreach($ao as $key=>$value) {
+ echo "$key=>$value\n";
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_getIteratorClass_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_getIteratorClass_basic1.php.expectf
new file mode 100644
index 000000000..5e81b6ad1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_getIteratorClass_basic1.php.expectf
@@ -0,0 +1,55 @@
+--> Access using MyIterator:
+string(10) "MyIterator"
+object(MyIterator)#2 (1) {
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ }
+ }
+}
+ In MyIterator::rewind()
+ In MyIterator::valid()
+ In MyIterator::current()
+ In MyIterator::key()
+ a=>1
+ In MyIterator::next()
+ In MyIterator::valid()
+ In MyIterator::current()
+ In MyIterator::key()
+ b=>2
+ In MyIterator::next()
+ In MyIterator::valid()
+ In MyIterator::current()
+ In MyIterator::key()
+ c=>3
+ In MyIterator::next()
+ In MyIterator::valid()
+
+
+--> Access using ArrayIterator:
+NULL
+string(13) "ArrayIterator"
+object(ArrayIterator)#3 (1) {
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ }
+ }
+}
+a=>1
+b=>2
+c=>3
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic1.php
new file mode 100644
index 000000000..abced1e5f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic1.php
@@ -0,0 +1,19 @@
+4,'a'=>2,'q'=>3, 99=>'x'));
+var_dump($ao1->ksort());
+var_dump($ao1);
+var_dump($ao2->ksort('blah'));
+var_dump($ao2);
+var_dump($ao2->ksort(SORT_STRING));
+var_dump($ao2);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic1.php.expectf
new file mode 100644
index 000000000..f2ee73862
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic1.php.expectf
@@ -0,0 +1,43 @@
+*** Testing ArrayObject::ksort() : basic functionality ***
+bool(true)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+HipHop Warning: %a
+bool(false)
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(4) {
+ ["b"]=>
+ int(4)
+ ["a"]=>
+ int(2)
+ ["q"]=>
+ int(3)
+ [99]=>
+ string(1) "x"
+ }
+}
+bool(true)
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(4) {
+ [99]=>
+ string(1) "x"
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ int(4)
+ ["q"]=>
+ int(3)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic2.php
new file mode 100644
index 000000000..8bf281bf6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic2.php
@@ -0,0 +1,22 @@
+ksort());
+var_dump($ao1, $c);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic2.php.expectf
new file mode 100644
index 000000000..5e0ebda57
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_ksort_basic2.php.expectf
@@ -0,0 +1,26 @@
+*** Testing ArrayObject::ksort() : basic functionality ***
+bool(true)
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (4) {
+ ["b":"C":private]=>
+ string(5) "prop4"
+ ["a"]=>
+ string(5) "prop3"
+ ["x"]=>
+ string(5) "prop1"
+ ["z"]=>
+ string(5) "prop2"
+ }
+}
+object(C)#1 (4) {
+ ["b":"C":private]=>
+ string(5) "prop4"
+ ["a"]=>
+ string(5) "prop3"
+ ["x"]=>
+ string(5) "prop1"
+ ["z"]=>
+ string(5) "prop2"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods1.php b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods1.php
new file mode 100644
index 000000000..93a79452b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods1.php
@@ -0,0 +1,66 @@
+ Write existent, non-existent and dynamic:\n";
+$ao['a'] = 'changed';
+$ao['dynamic'] = 'new';
+$ao['dynamic'] = 'new.changed';
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Read existent, non-existent and dynamic:\n";
+var_dump($ao['a']);
+var_dump($ao['nonexistent']);
+var_dump($ao['dynamic']);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> isset existent, non-existent and dynamic:\n";
+var_dump(isset($ao['a']));
+var_dump(isset($ao['nonexistent']));
+var_dump(isset($ao['dynamic']));
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Unset existent, non-existent and dynamic:\n";
+unset($ao['a']);
+unset($ao['nonexistent']);
+unset($ao['dynamic']);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods1.php.expectf
new file mode 100644
index 000000000..97d7e9a85
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods1.php.expectf
@@ -0,0 +1,123 @@
+--> Write existent, non-existent and dynamic:
+ Original wrapped object:
+object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Read existent, non-existent and dynamic:
+string(7) "changed"
+HipHop Notice: %a
+NULL
+string(11) "new.changed"
+ Original wrapped object:
+object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> isset existent, non-existent and dynamic:
+bool(true)
+bool(false)
+bool(true)
+ Original wrapped object:
+object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Unset existent, non-existent and dynamic:
+HipHop Notice: %a
+ Original wrapped object:
+object(UsesMagic)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods2.php b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods2.php
new file mode 100644
index 000000000..c034fb779
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods2.php
@@ -0,0 +1,66 @@
+ Write existent, non-existent and dynamic:\n";
+$ao->a = 'changed';
+$ao->dynamic = 'new';
+$ao->dynamic = 'new.changed';
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Read existent, non-existent and dynamic:\n";
+var_dump($ao->a);
+var_dump($ao->nonexistent);
+var_dump($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> isset existent, non-existent and dynamic:\n";
+var_dump(isset($ao->a));
+var_dump(isset($ao->nonexistent));
+var_dump(isset($ao->dynamic));
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Unset existent, non-existent and dynamic:\n";
+unset($ao->a);
+unset($ao->nonexistent);
+unset($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods2.php.expectf
new file mode 100644
index 000000000..6adc8eda9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods2.php.expectf
@@ -0,0 +1,126 @@
+--> Write existent, non-existent and dynamic:
+ Original wrapped object:
+object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (3) {
+ ["a"]=>
+ string(7) "changed"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ }
+}
+
+--> Read existent, non-existent and dynamic:
+string(7) "changed"
+HipHop Notice: %a
+NULL
+string(11) "new.changed"
+ Original wrapped object:
+object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (3) {
+ ["a"]=>
+ string(7) "changed"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ }
+}
+
+--> isset existent, non-existent and dynamic:
+bool(true)
+bool(false)
+bool(true)
+ Original wrapped object:
+object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (3) {
+ ["a"]=>
+ string(7) "changed"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ }
+}
+
+--> Unset existent, non-existent and dynamic:
+ Original wrapped object:
+object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods3.php b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods3.php
new file mode 100644
index 000000000..151cdd4d4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods3.php
@@ -0,0 +1,66 @@
+ Write existent, non-existent and dynamic:\n";
+$ao->a = 'changed';
+$ao->dynamic = 'new';
+$ao->dynamic = 'new.changed';
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Read existent, non-existent and dynamic:\n";
+var_dump($ao->a);
+var_dump($ao->nonexistent);
+var_dump($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> isset existent, non-existent and dynamic:\n";
+var_dump(isset($ao->a));
+var_dump(isset($ao->nonexistent));
+var_dump(isset($ao->dynamic));
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Unset existent, non-existent and dynamic:\n";
+unset($ao->a);
+unset($ao->nonexistent);
+unset($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods3.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods3.php.expectf
new file mode 100644
index 000000000..97d7e9a85
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods3.php.expectf
@@ -0,0 +1,123 @@
+--> Write existent, non-existent and dynamic:
+ Original wrapped object:
+object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Read existent, non-existent and dynamic:
+string(7) "changed"
+HipHop Notice: %a
+NULL
+string(11) "new.changed"
+ Original wrapped object:
+object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> isset existent, non-existent and dynamic:
+bool(true)
+bool(false)
+bool(true)
+ Original wrapped object:
+object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Unset existent, non-existent and dynamic:
+HipHop Notice: %a
+ Original wrapped object:
+object(UsesMagic)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ object(UsesMagic)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"UsesMagic":private]=>
+ string(6) "secret"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods4.php b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods4.php
new file mode 100644
index 000000000..f27cf5c4e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods4.php
@@ -0,0 +1,69 @@
+ Write existent, non-existent and dynamic:\n";
+$ao['a'] = 'changed';
+$ao['dynamic'] = 'new';
+$ao['dynamic'] = 'new.changed';
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Read existent, non-existent and dynamic:\n";
+var_dump($ao['a']);
+var_dump($ao['nonexistent']);
+var_dump($ao['dynamic']);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> isset existent, non-existent and dynamic:\n";
+var_dump(isset($ao['a']));
+var_dump(isset($ao['nonexistent']));
+var_dump(isset($ao['dynamic']));
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Unset existent, non-existent and dynamic:\n";
+unset($ao['a']);
+unset($ao['nonexistent']);
+unset($ao['dynamic']);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods4.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods4.php.expectf
new file mode 100644
index 000000000..6f8018720
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods4.php.expectf
@@ -0,0 +1,131 @@
+--> Write existent, non-existent and dynamic:
+ Original wrapped object:
+object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(33) "This should not be in the storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Read existent, non-existent and dynamic:
+string(7) "changed"
+HipHop Notice: %a
+NULL
+string(11) "new.changed"
+ Original wrapped object:
+object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(33) "This should not be in the storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> isset existent, non-existent and dynamic:
+bool(true)
+bool(false)
+bool(true)
+ Original wrapped object:
+object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(33) "This should not be in the storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Unset existent, non-existent and dynamic:
+HipHop Notice: %a
+ Original wrapped object:
+object(C)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(33) "This should not be in the storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods5.php b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods5.php
new file mode 100644
index 000000000..bd407a5c0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods5.php
@@ -0,0 +1,69 @@
+ Write existent, non-existent and dynamic:\n";
+$ao->a = 'changed';
+$ao->dynamic = 'new';
+$ao->dynamic = 'new.changed';
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Read existent, non-existent and dynamic:\n";
+var_dump($ao->a);
+var_dump($ao->nonexistent);
+var_dump($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> isset existent, non-existent and dynamic:\n";
+var_dump(isset($ao->a));
+var_dump(isset($ao->nonexistent));
+var_dump(isset($ao->dynamic));
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Unset existent, non-existent and dynamic:\n";
+unset($ao->a);
+unset($ao->nonexistent);
+unset($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods5.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods5.php.expectf
new file mode 100644
index 000000000..1d359ce9e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods5.php.expectf
@@ -0,0 +1,133 @@
+--> Write existent, non-existent and dynamic:
+In UsesMagic::__set(a,changed)
+In UsesMagic::__set(dynamic,new)
+In UsesMagic::__set(dynamic,new.changed)
+ Original wrapped object:
+object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(29) "This should appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ }
+}
+
+--> Read existent, non-existent and dynamic:
+In UsesMagic::__get(a)
+NULL
+In UsesMagic::__get(nonexistent)
+NULL
+In UsesMagic::__get(dynamic)
+NULL
+ Original wrapped object:
+object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(29) "This should appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ }
+}
+
+--> isset existent, non-existent and dynamic:
+In UsesMagic::__isset(a)
+bool(false)
+In UsesMagic::__isset(nonexistent)
+bool(false)
+In UsesMagic::__isset(dynamic)
+bool(false)
+ Original wrapped object:
+object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(29) "This should appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ }
+}
+
+--> Unset existent, non-existent and dynamic:
+In UsesMagic::__unset(a)
+In UsesMagic::__unset(nonexistent)
+In UsesMagic::__unset(dynamic)
+ Original wrapped object:
+object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(29) "This should appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods6.php b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods6.php
new file mode 100644
index 000000000..4b0375df6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods6.php
@@ -0,0 +1,69 @@
+ Write existent, non-existent and dynamic:\n";
+$ao->a = 'changed';
+$ao->dynamic = 'new';
+$ao->dynamic = 'new.changed';
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Read existent, non-existent and dynamic:\n";
+var_dump($ao->a);
+var_dump($ao->nonexistent);
+var_dump($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> isset existent, non-existent and dynamic:\n";
+var_dump(isset($ao->a));
+var_dump(isset($ao->nonexistent));
+var_dump(isset($ao->dynamic));
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+
+echo "\n--> Unset existent, non-existent and dynamic:\n";
+unset($ao->a);
+unset($ao->nonexistent);
+unset($ao->dynamic);
+echo " Original wrapped object:\n";
+var_dump($obj);
+echo " Wrapping ArrayObject:\n";
+var_dump($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods6.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods6.php.expectf
new file mode 100644
index 000000000..fb25258ba
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_magicMethods6.php.expectf
@@ -0,0 +1,131 @@
+--> Write existent, non-existent and dynamic:
+ Original wrapped object:
+object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(35) "This should never appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Read existent, non-existent and dynamic:
+string(7) "changed"
+HipHop Notice: %a
+NULL
+string(11) "new.changed"
+ Original wrapped object:
+object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(35) "This should never appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> isset existent, non-existent and dynamic:
+bool(true)
+bool(false)
+bool(true)
+ Original wrapped object:
+object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(35) "This should never appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (5) {
+ ["a"]=>
+ string(7) "changed"
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ ["dynamic"]=>
+ string(11) "new.changed"
+ }
+}
+
+--> Unset existent, non-existent and dynamic:
+HipHop Notice: %a
+ Original wrapped object:
+object(C)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+}
+ Wrapping ArrayObject:
+object(UsesMagic)#2 (2) {
+ ["b"]=>
+ string(35) "This should never appear in storage"
+ ["storage":"ArrayObject":private]=>
+ object(C)#1 (3) {
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ ["priv":"C":private]=>
+ string(6) "secret"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_natcasesort_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_natcasesort_basic1.php
new file mode 100644
index 000000000..774f24666
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_natcasesort_basic1.php
@@ -0,0 +1,18 @@
+'boo10','b'=>'boo1','c'=>'boo2','d'=>'boo22','e'=>'BOO5'));
+var_dump($ao1->natcasesort());
+var_dump($ao1);
+var_dump($ao2->natcasesort('blah'));
+var_dump($ao2);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_natcasesort_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_natcasesort_basic1.php.expectf
new file mode 100644
index 000000000..70d69d94c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_natcasesort_basic1.php.expectf
@@ -0,0 +1,34 @@
+*** Testing ArrayObject::natcasesort() : basic functionality ***
+bool(true)
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ [1]=>
+ string(4) "boo1"
+ [2]=>
+ string(4) "boo2"
+ [4]=>
+ string(4) "BOO5"
+ [0]=>
+ string(5) "boo10"
+ [3]=>
+ string(5) "boo22"
+ }
+}
+bool(true)
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ ["b"]=>
+ string(4) "boo1"
+ ["c"]=>
+ string(4) "boo2"
+ ["e"]=>
+ string(4) "BOO5"
+ ["a"]=>
+ string(5) "boo10"
+ ["d"]=>
+ string(5) "boo22"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_natsort_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_natsort_basic1.php
new file mode 100644
index 000000000..2cd981af6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_natsort_basic1.php
@@ -0,0 +1,18 @@
+'boo10','b'=>'boo1','c'=>'boo2','d'=>'boo22','e'=>'BOO5'));
+var_dump($ao1->natsort());
+var_dump($ao1);
+var_dump($ao2->natsort('blah'));
+var_dump($ao2);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_natsort_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_natsort_basic1.php.expectf
new file mode 100644
index 000000000..6c6a15212
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_natsort_basic1.php.expectf
@@ -0,0 +1,34 @@
+*** Testing ArrayObject::natsort() : basic functionality ***
+bool(true)
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ [4]=>
+ string(4) "BOO5"
+ [1]=>
+ string(4) "boo1"
+ [2]=>
+ string(4) "boo2"
+ [0]=>
+ string(5) "boo10"
+ [3]=>
+ string(5) "boo22"
+ }
+}
+bool(true)
+object(ArrayObject)#2 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ ["e"]=>
+ string(4) "BOO5"
+ ["b"]=>
+ string(4) "boo1"
+ ["c"]=>
+ string(4) "boo2"
+ ["a"]=>
+ string(5) "boo10"
+ ["d"]=>
+ string(5) "boo22"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_offsetExists_nullcheck.php b/hphp/test/zend/bad/ext-spl/arrayObject_offsetExists_nullcheck.php
new file mode 100644
index 000000000..ff15dfdef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_offsetExists_nullcheck.php
@@ -0,0 +1,5 @@
+ null));
+var_dump($ao->offsetExists('foo'));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_offsetExists_nullcheck.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_offsetExists_nullcheck.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_offsetExists_nullcheck.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic1.php
new file mode 100644
index 000000000..77718b2f6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic1.php
@@ -0,0 +1,29 @@
+p));
+ // read
+ var_dump($ao->p);
+ // write
+ $ao->p = $ao->p . '.changed';
+ var_dump($ao->p);
+}
+
+$ao = new C(array('p'=>'array element'));
+$ao->setFlags(ArrayObject::ARRAY_AS_PROPS);
+
+echo "\n--> Access the real property:\n";
+access_p($ao);
+
+echo "\n--> Remove the real property and access the array element:\n";
+unset($ao->p);
+access_p($ao);
+
+echo "\n--> Remove the array element and try access again:\n";
+unset($ao->p);
+access_p($ao);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic1.php.expectf
new file mode 100644
index 000000000..e89c45089
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic1.php.expectf
@@ -0,0 +1,16 @@
+--> Access the real property:
+bool(true)
+string(15) "object property"
+string(23) "object property.changed"
+
+--> Remove the real property and access the array element:
+bool(true)
+string(13) "array element"
+string(21) "array element.changed"
+
+--> Remove the array element and try access again:
+bool(false)
+HipHop Notice: %a
+NULL
+HipHop Notice: %a
+string(8) ".changed"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic2.php b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic2.php
new file mode 100644
index 000000000..9dbae3e52
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic2.php
@@ -0,0 +1,20 @@
+x);
+ }
+}
+
+$c = new C(array('x'=>'public'));
+
+$c->setFlags(ArrayObject::ARRAY_AS_PROPS);
+C::go($c);
+var_dump($c->x);
+
+
+$c->setFlags(0);
+C::go($c);
+var_dump($c->x);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic2.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic2.php.expectf
new file mode 100644
index 000000000..0b013e601
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_setFlags_basic2.php.expectf
@@ -0,0 +1,4 @@
+string(6) "secret"
+string(6) "public"
+string(6) "secret"
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_setIteratorClass_error1.php b/hphp/test/zend/bad/ext-spl/arrayObject_setIteratorClass_error1.php
new file mode 100644
index 000000000..4e9d46abc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_setIteratorClass_error1.php
@@ -0,0 +1,41 @@
+1,'b'=>2,'c'=>3));
+ $ao->setIteratorClass("nonExistentClass");
+ foreach($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3));
+ $ao->setIteratorClass("stdClass");
+ foreach($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+
+try {
+ $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "nonExistentClass");
+ foreach($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "stdClass");
+ foreach($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_setIteratorClass_error1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_setIteratorClass_error1.php.expectf
new file mode 100644
index 000000000..6fbaea318
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_setIteratorClass_error1.php.expectf
@@ -0,0 +1,10 @@
+HipHop Warning: %a
+ a=>1
+ b=>2
+ c=>3
+HipHop Warning: %a
+ a=>1
+ b=>2
+ c=>3
+string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given"
+string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uasort_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_basic1.php
new file mode 100644
index 000000000..82b2edd77
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_basic1.php
@@ -0,0 +1,27 @@
+uasort('cmp');
+var_dump($ao);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uasort_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_basic1.php.expectf
new file mode 100644
index 000000000..02eb5f879
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_basic1.php.expectf
@@ -0,0 +1,13 @@
+*** Testing ArrayObject::uasort() : basic functionality ***
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [1]=>
+ int(3)
+ [0]=>
+ int(2)
+ [2]=>
+ int(1)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uasort_error1.php b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_error1.php
new file mode 100644
index 000000000..985d5c065
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_error1.php
@@ -0,0 +1,23 @@
+uasort();
+} catch (BadMethodCallException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $ao->uasort(1,2);
+} catch (BadMethodCallException $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uasort_error1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_error1.php.expectf
new file mode 100644
index 000000000..c6b50217b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uasort_error1.php.expectf
@@ -0,0 +1,3 @@
+Function expects exactly one argument
+Function expects exactly one argument
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uksort_basic1.php b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_basic1.php
new file mode 100644
index 000000000..5ea68860d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_basic1.php
@@ -0,0 +1,26 @@
+0, 2=>1, 5=>2, 6=>3, 1=>4));
+
+$ao->uksort('cmp');
+var_dump($ao);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uksort_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_basic1.php.expectf
new file mode 100644
index 000000000..2162c9c20
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_basic1.php.expectf
@@ -0,0 +1,17 @@
+*** Testing ArrayObject::uksort() : basic functionality ***
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ [6]=>
+ int(3)
+ [5]=>
+ int(2)
+ [3]=>
+ int(0)
+ [2]=>
+ int(1)
+ [1]=>
+ int(4)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uksort_error1.php b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_error1.php
new file mode 100644
index 000000000..4e46b6b1d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_error1.php
@@ -0,0 +1,23 @@
+uksort();
+} catch (BadMethodCallException $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $ao->uksort(1,2);
+} catch (BadMethodCallException $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/arrayObject_uksort_error1.php.expectf b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_error1.php.expectf
new file mode 100644
index 000000000..c6b50217b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/arrayObject_uksort_error1.php.expectf
@@ -0,0 +1,3 @@
+Function expects exactly one argument
+Function expects exactly one argument
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_001.php b/hphp/test/zend/bad/ext-spl/array_001.php
new file mode 100644
index 000000000..ceffba01d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_001.php
@@ -0,0 +1,34 @@
+0, 1=>1);
+$ar = new ArrayObject($ar);
+
+var_dump($ar);
+
+$ar[2] = 2;
+var_dump($ar[2]);
+var_dump($ar["3"] = 3);
+
+var_dump(array_merge((array)$ar, array(4=>4, 5=>5)));
+
+var_dump($ar["a"] = "a");
+
+var_dump($ar);
+var_dump($ar[0]);
+var_dump($ar[6]);
+var_dump($ar["b"]);
+
+unset($ar[1]);
+unset($ar["3"]);
+unset($ar["a"]);
+unset($ar[7]);
+unset($ar["c"]);
+var_dump($ar);
+
+$ar[] = '3';
+$ar[] = 4;
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_001.php.expectf b/hphp/test/zend/bad/ext-spl/array_001.php.expectf
new file mode 100644
index 000000000..cad7e7205
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_001.php.expectf
@@ -0,0 +1,71 @@
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ }
+}
+int(2)
+int(3)
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+string(1) "a"
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ ["a"]=>
+ string(1) "a"
+ }
+}
+int(0)
+HipHop Notice: %a
+NULL
+HipHop Notice: %a
+NULL
+HipHop Notice: %a
+HipHop Notice: %a
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ [0]=>
+ int(0)
+ [2]=>
+ int(2)
+ }
+}
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(4) {
+ [0]=>
+ int(0)
+ [2]=>
+ int(2)
+ [4]=>
+ string(1) "3"
+ [5]=>
+ int(4)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_002.php b/hphp/test/zend/bad/ext-spl/array_002.php
new file mode 100644
index 000000000..9092ba5d6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_002.php
@@ -0,0 +1,18 @@
+ 'one',
+ '2' => 'two',
+ '3' => 'three');
+
+$object = new ArrayObject($array);
+$object[] = 'four';
+
+$arrayObject = new ArrayObject($object);
+
+$arrayObject[] = 'five';
+
+var_dump($arrayObject);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_002.php.expectf b/hphp/test/zend/bad/ext-spl/array_002.php.expectf
new file mode 100644
index 000000000..281ccf3c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_002.php.expectf
@@ -0,0 +1,19 @@
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(5) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_003.php b/hphp/test/zend/bad/ext-spl/array_003.php
new file mode 100644
index 000000000..162fa5f8d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_003.php
@@ -0,0 +1,35 @@
+imp = "implicit";
+ }
+};
+
+$test = new test;
+$test->dyn = "dynamic";
+
+print_r($test);
+
+$object = new ArrayObject($test);
+
+print_r($object);
+
+foreach($test as $key => $val)
+{
+ echo "$key => $val\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_003.php.expectf b/hphp/test/zend/bad/ext-spl/array_003.php.expectf
new file mode 100644
index 000000000..c2cf0e5d7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_003.php.expectf
@@ -0,0 +1,24 @@
+test Object
+(
+ [pub] => public
+ [pro:protected] => protected
+ [pri:test:private] => private
+ [imp] => implicit
+ [dyn] => dynamic
+)
+ArrayObject Object
+(
+ [storage:ArrayObject:private] => test Object
+ (
+ [pub] => public
+ [pro:protected] => protected
+ [pri:test:private] => private
+ [imp] => implicit
+ [dyn] => dynamic
+ )
+
+)
+pub => public
+imp => implicit
+dyn => dynamic
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_004.php b/hphp/test/zend/bad/ext-spl/array_004.php
new file mode 100644
index 000000000..246621a16
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_004.php
@@ -0,0 +1,16 @@
+0, 1=>1, 2=>2);
+$obj = new ArrayObject($arr);
+
+foreach($obj as $ak=>$av) {
+ foreach($obj as $bk=>$bv) {
+ if ($ak==0 && $bk==0) {
+ $arr[0] = "modify";
+ }
+ echo "$ak=>$av - $bk=>$bv\n";
+ }
+}
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_004.php.expectf b/hphp/test/zend/bad/ext-spl/array_004.php.expectf
new file mode 100644
index 000000000..50d758613
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_004.php.expectf
@@ -0,0 +1,10 @@
+0=>0 - 0=>0
+0=>0 - 1=>1
+0=>0 - 2=>2
+1=>1 - 0=>0
+1=>1 - 1=>1
+1=>1 - 2=>2
+2=>2 - 0=>0
+2=>2 - 1=>1
+2=>2 - 2=>2
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_005.php b/hphp/test/zend/bad/ext-spl/array_005.php
new file mode 100644
index 000000000..f50403e82
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_005.php
@@ -0,0 +1,84 @@
+id = $id;
+ $this->name = $name;
+ }
+
+ public function __toString()
+ {
+ return $this->id . ', ' . $this->name;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+}
+
+class StudentIdFilter extends FilterIterator
+{
+ private $id;
+
+ public function __construct(ArrayObject $students, Student $other)
+ {
+ FilterIterator::__construct($students->getIterator());
+ $this->id = $other->getId();
+ }
+
+ public function accept()
+ {
+ echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
+ return $this->current()->getId() == $this->id;
+ }
+}
+
+class StudentList implements IteratorAggregate
+{
+ private $students;
+
+ public function __construct()
+ {
+ $this->students = new ArrayObject(array());
+ }
+
+ public function add(Student $student)
+ {
+ if (!$this->contains($student)) {
+ $this->students[] = $student;
+ }
+ }
+
+ public function contains(Student $student)
+ {
+ foreach ($this->students as $s)
+ {
+ if ($s->getId() == $student->getId()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function getIterator() {
+ return $this->students->getIterator();
+ }
+}
+
+$students = new StudentList();
+$students->add(new Student('01234123', 'Joe'));
+$students->add(new Student('00000014', 'Bob'));
+$students->add(new Student('00000014', 'Foo'));
+
+foreach ($students as $student) {
+ echo $student, "\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_005.php.expectf b/hphp/test/zend/bad/ext-spl/array_005.php.expectf
new file mode 100644
index 000000000..9e96d9db5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_005.php.expectf
@@ -0,0 +1,3 @@
+01234123, Joe
+00000014, Bob
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_007.php b/hphp/test/zend/bad/ext-spl/array_007.php
new file mode 100644
index 000000000..dd9735eac
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_007.php
@@ -0,0 +1,39 @@
+imp = "implicit";
+ }
+
+ function getIterator()
+ {
+ $it = new ArrayObject($this);
+ return $it->getIterator();
+ }
+};
+
+$test = new test;
+$test->dyn = "dynamic";
+
+print_r($test);
+
+print_r($test->getIterator());
+
+foreach($test as $key => $val)
+{
+ echo "$key => $val\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_007.php.expectf b/hphp/test/zend/bad/ext-spl/array_007.php.expectf
new file mode 100644
index 000000000..b02483fdd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_007.php.expectf
@@ -0,0 +1,28 @@
+test Object
+(
+ [pub] => public
+ [pro:protected] => protected
+ [pri:test:private] => private
+ [imp] => implicit
+ [dyn] => dynamic
+)
+ArrayIterator Object
+(
+ [storage:ArrayIterator:private] => ArrayObject Object
+ (
+ [storage:ArrayObject:private] => test Object
+ (
+ [pub] => public
+ [pro:protected] => protected
+ [pri:test:private] => private
+ [imp] => implicit
+ [dyn] => dynamic
+ )
+
+ )
+
+)
+pub => public
+imp => implicit
+dyn => dynamic
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_008.php b/hphp/test/zend/bad/ext-spl/array_008.php
new file mode 100644
index 000000000..c05c11eca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_008.php
@@ -0,0 +1,17 @@
+0, 1=>1, 2=>2);
+$obj = new ArrayObject($arr);
+
+foreach($obj as $ak=>&$av) {
+ foreach($obj as $bk=>&$bv) {
+ if ($ak==0 && $bk==0) {
+ $bv = "modify";
+ }
+ echo "$ak=>$av - $bk=>$bv\n";
+ }
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_008.php.expectf b/hphp/test/zend/bad/ext-spl/array_008.php.expectf
new file mode 100644
index 000000000..3ca4091c6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_008.php.expectf
@@ -0,0 +1,10 @@
+0=>modify - 0=>modify
+0=>modify - 1=>1
+0=>modify - 2=>2
+1=>1 - 0=>modify
+1=>1 - 1=>1
+1=>1 - 2=>2
+2=>2 - 0=>modify
+2=>2 - 1=>1
+2=>2 - 2=>2
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_009.php b/hphp/test/zend/bad/ext-spl/array_009.php
new file mode 100644
index 000000000..3ccde4c67
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_009.php
@@ -0,0 +1,13 @@
+ array(21, 22 => array(221, 222), 23 => array(231)), 3);
+
+$dir = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY);
+
+foreach ($dir as $file) {
+ print "$file\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_009.php.expectf b/hphp/test/zend/bad/ext-spl/array_009.php.expectf
new file mode 100644
index 000000000..a844ea643
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_009.php.expectf
@@ -0,0 +1,7 @@
+1
+21
+221
+222
+231
+3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_009a.php b/hphp/test/zend/bad/ext-spl/array_009a.php
new file mode 100644
index 000000000..c13501c3c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_009a.php
@@ -0,0 +1,26 @@
+current());
+ }
+
+ function getChildren()
+ {
+ return new MyRecursiveArrayIterator($this->current());
+ }
+}
+
+$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
+
+$dir = new RecursiveIteratorIterator(new MyRecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY);
+
+foreach ($dir as $file) {
+ print "$file\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_009a.php.expectf b/hphp/test/zend/bad/ext-spl/array_009a.php.expectf
new file mode 100644
index 000000000..a844ea643
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_009a.php.expectf
@@ -0,0 +1,7 @@
+1
+21
+221
+222
+231
+3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_010.php b/hphp/test/zend/bad/ext-spl/array_010.php
new file mode 100644
index 000000000..f76fa5108
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_010.php
@@ -0,0 +1,62 @@
+'3rd', '4th'=>4));
+
+var_dump($obj->getArrayCopy());
+
+echo "===EMPTY===\n";
+var_dump(empty($obj[0]));
+var_dump(empty($obj[1]));
+var_dump(empty($obj[2]));
+var_dump(empty($obj['4th']));
+var_dump(empty($obj['5th']));
+var_dump(empty($obj[6]));
+
+echo "===isset===\n";
+var_dump(isset($obj[0]));
+var_dump(isset($obj[1]));
+var_dump(isset($obj[2]));
+var_dump(isset($obj['4th']));
+var_dump(isset($obj['5th']));
+var_dump(isset($obj[6]));
+
+echo "===offsetGet===\n";
+var_dump($obj[0]);
+var_dump($obj[1]);
+var_dump($obj[2]);
+var_dump($obj['4th']);
+var_dump($obj['5th']);
+var_dump($obj[6]);
+
+echo "===offsetSet===\n";
+echo "WRITE 1\n";
+$obj[1] = 'Changed 1';
+var_dump($obj[1]);
+echo "WRITE 2\n";
+$obj['4th'] = 'Changed 4th';
+var_dump($obj['4th']);
+echo "WRITE 3\n";
+$obj['5th'] = 'Added 5th';
+var_dump($obj['5th']);
+echo "WRITE 4\n";
+$obj[6] = 'Added 6';
+var_dump($obj[6]);
+
+var_dump($obj[0]);
+var_dump($obj[2]);
+
+$x = $obj[6] = 'changed 6';
+var_dump($obj[6]);
+var_dump($x);
+
+echo "===unset===\n";
+var_dump($obj->getArrayCopy());
+unset($obj[2]);
+unset($obj['4th']);
+unset($obj[7]);
+unset($obj['8th']);
+var_dump($obj->getArrayCopy());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_010.php.expectf b/hphp/test/zend/bad/ext-spl/array_010.php.expectf
new file mode 100644
index 000000000..bcd00c318
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_010.php.expectf
@@ -0,0 +1,74 @@
+array(4) {
+ [0]=>
+ string(3) "1st"
+ [1]=>
+ int(1)
+ [2]=>
+ string(3) "3rd"
+ ["4th"]=>
+ int(4)
+}
+===EMPTY===
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+===isset===
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+===offsetGet===
+string(3) "1st"
+int(1)
+string(3) "3rd"
+int(4)
+HipHop Notice: %a
+NULL
+HipHop Notice: %a
+NULL
+===offsetSet===
+WRITE 1
+string(9) "Changed 1"
+WRITE 2
+string(11) "Changed 4th"
+WRITE 3
+string(9) "Added 5th"
+WRITE 4
+string(7) "Added 6"
+string(3) "1st"
+string(3) "3rd"
+string(9) "changed 6"
+string(9) "changed 6"
+===unset===
+array(6) {
+ [0]=>
+ string(3) "1st"
+ [1]=>
+ string(9) "Changed 1"
+ [2]=>
+ string(3) "3rd"
+ ["4th"]=>
+ string(11) "Changed 4th"
+ ["5th"]=>
+ string(9) "Added 5th"
+ [6]=>
+ string(9) "changed 6"
+}
+HipHop Notice: %a
+HipHop Notice: %a
+array(4) {
+ [0]=>
+ string(3) "1st"
+ [1]=>
+ string(9) "Changed 1"
+ ["5th"]=>
+ string(9) "Added 5th"
+ [6]=>
+ string(9) "changed 6"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_011.php b/hphp/test/zend/bad/ext-spl/array_011.php
new file mode 100644
index 000000000..d3daf349e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_011.php
@@ -0,0 +1,12 @@
+ 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5);
+//foreach (new ArrayIterator($a) as $k => $v)
+foreach (new LimitIterator(new ArrayIterator($a), 1, 3) as $k => $v)
+{
+ var_dump(array($k, $v));
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_011.php.expectf b/hphp/test/zend/bad/ext-spl/array_011.php.expectf
new file mode 100644
index 000000000..afda9ef92
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_011.php.expectf
@@ -0,0 +1,19 @@
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(1)
+}
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ int(2)
+}
+array(2) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ int(3)
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_013.php b/hphp/test/zend/bad/ext-spl/array_013.php
new file mode 100644
index 000000000..44da383af
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_013.php
@@ -0,0 +1,61 @@
+ 'zero', 1 => 'one', 2 => 'two');
+$it = new ArrayIterator($a);
+
+foreach($it as $key => $val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Append===\n";
+
+$it->append('three');
+$it->append('four');
+
+foreach(new NoRewindIterator($it) as $key => $val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Object===\n";
+
+class test
+{
+ public $zero = 0;
+ protected $pro;
+ public $one = 1;
+ private $pri;
+ public $two = 2;
+}
+
+$o = new test;
+$it = new ArrayIterator($o);
+
+foreach($it as $key => $val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Append===\n";
+
+$it->append('three');
+$it->append('four');
+
+foreach(new NoRewindIterator($it) as $key => $val)
+{
+ echo "$key=>$val\n";
+}
+
+var_dump($o->{0}); /* doesn't wotk anyway */
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_013.php.expectf b/hphp/test/zend/bad/ext-spl/array_013.php.expectf
new file mode 100644
index 000000000..4a39189b3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_013.php.expectf
@@ -0,0 +1,14 @@
+===Array===
+0=>zero
+1=>one
+2=>two
+===Append===
+3=>three
+4=>four
+===Object===
+zero=>0
+one=>1
+two=>2
+===Append===
+
+Catchable fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %sarray_013.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_014.php b/hphp/test/zend/bad/ext-spl/array_014.php
new file mode 100644
index 000000000..b3830b163
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_014.php
@@ -0,0 +1,38 @@
+count());
+$it->seek(5);
+var_dump($it->current());
+$it->seek(4);
+var_dump($it->current());
+try
+{
+ $it->seek(-1);
+ var_dump($it->current());
+}
+catch(Exception $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+try
+{
+ $it->seek(12);
+ var_dump($it->current());
+}
+catch(Exception $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+$pos = 0;
+foreach($it as $v)
+{
+ $it->seek($pos++);
+ var_dump($v);
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_014.php.expectf b/hphp/test/zend/bad/ext-spl/array_014.php.expectf
new file mode 100644
index 000000000..94a56235d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_014.php.expectf
@@ -0,0 +1,17 @@
+int(11)
+int(5)
+int(4)
+Seek position -1 is out of range
+Seek position 12 is out of range
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_015.php b/hphp/test/zend/bad/ext-spl/array_015.php
new file mode 100644
index 000000000..66e83c5f2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_015.php
@@ -0,0 +1,39 @@
+getIterator();
+
+$ar->offsetUnset($it->key());
+$it->next();
+
+var_dump($it->current());
+var_dump($ar);
+
+foreach($it as $k => $v)
+{
+ $ar->offsetUnset($k+1);
+ echo "$k=>$v\n";
+}
+
+var_dump($ar);
+
+foreach($it as $k => $v)
+{
+ $ar->offsetUnset($k);
+ echo "$k=>$v\n";
+}
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_015.php.expectf b/hphp/test/zend/bad/ext-spl/array_015.php.expectf
new file mode 100644
index 000000000..964b8fca6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_015.php.expectf
@@ -0,0 +1,51 @@
+object(ArrayObject)#%d (1) {
+ %s"storage"%s"ArrayObject":private]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+}
+HipHop Notice: %a
+int(2)
+object(ArrayObject)#%d (1) {
+ %s"storage"%s"ArrayObject":private]=>
+ array(4) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+}
+1=>2
+3=>4
+object(ArrayObject)#%d (1) {
+ %s"storage"%s"ArrayObject":private]=>
+ array(2) {
+ [1]=>
+ int(2)
+ [3]=>
+ int(4)
+ }
+}
+1=>2
+HipHop Notice: %a
+3=>4
+HipHop Notice: %a
+object(ArrayObject)#%d (1) {
+ %s"storage"%s"ArrayObject":private]=>
+ array(0) {
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_016.php b/hphp/test/zend/bad/ext-spl/array_016.php
new file mode 100644
index 000000000..a77a498ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_016.php
@@ -0,0 +1,19 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_016.php.expectf b/hphp/test/zend/bad/ext-spl/array_016.php.expectf
new file mode 100644
index 000000000..18e888666
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_016.php.expectf
@@ -0,0 +1,9 @@
+int(0)
+int(1)
+int(2)
+int(3)
+int(0)
+int(1)
+int(2)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_017.php b/hphp/test/zend/bad/ext-spl/array_017.php
new file mode 100644
index 000000000..0a41ad8fc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_017.php
@@ -0,0 +1,129 @@
+imp2 = 4;
+ }
+
+ function dump()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump(array('Flags'=>$this->getFlags()
+ ,'OVars'=>get_object_vars($this)
+ ,'$this'=>$this));
+ }
+
+ function setFlags($flags)
+ {
+ echo __METHOD__ . "($flags)\n";
+ ArrayIterator::setFlags($flags);
+ }
+}
+
+class ArrayObjectEx extends ArrayObject
+{
+ public $pub1 = 1;
+ protected $pro1 = 2;
+ private $pri1 = 3;
+
+ function __construct($ar = array(), $flags = 0)
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct($ar, $flags);
+ $this->imp1 = 4;
+ }
+
+ function exchange()
+ {
+ echo __METHOD__ . "()\n";
+ $this->exchangeArray($this);
+ }
+
+ function dump()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump(array('Flags'=>$this->getFlags()
+ ,'OVars'=>get_object_vars($this)
+ ,'$this'=>$this));
+ }
+
+ function show()
+ {
+ echo __METHOD__ . "()\n";
+ foreach($this as $n => $v)
+ {
+ var_dump(array($n => $v));
+ }
+ }
+
+ function setFlags($flags)
+ {
+ echo __METHOD__ . "($flags)\n";
+ ArrayObject::setFlags($flags);
+ }
+
+ function getIterator()
+ {
+ echo __METHOD__ . "()\n";
+ $it = new ArrayIteratorEx($this, $this->getFlags());
+ $it->dyn2 = 5;
+ $it->dump();
+ return $it;
+ }
+}
+
+function check($obj, $flags)
+{
+ echo "===CHECK===\n";
+
+ $obj->setFlags($flags);
+ $obj->dump();
+ $obj->show();
+
+ echo "===FOREACH===\n";
+
+ $it = $obj->getIterator();
+ foreach($it as $n => $v)
+ {
+ var_dump(array($n => $v));
+ }
+
+ echo "===PROPERTY===\n";
+
+ var_dump($obj->pub1);
+ var_dump(isset($obj->a));
+ $obj->setFlags($flags | 2);
+ var_dump($obj->pub1);
+ var_dump(isset($obj->a));
+
+ var_dump($it->pub2);
+ var_dump(isset($it->pub1));
+ $it->setFlags($flags | 2);
+ var_dump($it->pub2);
+ var_dump(isset($it->pub1));
+}
+
+$obj = new ArrayObjectEx(array(0=>1,'a'=>25, 'pub1'=>42), 0);
+$obj->dyn1 = 5;
+
+check($obj, 0);
+check($obj, 1);
+
+echo "#####EXCHANGE#####\n";
+
+$obj->exchange();
+
+check($obj, 0);
+check($obj, 1);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_017.php.expectf b/hphp/test/zend/bad/ext-spl/array_017.php.expectf
new file mode 100644
index 000000000..feffa0a7e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_017.php.expectf
@@ -0,0 +1,684 @@
+ArrayObjectEx::__construct()
+===CHECK===
+ArrayObjectEx::setFlags(0)
+ArrayObjectEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(0)
+ ["OVars"]=>
+ array(2) {
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ ["$this"]=>
+ object(ArrayObjectEx)#%d (6) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ }
+}
+ArrayObjectEx::show()
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(0)
+ ["OVars"]=>
+ array(2) {
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (6) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ }
+ }
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ ["a"]=>
+ int(25)
+}
+array(1) {
+ ["pub1"]=>
+ int(42)
+}
+===FOREACH===
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(0)
+ ["OVars"]=>
+ array(2) {
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (6) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ }
+ }
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ ["a"]=>
+ int(25)
+}
+array(1) {
+ ["pub1"]=>
+ int(42)
+}
+===PROPERTY===
+int(1)
+bool(false)
+ArrayObjectEx::setFlags(2)
+int(1)
+bool(true)
+int(1)
+bool(false)
+ArrayIteratorEx::setFlags(2)
+int(1)
+bool(true)
+===CHECK===
+ArrayObjectEx::setFlags(1)
+ArrayObjectEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(1)
+ ["OVars"]=>
+ array(5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1"]=>
+ int(2)
+ ["pri1"]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayObjectEx)#%d (6) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ }
+}
+ArrayObjectEx::show()
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(1)
+ ["OVars"]=>
+ array(5) {
+ ["pub2"]=>
+ int(1)
+ ["pro2"]=>
+ int(2)
+ ["pri2"]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (6) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ }
+ }
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ ["a"]=>
+ int(25)
+}
+array(1) {
+ ["pub1"]=>
+ int(42)
+}
+===FOREACH===
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(1)
+ ["OVars"]=>
+ array(5) {
+ ["pub2"]=>
+ int(1)
+ ["pro2"]=>
+ int(2)
+ ["pri2"]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (6) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ ["a"]=>
+ int(25)
+ ["pub1"]=>
+ int(42)
+ }
+ }
+ }
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ ["a"]=>
+ int(25)
+}
+array(1) {
+ ["pub1"]=>
+ int(42)
+}
+===PROPERTY===
+int(1)
+bool(false)
+ArrayObjectEx::setFlags(3)
+int(1)
+bool(true)
+int(1)
+bool(false)
+ArrayIteratorEx::setFlags(3)
+int(1)
+bool(true)
+#####EXCHANGE#####
+ArrayObjectEx::exchange()
+===CHECK===
+ArrayObjectEx::setFlags(0)
+ArrayObjectEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(0)
+ ["OVars"]=>
+ array(5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1"]=>
+ int(2)
+ ["pri1"]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayObjectEx)#%d (5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+}
+ArrayObjectEx::show()
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(0)
+ ["OVars"]=>
+ array(4) {
+ ["pub1"]=>
+ int(1)
+ ["pro1"]=>
+ int(2)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ }
+}
+array(1) {
+ ["pub1"]=>
+ int(1)
+}
+array(1) {
+ ["imp1"]=>
+ int(4)
+}
+array(1) {
+ ["dyn1"]=>
+ int(5)
+}
+===FOREACH===
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(0)
+ ["OVars"]=>
+ array(4) {
+ ["pub1"]=>
+ int(1)
+ ["pro1"]=>
+ int(2)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ }
+}
+array(1) {
+ ["pub1"]=>
+ int(1)
+}
+array(1) {
+ ["imp1"]=>
+ int(4)
+}
+array(1) {
+ ["dyn1"]=>
+ int(5)
+}
+===PROPERTY===
+int(1)
+bool(false)
+ArrayObjectEx::setFlags(2)
+int(1)
+bool(false)
+int(1)
+bool(false)
+ArrayIteratorEx::setFlags(2)
+int(1)
+bool(true)
+===CHECK===
+ArrayObjectEx::setFlags(1)
+ArrayObjectEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(1)
+ ["OVars"]=>
+ array(5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1"]=>
+ int(2)
+ ["pri1"]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayObjectEx)#%d (5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+}
+ArrayObjectEx::show()
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(1)
+ ["OVars"]=>
+ array(5) {
+ ["pub2"]=>
+ int(1)
+ ["pro2"]=>
+ int(2)
+ ["pri2"]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ }
+}
+array(1) {
+ ["pub1"]=>
+ int(1)
+}
+array(1) {
+ ["imp1"]=>
+ int(4)
+}
+array(1) {
+ ["dyn1"]=>
+ int(5)
+}
+===FOREACH===
+ArrayObjectEx::getIterator()
+ArrayIteratorEx::__construct()
+ArrayIteratorEx::dump()
+array(3) {
+ ["Flags"]=>
+ int(1)
+ ["OVars"]=>
+ array(5) {
+ ["pub2"]=>
+ int(1)
+ ["pro2"]=>
+ int(2)
+ ["pri2"]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ }
+ ["$this"]=>
+ object(ArrayIteratorEx)#%d (6) {
+ ["pub2"]=>
+ int(1)
+ ["pro2":protected]=>
+ int(2)
+ ["pri2":"ArrayIteratorEx":private]=>
+ int(3)
+ ["imp2"]=>
+ int(4)
+ ["dyn2"]=>
+ int(5)
+ ["storage":"ArrayIterator":private]=>
+ object(ArrayObjectEx)#%d (5) {
+ ["pub1"]=>
+ int(1)
+ ["pro1":protected]=>
+ int(2)
+ ["pri1":"ArrayObjectEx":private]=>
+ int(3)
+ ["imp1"]=>
+ int(4)
+ ["dyn1"]=>
+ int(5)
+ }
+ }
+}
+array(1) {
+ ["pub1"]=>
+ int(1)
+}
+array(1) {
+ ["imp1"]=>
+ int(4)
+}
+array(1) {
+ ["dyn1"]=>
+ int(5)
+}
+===PROPERTY===
+int(1)
+bool(false)
+ArrayObjectEx::setFlags(3)
+int(1)
+bool(false)
+int(1)
+bool(false)
+ArrayIteratorEx::setFlags(3)
+int(1)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_018.php b/hphp/test/zend/bad/ext-spl/array_018.php
new file mode 100644
index 000000000..500a57009
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_018.php
@@ -0,0 +1,29 @@
+offsetSet("\0", "Foo");
+}
+catch (Exception $e)
+{
+ var_dump($e->getMessage());
+}
+
+var_dump($foo);
+
+try
+{
+ $foo = new ArrayObject();
+ $data = explode("=", "=Foo");
+ $foo->offsetSet($data[0], $data[1]);
+}
+catch (Exception $e)
+{
+ var_dump($e->getMessage());
+}
+
+var_dump($foo);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_018.php.expectf b/hphp/test/zend/bad/ext-spl/array_018.php.expectf
new file mode 100644
index 000000000..7d80a721f
Binary files /dev/null and b/hphp/test/zend/bad/ext-spl/array_018.php.expectf differ
diff --git a/hphp/test/zend/bad/ext-spl/array_019.php b/hphp/test/zend/bad/ext-spl/array_019.php
new file mode 100644
index 000000000..4cf38df75
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_019.php
@@ -0,0 +1,20 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_019.php.expectf b/hphp/test/zend/bad/ext-spl/array_019.php.expectf
new file mode 100644
index 000000000..93ecc02dd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_019.php.expectf
@@ -0,0 +1,5 @@
+int(1)
+int(2)
+int(3)
+int(4)
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_021.php b/hphp/test/zend/bad/ext-spl/array_021.php
new file mode 100644
index 000000000..a90ea3960
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_021.php
@@ -0,0 +1,24 @@
+seek('bar');
+}
+catch (Exception $e)
+{
+ echo "got exception\n";
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_021.php.expectf b/hphp/test/zend/bad/ext-spl/array_021.php.expectf
new file mode 100644
index 000000000..744e0ce96
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_021.php.expectf
@@ -0,0 +1,3 @@
+foo::seek(bar)
+got exception
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_022.php b/hphp/test/zend/bad/ext-spl/array_022.php
new file mode 100644
index 000000000..3b26f8900
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_022.php
@@ -0,0 +1,43 @@
+==ArrayObject===
+
+==ArrayIterator===
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_022.php.expectf b/hphp/test/zend/bad/ext-spl/array_022.php.expectf
new file mode 100644
index 000000000..353d12e6a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_022.php.expectf
@@ -0,0 +1,33 @@
+==ArrayObject===
+object(MyArrayObject)#%d (1) {
+ ["bar"]=>
+ string(3) "baz"
+}
+object(MyArrayObject)#%d (3) {
+ ["bar"]=>
+ string(3) "baz"
+ ["baz"]=>
+ string(3) "Foo"
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ ["bar"]=>
+ string(3) "baz"
+ }
+}
+==ArrayIterator===
+object(MyArrayIterator)#%d (1) {
+ ["bar"]=>
+ string(3) "baz"
+}
+object(MyArrayIterator)#%d (3) {
+ ["bar"]=>
+ string(3) "baz"
+ ["baz"]=>
+ string(3) "Foo"
+ ["storage":"ArrayIterator":private]=>
+ object(MyArrayIterator)#%d (1) {
+ ["bar"]=>
+ string(3) "baz"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_023.php b/hphp/test/zend/bad/ext-spl/array_023.php
new file mode 100644
index 000000000..7fb2163ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_023.php
@@ -0,0 +1,35 @@
+var);
+
+$a = unserialize(serialize($a));
+
+var_dump($a);
+var_dump($a->var);
+
+class Bla extends ArrayObject
+{
+ public $var = 'aaa';
+ protected $bar = 'bbb';
+ private $foo = 'ccc';
+}
+
+$a = new Bla();
+var_dump($a);
+var_dump($a->var);
+
+$a = unserialize(serialize($a));
+
+var_dump($a);
+var_dump($a->var);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_023.php.expectf b/hphp/test/zend/bad/ext-spl/array_023.php.expectf
new file mode 100644
index 000000000..a7f630882
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_023.php.expectf
@@ -0,0 +1,48 @@
+object(Name)#1 (4) {
+ ["var"]=>
+ string(1) "a"
+ ["bar":protected]=>
+ string(1) "b"
+ ["foo":"Name":private]=>
+ string(1) "c"
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+string(1) "a"
+object(Name)#2 (4) {
+ ["var"]=>
+ string(1) "a"
+ ["bar":protected]=>
+ string(1) "b"
+ ["foo":"Name":private]=>
+ string(1) "c"
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+string(1) "a"
+object(Bla)#1 (4) {
+ ["var"]=>
+ string(3) "aaa"
+ ["bar":protected]=>
+ string(3) "bbb"
+ ["foo":"Bla":private]=>
+ string(3) "ccc"
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+string(3) "aaa"
+object(Bla)#2 (4) {
+ ["var"]=>
+ string(3) "aaa"
+ ["bar":protected]=>
+ string(3) "bbb"
+ ["foo":"Bla":private]=>
+ string(3) "ccc"
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+string(3) "aaa"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_024.php b/hphp/test/zend/bad/ext-spl/array_024.php
new file mode 100644
index 000000000..c367d82b2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_024.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_024.php.expectf b/hphp/test/zend/bad/ext-spl/array_024.php.expectf
new file mode 100644
index 000000000..e14ca2b76
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_024.php.expectf
@@ -0,0 +1,2 @@
+int(2)
+int(-2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_025.php b/hphp/test/zend/bad/ext-spl/array_025.php
new file mode 100644
index 000000000..fb74a3901
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_025.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_025.php.expectf b/hphp/test/zend/bad/ext-spl/array_025.php.expectf
new file mode 100644
index 000000000..2b6eb9ef1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_025.php.expectf
@@ -0,0 +1,27 @@
+ArrayObject Object
+(
+ [storage:ArrayObject:private] => ArrayObject Object
+ (
+ [storage:ArrayObject:private] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ )
+
+)
+C:11:"ArrayObject":76:{x:i:0;C:11:"ArrayObject":37:{x:i:0;a:2:{i:0;i:1;i:1;i:2;};m:a:0:{}};m:a:0:{}}
+ArrayObject Object
+(
+ [storage:ArrayObject:private] => ArrayObject Object
+ (
+ [storage:ArrayObject:private] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ )
+
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_026.php b/hphp/test/zend/bad/ext-spl/array_026.php
new file mode 100644
index 000000000..e5febeb9c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_026.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_026.php.expectf b/hphp/test/zend/bad/ext-spl/array_026.php.expectf
new file mode 100644
index 000000000..9395c9902
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_026.php.expectf
@@ -0,0 +1,14 @@
+HipHop Notice: %a
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ ["d1"]=>
+ array(2) {
+ ["d2"]=>
+ string(5) "hello"
+ ["d3"]=>
+ string(5) "world"
+ }
+ }
+}
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/array_027.php b/hphp/test/zend/bad/ext-spl/array_027.php
new file mode 100644
index 000000000..2d732e7a5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/array_027.php
@@ -0,0 +1,7 @@
+
+ array(1) {
+ ["plop"]=>
+ *RECURSION*
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug28822.php b/hphp/test/zend/bad/ext-spl/bug28822.php
new file mode 100644
index 000000000..17b69c7f6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug28822.php
@@ -0,0 +1,9 @@
+offsetSet('key', 'value');
+var_dump($array->offsetExists('key'));
+var_dump($array->offsetExists('nokey'));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug28822.php.expectf b/hphp/test/zend/bad/ext-spl/bug28822.php.expectf
new file mode 100644
index 000000000..3b8a15ebb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug28822.php.expectf
@@ -0,0 +1,3 @@
+bool(true)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug31346.php b/hphp/test/zend/bad/ext-spl/bug31346.php
new file mode 100644
index 000000000..2f93778dd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug31346.php
@@ -0,0 +1,13 @@
+var1=1;
+
+$ao = new ArrayObject($obj);
+
+$i = $ao->getIterator();
+
+$ao->offsetUnset($i->key());
+$i->next();
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug31346.php.expectf b/hphp/test/zend/bad/ext-spl/bug31346.php.expectf
new file mode 100644
index 000000000..5bd1c8ac4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug31346.php.expectf
@@ -0,0 +1,2 @@
+HipHop Notice: %a
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug31348.php b/hphp/test/zend/bad/ext-spl/bug31348.php
new file mode 100644
index 000000000..6cd637d0d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug31348.php
@@ -0,0 +1,10 @@
+rewind();
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug31348.php.expectf b/hphp/test/zend/bad/ext-spl/bug31348.php.expectf
new file mode 100644
index 000000000..922a780ce
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug31348.php.expectf
@@ -0,0 +1 @@
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug31926.php b/hphp/test/zend/bad/ext-spl/bug31926.php
new file mode 100644
index 000000000..dffd14010
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug31926.php
@@ -0,0 +1,10 @@
+ array('world'));
+
+$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
+foreach($it as $key => $val) {
+ var_dump($key, $val);
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug31926.php.expectf b/hphp/test/zend/bad/ext-spl/bug31926.php.expectf
new file mode 100644
index 000000000..50f979a63
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug31926.php.expectf
@@ -0,0 +1,2 @@
+int(0)
+string(5) "world"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug32394.php b/hphp/test/zend/bad/ext-spl/bug32394.php
new file mode 100644
index 000000000..5a0ce00c9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug32394.php
@@ -0,0 +1,12 @@
+append(1);
+
+foreach($object as $key => $value)
+{
+ $object->offsetUnset($key);
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug32394.php.expectf b/hphp/test/zend/bad/ext-spl/bug32394.php.expectf
new file mode 100644
index 000000000..922a780ce
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug32394.php.expectf
@@ -0,0 +1 @@
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug33136.php b/hphp/test/zend/bad/ext-spl/bug33136.php
new file mode 100644
index 000000000..217341fcb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug33136.php
@@ -0,0 +1,47 @@
+data = array();
+ parent::__construct($this->data);
+ }
+
+ function offsetGet($index)
+ {
+ echo __METHOD__ . "($index)\n";
+ return parent::offsetGet($index);
+ }
+
+ function offsetSet($index, $value)
+ {
+ echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n";
+ parent::offsetSet($index, $value);
+ }
+}
+
+echo "\n\nInitiate Obj\n";
+$arrayObj = new Collection();
+
+echo "Assign values\n";
+
+$arrayObj[] = "foo";
+var_dump($arrayObj[0]);
+
+$arrayObj[] = "bar";
+var_dump($arrayObj[0]);
+var_dump($arrayObj[1]);
+
+$arrayObj["foo"] = "baz";
+var_dump($arrayObj["foo"]);
+
+print_r($arrayObj);
+
+var_dump(count($arrayObj));
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug33136.php.expectf b/hphp/test/zend/bad/ext-spl/bug33136.php.expectf
new file mode 100644
index 000000000..921496d74
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug33136.php.expectf
@@ -0,0 +1,29 @@
+Initiate Obj
+Assign values
+Collection::offsetSet(NULL,foo)
+Collection::offsetGet(0)
+string(3) "foo"
+Collection::offsetSet(NULL,bar)
+Collection::offsetGet(0)
+string(3) "foo"
+Collection::offsetGet(1)
+string(3) "bar"
+Collection::offsetSet(foo,baz)
+Collection::offsetGet(foo)
+string(3) "baz"
+Collection Object
+(
+ [data:Collection:private] => Array
+ (
+ )
+
+ [storage:ArrayObject:private] => Array
+ (
+ [0] => foo
+ [1] => bar
+ [foo] => baz
+ )
+
+)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug34548.php b/hphp/test/zend/bad/ext-spl/bug34548.php
new file mode 100644
index 000000000..726285fb3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug34548.php
@@ -0,0 +1,25 @@
+append($value);
+ }
+
+ public function offsetSet($index, $value)
+ {
+ parent::offsetSet($index, $value);
+ }
+}
+
+$data1=array('one', 'two', 'three');
+$data2=array('four', 'five');
+
+$foo=new Collection($data1);
+$foo->add($data2);
+
+print_r($foo->getArrayCopy());
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug34548.php.expectf b/hphp/test/zend/bad/ext-spl/bug34548.php.expectf
new file mode 100644
index 000000000..c3bbf4273
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug34548.php.expectf
@@ -0,0 +1,9 @@
+Array
+(
+ [0] => one
+ [1] => two
+ [2] => three
+ [3] => four
+ [4] => five
+)
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug36825.php b/hphp/test/zend/bad/ext-spl/bug36825.php
new file mode 100644
index 000000000..baf42ba35
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug36825.php
@@ -0,0 +1,24 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug36825.php.expectf b/hphp/test/zend/bad/ext-spl/bug36825.php.expectf
new file mode 100644
index 000000000..22f6f580a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug36825.php.expectf
@@ -0,0 +1,3 @@
+foo::offsetGet(bar)
+got exception
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug36941.php b/hphp/test/zend/bad/ext-spl/bug36941.php
new file mode 100644
index 000000000..4bd3f3f9a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug36941.php
@@ -0,0 +1,27 @@
+===ArrayObject===
+
+===ArrayIterator===
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug36941.php.expectf b/hphp/test/zend/bad/ext-spl/bug36941.php.expectf
new file mode 100644
index 000000000..3bdbcf2b7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug36941.php.expectf
@@ -0,0 +1,15 @@
+===ArrayObject===
+int(1)
+int(1)
+int(1)
+int(2)
+int(1)
+int(3)
+===ArrayIterator===
+int(1)
+int(1)
+int(2)
+int(2)
+int(3)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug37457.php b/hphp/test/zend/bad/ext-spl/bug37457.php
new file mode 100644
index 000000000..80884b739
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug37457.php
@@ -0,0 +1,68 @@
+array = $a;
+ }
+
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return current($this->array);
+ }
+
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return key($this->array);
+ }
+
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->valid = (false !== next($this->array));
+ }
+
+ public function valid()
+ {
+ echo __METHOD__ . "\n";
+ return $this->valid;
+ }
+
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->valid = (false !== reset($this->array));
+ }
+}
+
+class TestFilter extends FilterIterator
+{
+ public function accept()
+ {
+ echo __METHOD__ . "\n";
+ throw new Exception("Failure in Accept");
+ }
+}
+
+$test = new TestFilter(new Collection(array(0)));
+
+try
+{
+ foreach ($test as $item)
+ {
+ echo $item;
+ }
+}
+catch (Exception $e)
+{
+ var_dump($e->getMessage());
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug37457.php.expectf b/hphp/test/zend/bad/ext-spl/bug37457.php.expectf
new file mode 100644
index 000000000..ea5a57764
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug37457.php.expectf
@@ -0,0 +1,8 @@
+Collection::__construct
+Collection::rewind
+Collection::valid
+Collection::current
+Collection::key
+TestFilter::accept
+string(17) "Failure in Accept"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug38618.php b/hphp/test/zend/bad/ext-spl/bug38618.php
new file mode 100644
index 000000000..ffeef6c8e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug38618.php
@@ -0,0 +1,87 @@
+title = $title;
+ }
+
+ public function __toString()
+ {
+ return $this->title;
+ }
+}
+
+class FruitProtected
+{
+ protected $title;
+
+ public function __construct($title)
+ {
+ $this->title = $title;
+ }
+
+ public function __toString()
+ {
+ return $this->title;
+ }
+}
+
+function test_array($array, $which, $flags = 0)
+{
+ echo "===$which===\n";
+ $it = new RecursiveArrayIterator($array, $flags);
+ foreach (new RecursiveIteratorIterator($it) as $k => $fruit) {
+ echo $k , ' => ', $fruit, "\n";
+ }
+}
+
+$array = array(
+ 1 => array(
+ 1 => array(
+ 1 => 'apple',
+ ),
+ 2 => array(
+ 1 => 'grape',
+ ),
+ ),
+);
+
+test_array($array, 'Default with array');
+
+$array = array(
+ 1 => array(
+ 1 => array(
+ 1 => new FruitPublic('apple'),
+ ),
+ 2 => array(
+ 1 => new FruitPublic('grape'),
+ ),
+ ),
+);
+
+test_array($array, 'Public Property');
+
+$array = array(
+ 1 => array(
+ 1 => array(
+ 1 => new FruitProtected('apple'),
+ ),
+ 2 => array(
+ 1 => new FruitProtected('grape'),
+ ),
+ ),
+);
+
+test_array($array, 'Protected Property');
+
+test_array($array, 'Public Property New', RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
+test_array($array, 'Protected Property New', RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
+?>
+===DONE===
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug38618.php.expectf b/hphp/test/zend/bad/ext-spl/bug38618.php.expectf
new file mode 100644
index 000000000..d0422205b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug38618.php.expectf
@@ -0,0 +1,14 @@
+===Default with array===
+1 => apple
+1 => grape
+===Public Property===
+title => apple
+title => grape
+===Protected Property===
+===Public Property New===
+1 => apple
+1 => grape
+===Protected Property New===
+1 => apple
+1 => grape
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug40036.php b/hphp/test/zend/bad/ext-spl/bug40036.php
new file mode 100644
index 000000000..3007ac701
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug40036.php
@@ -0,0 +1,24 @@
+foo = false;
+$view->bar = null;
+$view->baz = '';
+if (empty($view['foo']) || empty($view->foo)) {
+ echo "View::foo empty\n";
+}
+if (empty($view['bar']) || empty($view->bar)) {
+ echo "View::bar empty\n";
+}
+if (empty($view['baz']) || empty($view->baz)) {
+ echo "View::baz empty\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug40036.php.expectf b/hphp/test/zend/bad/ext-spl/bug40036.php.expectf
new file mode 100644
index 000000000..f0aa23161
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug40036.php.expectf
@@ -0,0 +1,4 @@
+View::foo empty
+View::bar empty
+View::baz empty
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug40442.php b/hphp/test/zend/bad/ext-spl/bug40442.php
new file mode 100644
index 000000000..63848e542
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug40442.php
@@ -0,0 +1,6 @@
+offsetSet('property', 0);
+var_dump($a->offsetExists('property'));
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug40442.php.expectf b/hphp/test/zend/bad/ext-spl/bug40442.php.expectf
new file mode 100644
index 000000000..e7c042967
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug40442.php.expectf
@@ -0,0 +1,2 @@
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug40872.php b/hphp/test/zend/bad/ext-spl/bug40872.php
new file mode 100644
index 000000000..08a7609b0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug40872.php
@@ -0,0 +1,23 @@
+id = $id;
+ }
+ }
+
+ class ProjectsList extends ArrayIterator {
+ public function add(Project $item) {
+ $this->offsetSet($item->id, $item);
+ }
+ }
+
+ $projects = new ProjectsList();
+ $projects->add(new Project('1'));
+ $projects->add(new Project(2));
+
+ var_dump($projects->offsetExists(1));
+ var_dump($projects->offsetExists('2'));
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug40872.php.expectf b/hphp/test/zend/bad/ext-spl/bug40872.php.expectf
new file mode 100644
index 000000000..c3b0dc5d5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug40872.php.expectf
@@ -0,0 +1,3 @@
+bool(true)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41528.php b/hphp/test/zend/bad/ext-spl/bug41528.php
new file mode 100644
index 000000000..c0236a317
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41528.php
@@ -0,0 +1,17 @@
+a = 1;
+
+var_dump($classOne);
+var_dump($classOne->a);
+
+$classOne = unserialize(serialize($classOne));
+
+var_dump($classOne);
+var_dump($classOne->a);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41528.php.expectf b/hphp/test/zend/bad/ext-spl/bug41528.php.expectf
new file mode 100644
index 000000000..7fcfe486e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41528.php.expectf
@@ -0,0 +1,16 @@
+object(ClassOne)#1 (2) {
+ ["a"]=>
+ int(1)
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+int(1)
+object(ClassOne)#2 (2) {
+ ["a"]=>
+ int(1)
+ ["storage":"ArrayObject":private]=>
+ array(0) {
+ }
+}
+int(1)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41691.php b/hphp/test/zend/bad/ext-spl/bug41691.php
new file mode 100644
index 000000000..33ded6449
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41691.php
@@ -0,0 +1,16 @@
+exchangeArray(array('a'=>1,'b'=>1,'c'=>1)));
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41691.php.expectf b/hphp/test/zend/bad/ext-spl/bug41691.php.expectf
new file mode 100644
index 000000000..74fcdcf3a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41691.php.expectf
@@ -0,0 +1,9 @@
+array(3) {
+ ["a"]=>
+ NULL
+ ["b"]=>
+ NULL
+ ["c"]=>
+ NULL
+}
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41692.php b/hphp/test/zend/bad/ext-spl/bug41692.php
new file mode 100644
index 000000000..9f5cd6490
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41692.php
@@ -0,0 +1,19 @@
+foo);
+ }
+}
+
+$foo = new Bar();
+var_dump($foo);
+$foo['foo'] = 23;
+
+$bar = new Bar();
+var_dump($bar);
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41692.php.expectf b/hphp/test/zend/bad/ext-spl/bug41692.php.expectf
new file mode 100644
index 000000000..94dd1d825
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41692.php.expectf
@@ -0,0 +1,41 @@
+object(Bar)#%d (2) {
+ ["foo":"Bar":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+object(Bar)#%d (2) {
+ ["foo":"Bar":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["storage":"ArrayObject":private]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41828.php b/hphp/test/zend/bad/ext-spl/bug41828.php
new file mode 100644
index 000000000..5fd782cd4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41828.php
@@ -0,0 +1,16 @@
+bar();
+
+?>
+==DONE==
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug41828.php.expectf b/hphp/test/zend/bad/ext-spl/bug41828.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug41828.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug42654.php b/hphp/test/zend/bad/ext-spl/bug42654.php
new file mode 100644
index 000000000..26930d4fd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug42654.php
@@ -0,0 +1,20 @@
+ 'val1',
+ array(2 => 'val2',
+ array(3 => 'val3'),
+ ),
+ 4 => 'val4'
+ );
+
+$iterator = new RecursiveIteratorIterator(new
+RecursiveArrayIterator($data));
+foreach($iterator as $foo) {
+ $key = $iterator->key();
+ echo "update $key\n";
+ var_dump($iterator->getInnerIterator());
+ $iterator->offsetSet($key, 'alter');
+ var_dump($iterator->getInnerIterator());
+}
+$copy = $iterator->getArrayCopy();
+var_dump($copy);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug42654.php.expectf b/hphp/test/zend/bad/ext-spl/bug42654.php.expectf
new file mode 100644
index 000000000..bf5ba7c2d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug42654.php.expectf
@@ -0,0 +1,134 @@
+update 1
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ string(4) "val1"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(4) "val4"
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(4) "val4"
+ }
+}
+update 2
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(2) {
+ [2]=>
+ string(5) "alter"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+}
+update 3
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(1) {
+ [3]=>
+ string(5) "alter"
+ }
+}
+update 4
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(4) "val4"
+ }
+}
+object(RecursiveArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(5) "alter"
+ }
+}
+array(3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(5) "alter"
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug42703.php b/hphp/test/zend/bad/ext-spl/bug42703.php
new file mode 100644
index 000000000..40d73b09c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug42703.php
@@ -0,0 +1,34 @@
+ $value) {
+ echo $key, $value;
+ }
+}
+catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+var_dump($itit->current());
+var_dump($itit->key());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug42703.php.expectf b/hphp/test/zend/bad/ext-spl/bug42703.php.expectf
new file mode 100644
index 000000000..dce684ad2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug42703.php.expectf
@@ -0,0 +1,3 @@
+string(3) "boo"
+NULL
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug44615.php b/hphp/test/zend/bad/ext-spl/bug44615.php
new file mode 100644
index 000000000..406dd8260
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug44615.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug44615.php.expectf b/hphp/test/zend/bad/ext-spl/bug44615.php.expectf
new file mode 100644
index 000000000..88718f960
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug44615.php.expectf
@@ -0,0 +1,9 @@
+string(1) "z"
+object(stdClass)#1 (0) {
+}
+string(1) "q"
+string(1) "s"
+Second:
+string(1) "z"
+string(1) "q"
+string(1) "s"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45216.php b/hphp/test/zend/bad/ext-spl/bug45216.php
new file mode 100644
index 000000000..5bd5a04ce
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45216.php
@@ -0,0 +1,11 @@
+text 1');
+$handle = fopen($file, 'r');
+
+$object = new SplFileObject($file);
+var_dump($object->fgetss());
+var_dump(fgetss($handle));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45216.php.expectf b/hphp/test/zend/bad/ext-spl/bug45216.php.expectf
new file mode 100644
index 000000000..71dec0174
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45216.php.expectf
@@ -0,0 +1,2 @@
+string(12) "text 0text 1"
+string(12) "text 0text 1"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45614.php b/hphp/test/zend/bad/ext-spl/bug45614.php
new file mode 100644
index 000000000..a24fe90c9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45614.php
@@ -0,0 +1,37 @@
+key()) . " => " . $it->current() .
+"\n";
+ $it->next();
+ echo str_replace("\0", '\0', $it->key()) . " => " . $it->current() .
+"\n";
+}
+
+$ao = new ArrayObject(new C);
+$ai = $ao->getIterator();
+
+echo "--> Show the first two items:\n";
+showFirstTwoItems($ai);
+
+echo "\n--> Rewind and show the first two items:\n";
+$ai->rewind();
+showFirstTwoItems($ai);
+
+echo "\n--> Invalidate current position and show the first two items:\n";
+unset($ai[$ai->key()]);
+$ai->current();
+showFirstTwoItems($ai);
+
+echo "\n--> Rewind, seek and show the first two items:\n";
+$ai->rewind();
+$ai->seek(0);
+showFirstTwoItems($ai);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45614.php.expectf b/hphp/test/zend/bad/ext-spl/bug45614.php.expectf
new file mode 100644
index 000000000..d7d400891
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45614.php.expectf
@@ -0,0 +1,15 @@
+--> Show the first two items:
+pub1 => public1
+pub2 => public2
+
+--> Rewind and show the first two items:
+pub1 => public1
+pub2 => public2
+
+--> Invalidate current position and show the first two items:
+pub1 => public1
+pub3 => public3
+
+--> Rewind, seek and show the first two items:
+pub1 => public1
+pub3 => public3
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45622.php b/hphp/test/zend/bad/ext-spl/bug45622.php
new file mode 100644
index 000000000..44c628dc2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45622.php
@@ -0,0 +1,28 @@
+'array element'));
+$ao->setFlags(ArrayObject::ARRAY_AS_PROPS);
+
+echo "\n--> Access the real property:\n";
+var_dump(isset($ao->p));
+var_dump($ao->p);
+
+echo "\n--> Remove the real property and access the array element:\n";
+unset($ao->p);
+var_dump(isset($ao->p));
+var_dump($ao->p);
+
+echo "\n--> Remove the array element and try access again:\n";
+unset($ao->p);
+var_dump(isset($ao->p));
+var_dump($ao->p);
+
+echo "\n--> Re-add the real property:\n";
+$ao->p = 'object property';
+var_dump(isset($ao->p));
+var_dump($ao->p);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45622.php.expectf b/hphp/test/zend/bad/ext-spl/bug45622.php.expectf
new file mode 100644
index 000000000..ee335e0d1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45622.php.expectf
@@ -0,0 +1,16 @@
+--> Access the real property:
+bool(true)
+%unicode|string%(15) "object property"
+
+--> Remove the real property and access the array element:
+bool(true)
+%unicode|string%(13) "array element"
+
+--> Remove the array element and try access again:
+bool(false)
+HipHop Notice: %a
+NULL
+
+--> Re-add the real property:
+bool(true)
+%unicode|string%(15) "object property"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45622b.php b/hphp/test/zend/bad/ext-spl/bug45622b.php
new file mode 100644
index 000000000..36aba07e9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45622b.php
@@ -0,0 +1,21 @@
+prop1;
+
+echo "Doesn't trigger __set.\n";
+$ao->prop2 = 'foo';
+
+echo "Doesn't trigger __unset.\n";
+unset($ao->prop3);
+
+echo "Shouldn't trigger __isset.\n";
+isset($ao->prop4);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45622b.php.expectf b/hphp/test/zend/bad/ext-spl/bug45622b.php.expectf
new file mode 100644
index 000000000..efac7eab4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45622b.php.expectf
@@ -0,0 +1,6 @@
+Doesn't trigger __get.
+HipHop Notice: %a
+Doesn't trigger __set.
+Doesn't trigger __unset.
+HipHop Notice: %a
+Shouldn't trigger __isset.
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45826.php b/hphp/test/zend/bad/ext-spl/bug45826.php
new file mode 100644
index 000000000..fe05d4c21
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45826.php
@@ -0,0 +1,65 @@
+append($y);
+$o->append($y);
+$o->append($o);
+
+var_dump($o[0] === $o[1]);
+var_dump($o[2] === $o);
+
+$s1 = serialize($o);
+$s2 = $o->serialize();
+var_dump($s1);
+var_dump($s2);
+
+$o1 =unserialize($s1);
+
+var_dump($o1[0] === $o1[1]);
+var_dump($o1[2] === $o1);
+
+$o2 = new ArrayObject();
+$o2->unserialize($s2);
+
+var_dump($o2[0] === $o2[1]);
+var_dump($o2[2] !== $o2);
+var_dump($o2[2][2] === $o2[2]);
+
+echo "#### Extending ArrayObject\n";
+unset($o,$x,$s1,$s2,$o1,$o2);
+class ArrayObject2 extends ArrayObject {
+ public function serialize() {
+ return parent::serialize();
+ }
+
+ public function unserialize($s) {
+ return parent::unserialize($s);
+ }
+}
+
+$o = new ArrayObject2();
+$y = new StdClass;
+$o->append($y);
+$o->append($y);
+$o->append($o);
+
+var_dump($o[0] === $o[1]);
+var_dump($o[2] === $o);
+
+$s1 = serialize($o);
+$s2 = $o->serialize();
+var_dump($s1);
+var_dump($s2);
+
+$o1 =unserialize($s1);
+
+var_dump($o1[0] === $o1[1]);
+var_dump($o1[2] === $o1);
+
+$o2 = new ArrayObject2();
+$o2->unserialize($s2);
+
+var_dump($o2[0] === $o2[1]);
+var_dump($o2[2] !== $o2);
+var_dump($o2[2][2] === $o2[2]);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug45826.php.expectf b/hphp/test/zend/bad/ext-spl/bug45826.php.expectf
new file mode 100644
index 000000000..03bedbd68
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug45826.php.expectf
@@ -0,0 +1,19 @@
+bool(true)
+bool(true)
+string(84) "C:11:"ArrayObject":60:{x:i:0;a:3:{i:0;O:8:"stdClass":0:{}i:1;r:4;i:2;r:1;};m:a:0:{}}"
+string(125) "x:i:0;a:3:{i:0;O:8:"stdClass":0:{}i:1;r:3;i:2;C:11:"ArrayObject":45:{x:i:0;a:3:{i:0;r:3;i:1;r:3;i:2;r:5;};m:a:0:{}}};m:a:0:{}"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+#### Extending ArrayObject
+bool(true)
+bool(true)
+string(85) "C:12:"ArrayObject2":60:{x:i:0;a:3:{i:0;O:8:"stdClass":0:{}i:1;r:4;i:2;r:1;};m:a:0:{}}"
+string(126) "x:i:0;a:3:{i:0;O:8:"stdClass":0:{}i:1;r:3;i:2;C:12:"ArrayObject2":45:{x:i:0;a:3:{i:0;r:3;i:1;r:3;i:2;r:5;};m:a:0:{}}};m:a:0:{}"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46051.php b/hphp/test/zend/bad/ext-spl/bug46051.php
new file mode 100644
index 000000000..f144eacd8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46051.php
@@ -0,0 +1,9 @@
+openFile(NULL, NULL, NULL);
+} catch (Exception $e) { }
+
+var_dump($x->getPathName());
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46051.php.expectf b/hphp/test/zend/bad/ext-spl/bug46051.php.expectf
new file mode 100644
index 000000000..d013f39c5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46051.php.expectf
@@ -0,0 +1 @@
+%unicode|string%(%d) "%sbug46051.php"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46053.php b/hphp/test/zend/bad/ext-spl/bug46053.php
new file mode 100644
index 000000000..260b1faee
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46053.php
@@ -0,0 +1,7 @@
+getPathName();
+$x->seek(10);
+$x->seek(0);
+var_dump(trim($x->fgets()));
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46053.php.expectf b/hphp/test/zend/bad/ext-spl/bug46053.php.expectf
new file mode 100644
index 000000000..ab4f8172d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46053.php.expectf
@@ -0,0 +1 @@
+string(%d) "accept());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46088.php.expectf b/hphp/test/zend/bad/ext-spl/bug46088.php.expectf
new file mode 100644
index 000000000..eb28e0c67
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46088.php.expectf
@@ -0,0 +1 @@
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46115.php b/hphp/test/zend/bad/ext-spl/bug46115.php
new file mode 100644
index 000000000..4be1edd8d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46115.php
@@ -0,0 +1,6 @@
+invoke($h);
+?>
+DONE
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46115.php.expectf b/hphp/test/zend/bad/ext-spl/bug46115.php.expectf
new file mode 100644
index 000000000..096264973
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46115.php.expectf
@@ -0,0 +1 @@
+DONE
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46160.php b/hphp/test/zend/bad/ext-spl/bug46160.php
new file mode 100644
index 000000000..ed4987b29
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46160.php
@@ -0,0 +1,9 @@
+offsetSet(0, 0);
+} catch (Exception $e) { }
+
+?>
+DONE
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug46160.php.expectf b/hphp/test/zend/bad/ext-spl/bug46160.php.expectf
new file mode 100644
index 000000000..096264973
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug46160.php.expectf
@@ -0,0 +1 @@
+DONE
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug47534.php b/hphp/test/zend/bad/ext-spl/bug47534.php
new file mode 100644
index 000000000..bf10dfb23
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug47534.php
@@ -0,0 +1,8 @@
+rewind();
+echo gettype($it1->current())."\n";
+
+$it2 = new RecursiveDirectoryIterator(dirname(__FILE__));
+$it2->rewind();
+echo gettype($it2->current())."\n";
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug47534.php.expectf b/hphp/test/zend/bad/ext-spl/bug47534.php.expectf
new file mode 100644
index 000000000..c78390912
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug47534.php.expectf
@@ -0,0 +1,2 @@
+string
+object
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug48361.php b/hphp/test/zend/bad/ext-spl/bug48361.php
new file mode 100644
index 000000000..2977172c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug48361.php
@@ -0,0 +1,6 @@
+getRealPath());
+var_dump($info->getPathInfo()->getRealPath());
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug48361.php.expectf b/hphp/test/zend/bad/ext-spl/bug48361.php.expectf
new file mode 100644
index 000000000..02fab70b8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug48361.php.expectf
@@ -0,0 +1,3 @@
+string(%d) "%stests%sbug48361.php"
+string(%d) "%stests"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug49263.php b/hphp/test/zend/bad/ext-spl/bug49263.php
new file mode 100644
index 000000000..627965b0e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug49263.php
@@ -0,0 +1,15 @@
+attach($o1, array('prev' => 2, 'next' => $o2));
+$s->attach($o2, array('prev' => $o1));
+
+$ss = serialize($s);
+unset($s,$o1,$o2);
+echo $ss."\n";
+var_dump(unserialize($ss));
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug49263.php.expectf b/hphp/test/zend/bad/ext-spl/bug49263.php.expectf
new file mode 100644
index 000000000..3859cc6cb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug49263.php.expectf
@@ -0,0 +1,33 @@
+C:16:"SplObjectStorage":113:{x:i:2;O:8:"stdClass":0:{},a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}};r:6;,a:1:{s:4:"prev";r:3;};m:a:0:{}}
+object(SplObjectStorage)#2 (1) {
+ ["storage":"SplObjectStorage":private]=>
+ array(2) {
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#1 (0) {
+ }
+ ["inf"]=>
+ array(2) {
+ ["prev"]=>
+ int(2)
+ ["next"]=>
+ object(stdClass)#3 (0) {
+ }
+ }
+ }
+ ["%s"]=>
+ array(2) {
+ ["obj"]=>
+ object(stdClass)#3 (0) {
+ }
+ ["inf"]=>
+ array(1) {
+ ["prev"]=>
+ object(stdClass)#1 (0) {
+ }
+ }
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug49723.php b/hphp/test/zend/bad/ext-spl/bug49723.php
new file mode 100644
index 000000000..3ce77672e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug49723.php
@@ -0,0 +1,11 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug49723.php.expectf b/hphp/test/zend/bad/ext-spl/bug49723.php.expectf
new file mode 100644
index 000000000..922a780ce
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug49723.php.expectf
@@ -0,0 +1 @@
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug49972.php b/hphp/test/zend/bad/ext-spl/bug49972.php
new file mode 100644
index 000000000..ccd4fce1f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug49972.php
@@ -0,0 +1,6 @@
+undefined();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug49972.php.expectf b/hphp/test/zend/bad/ext-spl/bug49972.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug49972.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug50579.php b/hphp/test/zend/bad/ext-spl/bug50579.php
new file mode 100644
index 000000000..9c6f31ccb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug50579.php
@@ -0,0 +1,30 @@
+'test888',
+ 'test2'=>'what?',
+ 'test3'=>'test999'));
+ }
+}
+$h = new foo;
+$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
+$i->replacement = '[$0]';
+foreach ($i as $name=>$value) {
+ echo $name . '=>' . $value . "\n";
+}
+
+$i->replacement = '$1';
+foreach ($i as $name=>$value) {
+ echo $name . '=>' . $value . "\n";
+}
+
+$h = new foo;
+$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
+$i->replacement = '[$1]';
+foreach ($i as $name=>$value) {
+ echo $name . '=>' . $value . "\n";
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug50579.php.expectf b/hphp/test/zend/bad/ext-spl/bug50579.php.expectf
new file mode 100644
index 000000000..9e829f3fe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug50579.php.expectf
@@ -0,0 +1,6 @@
+test1=>[test888]
+test3=>[test999]
+test1=>888
+test3=>999
+test1=>[888]
+test3=>[999]
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug51119.php b/hphp/test/zend/bad/ext-spl/bug51119.php
new file mode 100644
index 000000000..98f07295c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug51119.php
@@ -0,0 +1,25 @@
+getMessage() . "\n";
+}
+
+try {
+ $limitIterator = new LimitIterator($arrayIterator, -1);
+ foreach ($limitIterator as $item) {
+ echo $item . "\n";
+ }
+} catch (OutOfRangeException $e){
+ print $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug51119.php.expectf b/hphp/test/zend/bad/ext-spl/bug51119.php.expectf
new file mode 100644
index 000000000..2cada6f51
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug51119.php.expectf
@@ -0,0 +1,5 @@
+a
+b
+c
+Parameter offset must be >= 0
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug51374.php b/hphp/test/zend/bad/ext-spl/bug51374.php
new file mode 100644
index 000000000..66f0846d2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug51374.php
@@ -0,0 +1,12 @@
+setFileClass('Foo');
+$file = $fileInfo->openFile('r');
+
+print var_dump($file->bam); // is null or UNKNOWN:0
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug51374.php.expectf b/hphp/test/zend/bad/ext-spl/bug51374.php.expectf
new file mode 100644
index 000000000..de29593a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug51374.php.expectf
@@ -0,0 +1,3 @@
+array(0) {
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug52238.php b/hphp/test/zend/bad/ext-spl/bug52238.php
new file mode 100644
index 000000000..a8215bd3e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug52238.php
@@ -0,0 +1,13 @@
+bar());
+ }
+}
+var_dump(iterator_to_array(new Foo));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug52238.php.expectf b/hphp/test/zend/bad/ext-spl/bug52238.php.expectf
new file mode 100644
index 000000000..a5eca669c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug52238.php.expectf
@@ -0,0 +1,7 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s: Foo->bar()
+#1 [internal function]: Foo->getIterator()
+#2 %s: iterator_to_array(Object(Foo))
+#3 {main}
+ thrown in hphp/test/zend/bad/ext-spl/bug52238.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug52573.php b/hphp/test/zend/bad/ext-spl/bug52573.php
new file mode 100644
index 000000000..4948306ff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug52573.php
@@ -0,0 +1,8 @@
+fscanf('fscanf('
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug52573.php.expectf b/hphp/test/zend/bad/ext-spl/bug52573.php.expectf
new file mode 100644
index 000000000..466e575ef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug52573.php.expectf
@@ -0,0 +1,6 @@
+int(1)
+string(4) "test"
+array(1) {
+ [0]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug52861.php b/hphp/test/zend/bad/ext-spl/bug52861.php
new file mode 100644
index 000000000..28f807a62
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug52861.php
@@ -0,0 +1,6 @@
+ array('bar' => array('baz' => 'boo'))));
+
+unset($arrayObject['foo']['bar']['baz']);
+print_r($arrayObject->getArrayCopy());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug52861.php.expectf b/hphp/test/zend/bad/ext-spl/bug52861.php.expectf
new file mode 100644
index 000000000..2fc48217a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug52861.php.expectf
@@ -0,0 +1,11 @@
+Array
+(
+ [foo] => Array
+ (
+ [bar] => Array
+ (
+ )
+
+ )
+
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53071.php b/hphp/test/zend/bad/ext-spl/bug53071.php
new file mode 100644
index 000000000..247c53929
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53071.php
@@ -0,0 +1,21 @@
+member = $myA; // myC has a referece to myA
+ $myB->Attach($myC); // myB attaches myC
+ $myA->member = $myB; // myA has myB, comleting the cycle
+}
+LimitedScope();
+var_dump(gc_collect_cycles());
+
+echo "Done.\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53071.php.expectf b/hphp/test/zend/bad/ext-spl/bug53071.php.expectf
new file mode 100644
index 000000000..7f8a20c0c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53071.php.expectf
@@ -0,0 +1,2 @@
+int(5)
+Done.
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53144.php b/hphp/test/zend/bad/ext-spl/bug53144.php
new file mode 100644
index 000000000..59fa7637a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53144.php
@@ -0,0 +1,14 @@
+removeAll($b);
+var_dump(count($b));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53144.php.expectf b/hphp/test/zend/bad/ext-spl/bug53144.php.expectf
new file mode 100644
index 000000000..7edc73871
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53144.php.expectf
@@ -0,0 +1,2 @@
+int(2)
+int(0)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53362.php b/hphp/test/zend/bad/ext-spl/bug53362.php
new file mode 100644
index 000000000..462a53141
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53362.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53362.php.expectf b/hphp/test/zend/bad/ext-spl/bug53362.php.expectf
new file mode 100644
index 000000000..7aca65c67
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53362.php.expectf
@@ -0,0 +1,3 @@
+NULL
+NULL
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53515.php b/hphp/test/zend/bad/ext-spl/bug53515.php
new file mode 100644
index 000000000..fe2fcc5ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53515.php
@@ -0,0 +1,15 @@
+ 1, 'b'=> true, 'c' => 0, 'd' => null, 'e' => false, 'f' => array());
+$o = new ArrayObject($a, ArrayObject::ARRAY_AS_PROPS);
+
+$a['z'] = '';
+$a[''] = '';
+
+foreach ($a as $key => $value) {
+ echo $key . ': ' . (is_null($value) ? 'null' : @"$value") .
+ ' array_key_exists: ' . (array_key_exists($key, $a) ? 'true' : 'false') .
+ ' property_exists: ' . (property_exists($o, $key) ? 'true' : 'false'),"\n";
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug53515.php.expectf b/hphp/test/zend/bad/ext-spl/bug53515.php.expectf
new file mode 100644
index 000000000..5116a4627
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug53515.php.expectf
@@ -0,0 +1,8 @@
+a: 1 array_key_exists: true property_exists: true
+b: 1 array_key_exists: true property_exists: true
+c: 0 array_key_exists: true property_exists: true
+d: null array_key_exists: true property_exists: true
+e: array_key_exists: true property_exists: true
+f: Array array_key_exists: true property_exists: true
+z: array_key_exists: true property_exists: false
+: array_key_exists: true property_exists: false
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54291.php b/hphp/test/zend/bad/ext-spl/bug54291.php
new file mode 100644
index 000000000..d371ddc17
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54291.php
@@ -0,0 +1,3 @@
+isFile();
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54291.php.expectf b/hphp/test/zend/bad/ext-spl/bug54291.php.expectf
new file mode 100644
index 000000000..d31873c70
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54291.php.expectf
@@ -0,0 +1,5 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 %s(%d): DirectoryIterator->__construct('?/abc')
+#1 {main}
+ thrown in hphp/test/zend/bad/ext-spl/bug54291.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54292.php b/hphp/test/zend/bad/ext-spl/bug54292.php
new file mode 100644
index 000000000..4996a2dde
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54292.php
@@ -0,0 +1,9 @@
+getMessage());
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54292.php.expectf b/hphp/test/zend/bad/ext-spl/bug54292.php.expectf
new file mode 100644
index 000000000..55f49f7c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54292.php.expectf
@@ -0,0 +1 @@
+string(74) "SplFileObject::__construct() expects parameter 2 to be string, array given"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54304.php b/hphp/test/zend/bad/ext-spl/bug54304.php
new file mode 100644
index 000000000..50a16b483
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54304.php
@@ -0,0 +1,17 @@
+'test999'));
+ }
+}
+
+$h = new foo;
+$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
+$i->replacement = 42;
+var_dump($i->replacement);
+foreach ($i as $name=>$value) {
+ var_dump($name, $value);
+}
+var_dump($i->replacement);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54304.php.expectf b/hphp/test/zend/bad/ext-spl/bug54304.php.expectf
new file mode 100644
index 000000000..c3555064e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54304.php.expectf
@@ -0,0 +1,4 @@
+int(42)
+string(5) "test3"
+string(2) "42"
+int(42)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54323.php b/hphp/test/zend/bad/ext-spl/bug54323.php
new file mode 100644
index 000000000..9c8e87f9a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54323.php
@@ -0,0 +1,15 @@
+$value) {
+ }
+ unset($ao['prop']);
+ var_dump($c->prop, $ao['prop']);
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54323.php.expectf b/hphp/test/zend/bad/ext-spl/bug54323.php.expectf
new file mode 100644
index 000000000..a174b8398
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54323.php.expectf
@@ -0,0 +1,4 @@
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54384.php b/hphp/test/zend/bad/ext-spl/bug54384.php
new file mode 100644
index 000000000..6de3e6d1c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54384.php
@@ -0,0 +1,151 @@
+rewind();
+} );
+
+echo "FilterIterator... ";
+class FilterIteratorTest extends FilterIterator {
+ function __construct(){}
+ function accept(){}
+}
+test( function() {
+ $o = new FilterIteratorTest;
+ $o->rewind();
+} );
+
+echo "RecursiveFilterIterator... ";
+class RecursiveFilterIteratorTest extends RecursiveFilterIterator {
+ function __construct(){}
+ function accept(){}
+}
+test( function() {
+$o = new RecursiveFilterIteratorTest;
+$o->hasChildren();
+} );
+
+echo "ParentIterator... ";
+class ParentIteratorTest extends ParentIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new ParentIteratorTest;
+$o->accept();
+} );
+
+echo "LimitIterator... ";
+class LimitIteratorTest extends LimitIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new LimitIteratorTest;
+$o->rewind();
+} );
+
+echo "CachingIterator... ";
+class CachingIteratorTest extends CachingIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new CachingIteratorTest;
+$o->rewind();
+} );
+
+echo "RecursiveCachingIterator... ";
+class RecursiveCachingIteratorTest extends RecursiveCachingIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new RecursiveCachingIteratorTest;
+$o->rewind();
+} );
+
+echo "NoRewindIterator... ";
+class NoRewindIteratorTest extends NoRewindIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new NoRewindIteratorTest;
+$o->valid();
+} );
+
+echo "RegexIterator... ";
+class RegexIteratorTest extends RegexIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new RegexIteratorTest;
+$o->rewind();
+} );
+
+echo "RecursiveRegexIterator... ";
+class RecursiveRegexIteratorTest extends RecursiveRegexIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new RecursiveRegexIteratorTest;
+$o->hasChildren();
+} );
+
+echo "GlobIterator... ";
+class GlobIteratorTest extends GlobIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new GlobIteratorTest;
+$o->count();
+} );
+
+echo "SplFileObject... ";
+class SplFileObjectTest extends SplFileObject {
+ function __construct(){}
+}
+test ( function() {
+$o = new SplFileObjectTest;
+$o->rewind();
+} );
+
+echo "SplTempFileObject... ";
+class SplTempFileObjectTest extends SplTempFileObject {
+ function __construct(){}
+}
+test ( function() {
+$o = new SplTempFileObjectTest;
+$o->rewind();
+} );
+
+echo "AppendIterator... ";
+class AppendIteratorTest extends AppendIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new AppendIteratorTest;
+foreach ($o as $a) {
+echo $a,"\n";
+}
+} );
+
+echo "InfiniteIterator... ";
+class InfiniteIteratorTest extends InfiniteIterator {
+ function __construct(){}
+}
+test ( function() {
+$o = new InfiniteIteratorTest;
+foreach ($o as $a) {
+echo $a,"\n";
+}
+} );
diff --git a/hphp/test/zend/bad/ext-spl/bug54384.php.expectf b/hphp/test/zend/bad/ext-spl/bug54384.php.expectf
new file mode 100644
index 000000000..7688cd5d3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54384.php.expectf
@@ -0,0 +1,15 @@
+IteratorIterator... exception (expected)
+FilterIterator... exception (expected)
+RecursiveFilterIterator... exception (expected)
+ParentIterator... exception (expected)
+LimitIterator... exception (expected)
+CachingIterator... exception (expected)
+RecursiveCachingIterator... exception (expected)
+NoRewindIterator... exception (expected)
+RegexIterator... exception (expected)
+RecursiveRegexIterator... exception (expected)
+GlobIterator... exception (expected)
+SplFileObject... exception (expected)
+SplTempFileObject... exception (expected)
+AppendIterator... exception (expected)
+InfiniteIterator... exception (expected)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54970.php b/hphp/test/zend/bad/ext-spl/bug54970.php
new file mode 100644
index 000000000..e3b73e4d2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54970.php
@@ -0,0 +1,14 @@
+setSize(3);
+$fa[2] = '!';
+var_dump($fa);
+$fa->setSize(2);
+var_dump($fa);
+var_dump($fa->getSize());
+
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54970.php.expectf b/hphp/test/zend/bad/ext-spl/bug54970.php.expectf
new file mode 100644
index 000000000..bb7df4401
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54970.php.expectf
@@ -0,0 +1,15 @@
+object(SplFixedArray)#%d (3) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(5) "World"
+ [2]=>
+ string(1) "!"
+}
+object(SplFixedArray)#%d (2) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(5) "World"
+}
+int(2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54971.php b/hphp/test/zend/bad/ext-spl/bug54971.php
new file mode 100644
index 000000000..2c136a6fe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54971.php
@@ -0,0 +1,19 @@
+
+val1
+val2
+
+XML;
+
+
+$doc = new DOMDocument();
+$doc->loadXML($source);
+
+$xpath = new DOMXPath($doc);
+$items = $xpath->query('//node');
+
+print_r(array_map('get_class', iterator_to_array($items, false)));
+print_r(array_map('get_class', iterator_to_array($items, true)));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug54971.php.expectf b/hphp/test/zend/bad/ext-spl/bug54971.php.expectf
new file mode 100644
index 000000000..b3094550a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug54971.php.expectf
@@ -0,0 +1,10 @@
+Array
+(
+ [0] => DOMElement
+ [1] => DOMElement
+)
+Array
+(
+ [0] => DOMElement
+ [1] => DOMElement
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug60201.php b/hphp/test/zend/bad/ext-spl/bug60201.php
new file mode 100644
index 000000000..14fa810fb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug60201.php
@@ -0,0 +1,8 @@
+getParameters();
+var_dump($params);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug60201.php.expectf b/hphp/test/zend/bad/ext-spl/bug60201.php.expectf
new file mode 100644
index 000000000..a9552b6a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug60201.php.expectf
@@ -0,0 +1,18 @@
+array(3) {
+ [0]=>
+ &object(ReflectionParameter)#%d (1) {
+ ["name"]=>
+ string(9) "delimiter"
+ }
+ [1]=>
+ &object(ReflectionParameter)#%d (1) {
+ ["name"]=>
+ string(9) "enclosure"
+ }
+ [2]=>
+ &object(ReflectionParameter)#%d (1) {
+ ["name"]=>
+ string(6) "escape"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61326.php b/hphp/test/zend/bad/ext-spl/bug61326.php
new file mode 100644
index 000000000..de452b38c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61326.php
@@ -0,0 +1,10 @@
+foo = 'bar';
+var_dump($aobj1 == $aobj3);
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61326.php.expectf b/hphp/test/zend/bad/ext-spl/bug61326.php.expectf
new file mode 100644
index 000000000..d451c88b4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61326.php.expectf
@@ -0,0 +1,3 @@
+bool(false)
+bool(true)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61347.php b/hphp/test/zend/bad/ext-spl/bug61347.php
new file mode 100644
index 000000000..3a26ad95d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61347.php
@@ -0,0 +1,22 @@
+ NULL, 37 => NULL);
+var_dump(isset($a['b'])); //false
+
+$b = new ArrayObject($a);
+var_dump(isset($b['b'])); //false
+var_dump(isset($b[37])); //false
+var_dump(isset($b['no_exists'])); //false
+var_dump(empty($b['b'])); //true
+var_dump(empty($b[37])); //true
+
+var_dump(array_key_exists('b', $b)); //true
+var_dump($b['b']);
+
+$a = array('b' => '', 37 => false);
+$b = new ArrayObject($a);
+var_dump(isset($b['b'])); //true
+var_dump(isset($b[37])); //true
+var_dump(isset($b['no_exists'])); //false
+var_dump(empty($b['b'])); //true
+var_dump(empty($b[37])); //true
+
diff --git a/hphp/test/zend/bad/ext-spl/bug61347.php.expectf b/hphp/test/zend/bad/ext-spl/bug61347.php.expectf
new file mode 100644
index 000000000..5f0323dbf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61347.php.expectf
@@ -0,0 +1,13 @@
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+NULL
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61418.php b/hphp/test/zend/bad/ext-spl/bug61418.php
new file mode 100644
index 000000000..5bc83f8c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61418.php
@@ -0,0 +1,18 @@
+ $file)
+{
+}
+unset($regexpIterator);
+unset($fileIterator);
+
+$dirIterator = new DirectoryIterator(__DIR__);
+$regexpIterator2 = new RegexIterator($dirIterator, '#.*#');
+foreach ($dirIterator as $key => $file)
+{
+}
+unset($regexpIterator2);
+unset($dirIterator);
+?>
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61418.php.expectf b/hphp/test/zend/bad/ext-spl/bug61418.php.expectf
new file mode 100644
index 000000000..17026517c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61418.php.expectf
@@ -0,0 +1 @@
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61453.php b/hphp/test/zend/bad/ext-spl/bug61453.php
new file mode 100644
index 000000000..3981ae04e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61453.php
@@ -0,0 +1,14 @@
+
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61453.php.expectf b/hphp/test/zend/bad/ext-spl/bug61453.php.expectf
new file mode 100644
index 000000000..17026517c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61453.php.expectf
@@ -0,0 +1 @@
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61527.php b/hphp/test/zend/bad/ext-spl/bug61527.php
new file mode 100644
index 000000000..7080d9e48
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61527.php
@@ -0,0 +1,63 @@
+getIterator();
+
+/* testing empty array, should no notice at all */
+$ai->next();
+var_dump($ai->key());
+var_dump($ai->current());
+
+/* testing array changing */
+$ao2 = new ArrayObject(array(1 => 1, 2, 3, 4, 5));
+$ai2 = $ao2->getIterator();
+
+$ao2->offsetUnset($ai2->key());
+$ai2->next();
+
+/* now point to 2 */
+$ao2->offsetUnset($ai2->key());
+var_dump($ai2->key());
+
+/* now point to 3 */
+$ao2->offsetUnset($ai2->key());
+var_dump($ai2->current());
+
+$ai2->next();
+var_dump($ai2->key());
+var_dump($ai2->current());
+
+/* should be at the end and no notice */
+$ai2->next();
+var_dump($ai2->key());
+var_dump($ai2->current());
+
+$ai2->rewind();
+$ai2->next();
+$ai2->next();
+/* should reached the end */
+var_dump($ai2->next());
+var_dump($ai2->key());
+
+/* testing RecursiveArrayIterator */
+$ao3 = new ArrayObject(array(), NULL, 'RecursiveArrayIterator');
+$ai3 = $ao3->getIterator();
+
+var_dump($ai3->getChildren());
+
+$ao4 = new ArrayObject(array(1, 2), NULL, 'RecursiveArrayIterator');
+$ai4 = $ao4->getIterator();
+
+$ai4->next();
+$ai4->next();
+$ai4->next();
+var_dump($ai4->hasChildren());
+
+$ai4->rewind();
+$ao4->offsetUnset($ai4->key());
+var_dump($ai4->hasChildren());
+
+$ao4->offsetUnset($ai4->key());
+var_dump($ai4->getChildren());
+?>
+==DONE==
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug61527.php.expectf b/hphp/test/zend/bad/ext-spl/bug61527.php.expectf
new file mode 100644
index 000000000..32cd5f7c3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug61527.php.expectf
@@ -0,0 +1,20 @@
+NULL
+NULL
+HipHop Notice: %a
+HipHop Notice: %a
+NULL
+HipHop Notice: %a
+NULL
+int(5)
+int(5)
+NULL
+NULL
+NULL
+NULL
+NULL
+bool(false)
+HipHop Notice: %a
+bool(false)
+HipHop Notice: %a
+NULL
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62073.php b/hphp/test/zend/bad/ext-spl/bug62073.php
new file mode 100644
index 000000000..fcf0dd72c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62073.php
@@ -0,0 +1,14 @@
+insert(42);
+foreach ($heap as $key => $value) {
+ var_dump($key);
+ var_dump($value);
+ break;
+}
+
+$heap = new SplMaxHeap();
+$heap->insert(42);
+var_dump($heap->key());
+var_dump($heap->current());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62073.php.expectf b/hphp/test/zend/bad/ext-spl/bug62073.php.expectf
new file mode 100644
index 000000000..2ed9e3742
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62073.php.expectf
@@ -0,0 +1,4 @@
+int(0)
+int(42)
+int(0)
+int(42)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62262.php b/hphp/test/zend/bad/ext-spl/bug62262.php
new file mode 100644
index 000000000..c8e41064e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62262.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62262.php.expectf b/hphp/test/zend/bad/ext-spl/bug62262.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62262.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62433.php b/hphp/test/zend/bad/ext-spl/bug62433.php
new file mode 100644
index 000000000..438cd6f3e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62433.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62433.php.expectf b/hphp/test/zend/bad/ext-spl/bug62433.php.expectf
new file mode 100644
index 000000000..6b1a0e43b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62433.php.expectf
@@ -0,0 +1,4 @@
+bool(true)
+bool(true)
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62904.php b/hphp/test/zend/bad/ext-spl/bug62904.php
new file mode 100644
index 000000000..2365f7744
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62904.php
@@ -0,0 +1,14 @@
+getMessage());
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62904.php.expectf b/hphp/test/zend/bad/ext-spl/bug62904.php.expectf
new file mode 100644
index 000000000..df95594cb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62904.php.expectf
@@ -0,0 +1 @@
+string(40) "The instance wasn't initialized properly"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug62978.php b/hphp/test/zend/bad/ext-spl/bug62978.php
new file mode 100644
index 000000000..830acaf38
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug62978.php
@@ -0,0 +1,23 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug63680.php.expectf b/hphp/test/zend/bad/ext-spl/bug63680.php.expectf
new file mode 100644
index 000000000..c4f25cd82
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug63680.php.expectf
@@ -0,0 +1 @@
+int(2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64023.php b/hphp/test/zend/bad/ext-spl/bug64023.php
new file mode 100644
index 000000000..262d524f7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64023.php
@@ -0,0 +1,13 @@
+__toString(), $a->__toString() . '', "\n";
+
+// Does not work - outputs parent::__toString()
+echo $a . '', "\n";
diff --git a/hphp/test/zend/bad/ext-spl/bug64023.php.expectf b/hphp/test/zend/bad/ext-spl/bug64023.php.expectf
new file mode 100644
index 000000000..4c79f04d6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64023.php.expectf
@@ -0,0 +1,2 @@
+-expected- -expected- -expected-
+ -expected-
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64106.php b/hphp/test/zend/bad/ext-spl/bug64106.php
new file mode 100644
index 000000000..f0202409a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64106.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64106.php.expectf b/hphp/test/zend/bad/ext-spl/bug64106.php.expectf
new file mode 100644
index 000000000..0136aab3f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64106.php.expectf
@@ -0,0 +1 @@
+HipHop Notice: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64228.php b/hphp/test/zend/bad/ext-spl/bug64228.php
new file mode 100644
index 000000000..22abaf81e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64228.php
@@ -0,0 +1,15 @@
+ $value) {
+ $dirs[] = $value->getFileName();
+}
+
+@rmdir($empty_dir);
+
+sort($dirs);
+print_r($dirs);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64228.php.expectf b/hphp/test/zend/bad/ext-spl/bug64228.php.expectf
new file mode 100644
index 000000000..712bb4032
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64228.php.expectf
@@ -0,0 +1,5 @@
+Array
+(
+ [0] => .
+ [1] => ..
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64264.php b/hphp/test/zend/bad/ext-spl/bug64264.php
new file mode 100644
index 000000000..d27f45621
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64264.php
@@ -0,0 +1,20 @@
+setSize(2);
+$myFixedArr[1] = 'bar';
+$myFixedArr->setSize(5);
+$array = $myFixedArr->toArray();
+$array[2] = "ERROR";
+$array[3] = "ERROR";
+$array[4] = "ERROR";
+unset($array[4]);
+$myFixedArr->setSize(2);
+
+print_r($myFixedArr->toArray());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/bug64264.php.expectf b/hphp/test/zend/bad/ext-spl/bug64264.php.expectf
new file mode 100644
index 000000000..feb7e97cc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/bug64264.php.expectf
@@ -0,0 +1,5 @@
+Array
+(
+ [0] => foo
+ [1] => bar
+)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_implements_variation.php b/hphp/test/zend/bad/ext-spl/class_implements_variation.php
new file mode 100644
index 000000000..92212af86
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_implements_variation.php
@@ -0,0 +1,25 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_implements_variation.php.expectf b/hphp/test/zend/bad/ext-spl/class_implements_variation.php.expectf
new file mode 100644
index 000000000..18c3109f0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_implements_variation.php.expectf
@@ -0,0 +1,14 @@
+*** Testing class_implements() : variation ***
+--- testing no interfaces ---
+array(0) {
+}
+array(0) {
+}
+
+--- testing autoload ---
+attempting to autoload non-existent
+HipHop Warning: %a
+bool(false)
+HipHop Warning: %a
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_implements_variation1.php b/hphp/test/zend/bad/ext-spl/class_implements_variation1.php
new file mode 100644
index 000000000..93dc0d56c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_implements_variation1.php
@@ -0,0 +1,111 @@
+ 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ //resource
+ 'resource' => $res,
+);
+
+// loop through each element of the array for pattern
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( class_implements($value, $autoload) );
+};
+
+fclose($res);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_implements_variation1.php.expectf b/hphp/test/zend/bad/ext-spl/class_implements_variation1.php.expectf
new file mode 100644
index 000000000..4c119762c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_implements_variation1.php.expectf
@@ -0,0 +1,106 @@
+*** Testing class_implements() : variation ***
+
+--int 0--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - class_implements(): Class does not exist and could not be loaded, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - class_implements(): Class does not exist and could not be loaded, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+array(0) {
+}
+
+--instance of classWithoutToString--
+array(0) {
+}
+
+--undefined var--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - class_implements(): object or string expected, %s(%d)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_implements_variation2.php b/hphp/test/zend/bad/ext-spl/class_implements_variation2.php
new file mode 100644
index 000000000..8e9b64aef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_implements_variation2.php
@@ -0,0 +1,111 @@
+ 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ //resource
+ 'resource' => $res,
+);
+
+// loop through each element of the array for pattern
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( class_implements($class, $value) );
+};
+
+fclose($res);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_implements_variation2.php.expectf b/hphp/test/zend/bad/ext-spl/class_implements_variation2.php.expectf
new file mode 100644
index 000000000..fa3d9f6f6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_implements_variation2.php.expectf
@@ -0,0 +1,144 @@
+*** Testing class_implements() : variation ***
+
+--int 0--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--int 1--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--int 12345--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--int -12345--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--float 10.5--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--float -10.5--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--float 12.3456789000e10--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--float -12.3456789000e10--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--float .5--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--empty array--
+Error: 2 - class_implements() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - class_implements() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - class_implements() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - class_implements() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--lowercase null--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--lowercase true--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--lowercase false--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--uppercase TRUE--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--uppercase FALSE--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--empty string DQ--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--empty string SQ--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--instance of classWithToString--
+Error: 2 - class_implements() expects parameter 2 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - class_implements() expects parameter 2 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--unset var--
+array(1) {
+ ["Traversable"]=>
+ string(11) "Traversable"
+}
+
+--resource--
+Error: 2 - class_implements() expects parameter 2 to be boolean, resource given, %s(%d)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_uses_variation.php b/hphp/test/zend/bad/ext-spl/class_uses_variation.php
new file mode 100644
index 000000000..0aa9462ca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_uses_variation.php
@@ -0,0 +1,25 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_uses_variation.php.expectf b/hphp/test/zend/bad/ext-spl/class_uses_variation.php.expectf
new file mode 100644
index 000000000..ab3ba12ac
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_uses_variation.php.expectf
@@ -0,0 +1,14 @@
+*** Testing class_uses() : variation ***
+--- testing no traits ---
+array(0) {
+}
+array(0) {
+}
+
+--- testing autoload ---
+attempting to autoload non-existent
+HipHop Warning: %a
+bool(false)
+HipHop Warning: %a
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_uses_variation1.php b/hphp/test/zend/bad/ext-spl/class_uses_variation1.php
new file mode 100644
index 000000000..6c772b413
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_uses_variation1.php
@@ -0,0 +1,111 @@
+ 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ //resource
+ 'resource' => $res,
+);
+
+// loop through each element of the array for pattern
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( class_uses($value, $autoload) );
+};
+
+fclose($res);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_uses_variation1.php.expectf b/hphp/test/zend/bad/ext-spl/class_uses_variation1.php.expectf
new file mode 100644
index 000000000..261a7e5a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_uses_variation1.php.expectf
@@ -0,0 +1,106 @@
+*** Testing class_uses() : variation ***
+
+--int 0--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - class_uses(): Class does not exist and could not be loaded, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - class_uses(): Class does not exist and could not be loaded, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+array(0) {
+}
+
+--instance of classWithoutToString--
+array(0) {
+}
+
+--undefined var--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - class_uses(): object or string expected, %s(%d)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_uses_variation2.php b/hphp/test/zend/bad/ext-spl/class_uses_variation2.php
new file mode 100644
index 000000000..6598e9962
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_uses_variation2.php
@@ -0,0 +1,113 @@
+ 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ //resource
+ 'resource' => $res,
+);
+
+// loop through each element of the array for pattern
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( class_uses($class, $value) );
+};
+
+fclose($res);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/class_uses_variation2.php.expectf b/hphp/test/zend/bad/ext-spl/class_uses_variation2.php.expectf
new file mode 100644
index 000000000..79e8d36da
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/class_uses_variation2.php.expectf
@@ -0,0 +1,144 @@
+*** Testing class_uses() : variation ***
+
+--int 0--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--int 1--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--int 12345--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--int -12345--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--float 10.5--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--float -10.5--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--float 12.3456789000e10--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--float -12.3456789000e10--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--float .5--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--empty array--
+Error: 2 - class_uses() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - class_uses() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - class_uses() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - class_uses() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--lowercase null--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--lowercase true--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--lowercase false--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--uppercase TRUE--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--uppercase FALSE--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--empty string DQ--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--empty string SQ--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--instance of classWithToString--
+Error: 2 - class_uses() expects parameter 2 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - class_uses() expects parameter 2 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--unset var--
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+
+--resource--
+Error: 2 - class_uses() expects parameter 2 to be boolean, resource given, %s(%d)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/countable_class_basic1.php b/hphp/test/zend/bad/ext-spl/countable_class_basic1.php
new file mode 100644
index 000000000..905421470
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/countable_class_basic1.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/countable_class_basic1.php.expectf b/hphp/test/zend/bad/ext-spl/countable_class_basic1.php.expectf
new file mode 100644
index 000000000..15aa50319
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/countable_class_basic1.php.expectf
@@ -0,0 +1,22 @@
+Interface [ interface Countable ] {
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [1] {
+ Method [ abstract public method count ] {
+
+ - Parameters [0] {
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_001.php b/hphp/test/zend/bad/ext-spl/dit_001.php
new file mode 100644
index 000000000..45e822e22
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_001.php
@@ -0,0 +1,8 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_001.php.expectf b/hphp/test/zend/bad/ext-spl/dit_001.php.expectf
new file mode 100644
index 000000000..239cc71d5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_001.php.expectf
@@ -0,0 +1,13 @@
+object(DirectoryIterator)#%d (4) {
+ %s"pathName"%s"SplFileInfo":private]=>
+ %s(%d) ".%c%s"
+ %s"fileName"%s"SplFileInfo":private]=>
+ %s(%d) "%s"
+ %s"glob"%s"DirectoryIterator":private]=>
+ bool(false)
+ %s"subPathName"%s"RecursiveDirectoryIterator":private]=>
+ %s(0) ""
+}
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_001_noglob.php b/hphp/test/zend/bad/ext-spl/dit_001_noglob.php
new file mode 100644
index 000000000..45e822e22
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_001_noglob.php
@@ -0,0 +1,8 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_001_noglob.php.expectf b/hphp/test/zend/bad/ext-spl/dit_001_noglob.php.expectf
new file mode 100644
index 000000000..4bc208c34
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_001_noglob.php.expectf
@@ -0,0 +1,11 @@
+object(DirectoryIterator)#%d (3) {
+ %s"pathName"%s"SplFileInfo":private]=>
+ %s(%d) ".%c%s"
+ %s"fileName"%s"SplFileInfo":private]=>
+ %s(%d) "%s"
+ %s"subPathName"%s"RecursiveDirectoryIterator":private]=>
+ %s(0) ""
+}
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_002.php b/hphp/test/zend/bad/ext-spl/dit_002.php
new file mode 100644
index 000000000..ffd2491ba
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_002.php
@@ -0,0 +1,41 @@
+ 0,
+ 'FilesystemIterator' => 1,
+ 'RecursiveDirectoryIterator' => 1,
+ 'GlobIterator' => 1,
+);
+
+foreach ($classes as $class => $flags) {
+ echo "===$class===\n";
+ $ref = new ReflectionClass($class);
+ $obj = $ref->newInstance('glob://*');
+ echo get_class($obj->current()) . "\n";
+ if ($flags)
+ {
+ var_dump($obj->getFlags());
+ $flags = array(
+ FilesystemIterator::CURRENT_AS_FILEINFO => 0,
+ FilesystemIterator::CURRENT_AS_SELF => 0,
+ FilesystemIterator::CURRENT_AS_PATHNAME => 1,
+ );
+ foreach($flags as $flag => $isstring) {
+ $obj->setFlags($flag);
+ $obj->rewind();
+ var_dump($obj->getFlags());
+ if ($isstring) {
+ $val = $obj->current();
+ if (is_string($val)) {
+ var_dump(true);
+ } else {
+ var_dump($val);
+ }
+ } else {
+ echo get_class($obj->current()) . "\n";
+ }
+ }
+ }
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_002.php.expectf b/hphp/test/zend/bad/ext-spl/dit_002.php.expectf
new file mode 100644
index 000000000..dc23c8c93
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_002.php.expectf
@@ -0,0 +1,30 @@
+===DirectoryIterator===
+DirectoryIterator
+===FilesystemIterator===
+SplFileInfo
+int(%d)
+int(0)
+SplFileInfo
+int(16)
+FilesystemIterator
+int(32)
+bool(true)
+===RecursiveDirectoryIterator===
+SplFileInfo
+int(0)
+int(0)
+SplFileInfo
+int(16)
+RecursiveDirectoryIterator
+int(32)
+bool(true)
+===GlobIterator===
+SplFileInfo
+int(0)
+int(0)
+SplFileInfo
+int(16)
+GlobIterator
+int(32)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_003.php b/hphp/test/zend/bad/ext-spl/dit_003.php
new file mode 100644
index 000000000..659255a1c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_003.php
@@ -0,0 +1,9 @@
+ 0);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_003.php.expectf b/hphp/test/zend/bad/ext-spl/dit_003.php.expectf
new file mode 100644
index 000000000..e7c042967
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_003.php.expectf
@@ -0,0 +1,2 @@
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_005.php b/hphp/test/zend/bad/ext-spl/dit_005.php
new file mode 100644
index 000000000..bc959dda6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_005.php
@@ -0,0 +1,13 @@
+key() == $b->key());
+$a->next();
+$a->next();
+$a->next();
+$c = clone $a;
+var_dump((string)$c == (string)$a);
+var_dump($a->key() == $c->key());
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_005.php.expectf b/hphp/test/zend/bad/ext-spl/dit_005.php.expectf
new file mode 100644
index 000000000..9780468b1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_005.php.expectf
@@ -0,0 +1,5 @@
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_006.php b/hphp/test/zend/bad/ext-spl/dit_006.php
new file mode 100644
index 000000000..66fd3f168
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_006.php
@@ -0,0 +1,39 @@
+seek(2);
+
+$n = 0;
+while ($di->valid()) {
+ $n++;
+ $di->next();
+}
+
+echo "With seek(2) we get $n\n";
+$di->seek(0);
+
+$m = 0;
+while ($di->valid()) {
+ $m++;
+ $di->next();
+}
+echo "With seek(0) we get $m\n";
+
+$o = 0;
+$di->rewind();
+while ($di->valid()) {
+ $o++;
+ $di->next();
+}
+
+echo "Without seek we get $o\n";
+
+$p = 0;
+$di->seek($o+1);
+while ($di->valid()) {
+ $p++;
+ $di->next();
+}
+
+var_dump($n !== $m, $m === $o, $p === 0);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dit_006.php.expectf b/hphp/test/zend/bad/ext-spl/dit_006.php.expectf
new file mode 100644
index 000000000..eee4bb719
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dit_006.php.expectf
@@ -0,0 +1,7 @@
+With seek(2) we get %d
+With seek(0) we get %d
+Without seek we get %d
+bool(true)
+bool(true)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_001.php b/hphp/test/zend/bad/ext-spl/dllist_001.php
new file mode 100644
index 000000000..ab5d4081c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_001.php
@@ -0,0 +1,47 @@
+pop();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ $dll->shift();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+// data consistency
+$a = 2;
+$dll->push($a);
+echo $dll->pop()."\n";
+
+$a = 2;
+$dll->unshift($a);
+echo $dll->shift()."\n";
+
+// peakable
+$dll->push(1);
+$dll->push(2);
+echo $dll->top()."\n";
+echo $dll->bottom()."\n";
+$dll->pop();
+$dll->pop();
+
+// countable
+$dll->push(NULL);
+$dll->push(NULL);
+echo count($dll)."\n";
+echo $dll->count()."\n";
+var_dump($dll->pop());
+var_dump($dll->pop());
+
+// clonable
+$dll->push(2);
+$dll_clone = clone $dll;
+$dll_clone->pop();
+echo count($dll)."\n";
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_001.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_001.php.expectf
new file mode 100644
index 000000000..5d92e16c3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_001.php.expectf
@@ -0,0 +1,12 @@
+Exception: Can't pop from an empty datastructure
+Exception: Can't shift from an empty datastructure
+2
+2
+2
+1
+2
+2
+NULL
+NULL
+1
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_002.php b/hphp/test/zend/bad/ext-spl/dllist_002.php
new file mode 100644
index 000000000..be04bb764
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_002.php
@@ -0,0 +1,34 @@
+push(2);
+$dll->push(3);
+$dll->push(4);
+
+$dll2 = clone $dll;
+
+// std iterator
+foreach($dll as $k=>$v) {
+ echo "$k=>$v\n";
+ // inner iterator
+ foreach($dll as $k2=>$v2) {
+ echo "->$k2=>$v2\n";
+ }
+}
+
+echo "# deleted\n";
+
+foreach($dll as $k=>$v) {
+ echo "$k=>$v\n";
+ unset($dll);
+}
+
+echo "# while popping\n";
+
+foreach($dll2 as $k=>$v) {
+ echo "$k=>$v\n";
+ echo "popped ".$dll2->pop()."\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_002.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_002.php.expectf
new file mode 100644
index 000000000..9fbecb12b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_002.php.expectf
@@ -0,0 +1,22 @@
+0=>2
+->0=>2
+->1=>3
+->2=>4
+1=>3
+->0=>2
+->1=>3
+->2=>4
+2=>4
+->0=>2
+->1=>3
+->2=>4
+# deleted
+0=>2
+1=>3
+2=>4
+# while popping
+0=>2
+popped 4
+1=>3
+popped 3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_003.php b/hphp/test/zend/bad/ext-spl/dllist_003.php
new file mode 100644
index 000000000..dde838592
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_003.php
@@ -0,0 +1,27 @@
+push(2);
+$dll->push(3);
+$dll->push(4);
+
+$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+
+foreach ($dll as $k => $v) {
+ echo "$k=>$v\n";
+}
+
+$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+foreach ($dll as $k => $v) {
+ echo "$k=>$v\n";
+}
+
+$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
+var_dump($dll->count());
+foreach ($dll as $k => $v) {
+ echo "$k=>$v\n";
+}
+var_dump($dll->count());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_003.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_003.php.expectf
new file mode 100644
index 000000000..2f1448cf5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_003.php.expectf
@@ -0,0 +1,12 @@
+2=>4
+1=>3
+0=>2
+0=>2
+1=>3
+2=>4
+int(3)
+0=>2
+0=>3
+0=>4
+int(0)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_004.php b/hphp/test/zend/bad/ext-spl/dllist_004.php
new file mode 100644
index 000000000..198fea64c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_004.php
@@ -0,0 +1,45 @@
+pop();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ $stack->shift();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+// data consistency
+$a = 2;
+$stack->push($a);
+echo $stack->pop()."\n";
+
+// peakable
+$stack->push(1);
+$stack->push(2);
+echo $stack->top()."\n";
+
+// iterable
+foreach ($stack as $elem) {
+ echo "[$elem]\n";
+}
+
+// countable
+$stack->push(NULL);
+$stack->push(NULL);
+echo count($stack)."\n";
+echo $stack->count()."\n";
+var_dump($stack->pop());
+var_dump($stack->pop());
+
+// clonable
+$stack->push(2);
+$stack_clone = clone $stack;
+$stack_clone->pop();
+echo count($stack)."\n";
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_004.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_004.php.expectf
new file mode 100644
index 000000000..7d39b8cbf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_004.php.expectf
@@ -0,0 +1,12 @@
+Exception: Can't pop from an empty datastructure
+Exception: Can't shift from an empty datastructure
+2
+2
+[2]
+[1]
+4
+4
+NULL
+NULL
+3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_005.php b/hphp/test/zend/bad/ext-spl/dllist_005.php
new file mode 100644
index 000000000..82c4c4202
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_005.php
@@ -0,0 +1,45 @@
+dequeue();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ $queue->shift();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+// data consistency
+$a = 2;
+$queue->enqueue($a);
+echo $queue->dequeue()."\n";
+
+// peakable
+$queue->enqueue(1);
+$queue->enqueue(2);
+echo $queue->top()."\n";
+
+// iterable
+foreach ($queue as $elem) {
+ echo "[$elem]\n";
+}
+
+// countable
+$queue->enqueue(NULL);
+$queue->enqueue(NULL);
+echo count($queue)."\n";
+echo $queue->count()."\n";
+var_dump($queue->dequeue());
+var_dump($queue->dequeue());
+
+// clonable
+$queue->enqueue(2);
+$queue_clone = clone $queue;
+$queue_clone->dequeue();
+echo count($queue)."\n";
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_005.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_005.php.expectf
new file mode 100644
index 000000000..bff61fb61
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_005.php.expectf
@@ -0,0 +1,12 @@
+Exception: Can't shift from an empty datastructure
+Exception: Can't shift from an empty datastructure
+2
+2
+[1]
+[2]
+4
+4
+int(1)
+int(2)
+3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_006.php b/hphp/test/zend/bad/ext-spl/dllist_006.php
new file mode 100644
index 000000000..5745a1a91
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_006.php
@@ -0,0 +1,46 @@
+push(1);
+$a->push(2);
+$a->push(3);
+
+$a[] = "foo";
+$a[3] = 4;
+
+var_dump($a[0]);
+var_dump($a[1]);
+var_dump($a[2]);
+var_dump($a[3]);
+
+echo "Unsetting..\n";
+var_dump($a[2]);
+unset($a[2]);
+var_dump($a[2]);
+
+
+try {
+ var_dump($a["1"]);
+} catch (OutOfRangeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ var_dump($a["a"]);
+} catch (OutOfRangeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ var_dump($a["0"]);
+} catch (OutOfRangeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ var_dump($a["9"]);
+} catch (OutOfRangeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_006.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_006.php.expectf
new file mode 100644
index 000000000..bf750bf73
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_006.php.expectf
@@ -0,0 +1,12 @@
+int(1)
+int(2)
+int(3)
+int(4)
+Unsetting..
+int(3)
+int(4)
+int(2)
+Exception: Offset invalid or out of range
+int(1)
+Exception: Offset invalid or out of range
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_007.php b/hphp/test/zend/bad/ext-spl/dllist_007.php
new file mode 100644
index 000000000..f94aa14b1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_007.php
@@ -0,0 +1,13 @@
+push(1);
+$a->push(2);
+$a->push(3);
+
+$a->rewind();
+while ($a->valid()) {
+ var_dump($a->current(), $a->next());
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_007.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_007.php.expectf
new file mode 100644
index 000000000..b774763ff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_007.php.expectf
@@ -0,0 +1,7 @@
+int(1)
+NULL
+int(2)
+NULL
+int(3)
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_008.php b/hphp/test/zend/bad/ext-spl/dllist_008.php
new file mode 100644
index 000000000..8954fada0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_008.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_008.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_008.php.expectf
new file mode 100644
index 000000000..e14ca2b76
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_008.php.expectf
@@ -0,0 +1,2 @@
+int(2)
+int(-2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_010.php b/hphp/test/zend/bad/ext-spl/dllist_010.php
new file mode 100644
index 000000000..c41b65d40
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_010.php
@@ -0,0 +1,23 @@
+push(1);
+$dll->push(2);
+$dll->push(3);
+$dll->push(4);
+
+
+$dll->rewind();
+$dll->prev();
+var_dump($dll->current());
+$dll->rewind();
+var_dump($dll->current());
+$dll->next();
+var_dump($dll->current());
+$dll->next();
+$dll->next();
+var_dump($dll->current());
+$dll->prev();
+var_dump($dll->current());
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_010.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_010.php.expectf
new file mode 100644
index 000000000..2436a6894
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_010.php.expectf
@@ -0,0 +1,6 @@
+NULL
+int(1)
+int(2)
+int(4)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_011.php b/hphp/test/zend/bad/ext-spl/dllist_011.php
new file mode 100644
index 000000000..90a5df591
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_011.php
@@ -0,0 +1,7 @@
+rewind();
+$dll->prev();
+var_dump($dll->current());
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_011.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_011.php.expectf
new file mode 100644
index 000000000..887e68da8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_011.php.expectf
@@ -0,0 +1,2 @@
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_012.php b/hphp/test/zend/bad/ext-spl/dllist_012.php
new file mode 100644
index 000000000..e643d2408
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_012.php
@@ -0,0 +1,7 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_012.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_012.php.expectf
new file mode 100644
index 000000000..95c369e79
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_012.php.expectf
@@ -0,0 +1,10 @@
+object(SplDoublyLinkedList)#%d (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(0)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(1) {
+ [0]=>
+ *RECURSION*
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_memleak.php b/hphp/test/zend/bad/ext-spl/dllist_memleak.php
new file mode 100644
index 000000000..3910a7895
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_memleak.php
@@ -0,0 +1,17 @@
+push(1);
+$dll->push(2);
+$dll->push(3);
+$dll->push(4);
+
+
+$dll->rewind();
+echo $dll->current()."\n";
+$dll->next();
+$dll->next();
+echo $dll->current()."\n";
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/dllist_memleak.php.expectf b/hphp/test/zend/bad/ext-spl/dllist_memleak.php.expectf
new file mode 100644
index 000000000..822830181
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/dllist_memleak.php.expectf
@@ -0,0 +1,3 @@
+1
+3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_001.php b/hphp/test/zend/bad/ext-spl/fileobject_001.php
new file mode 100644
index 000000000..1a40bb3dd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_001.php
@@ -0,0 +1,39 @@
+key());
+var_dump($o->current());
+$o->setFlags(SplFileObject::DROP_NEW_LINE);
+var_dump($o->key());
+var_dump($o->current());
+var_dump($o->key());
+$o->next();
+var_dump($o->key());
+var_dump($o->current());
+var_dump($o->key());
+$o->rewind();
+var_dump($o->key());
+var_dump($o->current());
+var_dump($o->key());
+$o->seek(4);
+var_dump($o->key());
+var_dump($o->current());
+var_dump($o->key());
+
+echo "===A===\n";
+foreach($o as $n => $l)
+{
+ var_dump($n, $l);
+}
+
+echo "===B===\n";
+$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001b.txt');
+$o->setFlags(SplFileObject::DROP_NEW_LINE);
+foreach($o as $n => $l)
+{
+ var_dump($n, $l);
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_001.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_001.php.expectf
new file mode 100644
index 000000000..81a553b15
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_001.php.expectf
@@ -0,0 +1,45 @@
+int(0)
+string(2) "0
+"
+int(0)
+string(2) "0
+"
+int(0)
+int(1)
+string(1) "1"
+int(1)
+int(0)
+string(1) "0"
+int(0)
+int(4)
+string(1) "4"
+int(4)
+===A===
+int(0)
+string(1) "0"
+int(1)
+string(1) "1"
+int(2)
+string(1) "2"
+int(3)
+string(1) "3"
+int(4)
+string(1) "4"
+int(5)
+string(1) "5"
+int(6)
+string(0) ""
+===B===
+int(0)
+string(1) "0"
+int(1)
+string(1) "1"
+int(2)
+string(1) "2"
+int(3)
+string(1) "3"
+int(4)
+string(1) "4"
+int(5)
+string(1) "5"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_002.php b/hphp/test/zend/bad/ext-spl/fileobject_002.php
new file mode 100644
index 000000000..ac49b08ea
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_002.php
@@ -0,0 +1,25 @@
+key());
+ while(($c = $o->fgetc()) !== false)
+ {
+ var_dump($o->key(), $c, $o->eof());
+ }
+ echo "===EOF?===\n";
+ var_dump($o->eof());
+ var_dump($o->key());
+ var_dump($o->eof());
+}
+
+test('fileobject_001a.txt');
+test('fileobject_001b.txt');
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_002.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_002.php.expectf
new file mode 100644
index 000000000..966bdd2cb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_002.php.expectf
@@ -0,0 +1,93 @@
+===fileobject_001a.txt===
+int(0)
+int(0)
+string(1) "0"
+bool(false)
+int(1)
+string(1) "
+"
+bool(false)
+int(1)
+string(1) "1"
+bool(false)
+int(2)
+string(1) "
+"
+bool(false)
+int(2)
+string(1) "2"
+bool(false)
+int(3)
+string(1) "
+"
+bool(false)
+int(3)
+string(1) "3"
+bool(false)
+int(4)
+string(1) "
+"
+bool(false)
+int(4)
+string(1) "4"
+bool(false)
+int(5)
+string(1) "
+"
+bool(false)
+int(5)
+string(1) "5"
+bool(false)
+int(6)
+string(1) "
+"
+bool(false)
+===EOF?===
+bool(true)
+int(6)
+bool(true)
+===fileobject_001b.txt===
+int(0)
+int(0)
+string(1) "0"
+bool(false)
+int(1)
+string(1) "
+"
+bool(false)
+int(1)
+string(1) "1"
+bool(false)
+int(2)
+string(1) "
+"
+bool(false)
+int(2)
+string(1) "2"
+bool(false)
+int(3)
+string(1) "
+"
+bool(false)
+int(3)
+string(1) "3"
+bool(false)
+int(4)
+string(1) "
+"
+bool(false)
+int(4)
+string(1) "4"
+bool(false)
+int(5)
+string(1) "
+"
+bool(false)
+int(5)
+string(1) "5"
+bool(false)
+===EOF?===
+bool(true)
+int(5)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_003.php b/hphp/test/zend/bad/ext-spl/fileobject_003.php
new file mode 100644
index 000000000..bbc1a5621
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_003.php
@@ -0,0 +1,47 @@
+getPathname() == $c->getPathname());
+
+ try {
+ $f = new SplFileObject($name);
+ var_dump($name);
+ var_dump($f->getPathName());
+ $l = substr($f->getPathName(), -1);
+ var_dump($l != '/' && $l != '\\' && $l == $lc);
+ var_dump($f->getFileName());
+ $l = substr($f->getFileName(), -1);
+ var_dump($l != '/' && $l != '\\' && $l == $lc);
+ var_dump($f->getPath());
+ $l = substr($f->getPath(), -1);
+ var_dump($l != '/' && $l != '\\' && $l == $lp);
+ } catch (LogicException $e) {
+ echo "LogicException: ".$e->getMessage()."\n";
+ }
+ try {
+ $fo = $o->openFile();
+ var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
+ } catch (LogicException $e) {
+ echo "LogicException: ".$e->getMessage()."\n";
+ }
+}
+
+test(dirname(__FILE__) . '/' . 'fileobject_001a.txt', 't', substr(dirname(__FILE__),-1));
+test(dirname(__FILE__) . '/', substr(dirname(__FILE__),-1), 'l');
+test(dirname(__FILE__), substr(dirname(__FILE__),-1), 'l');
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_003.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_003.php.expectf
new file mode 100644
index 000000000..0dcc6a883
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_003.php.expectf
@@ -0,0 +1,63 @@
+===0===
+object(SplFileInfo)#%d (2) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s"
+ ["fileName":"SplFileInfo":private]=>
+ string(%d) "fileobject_001a.txt"
+}
+object(SplFileInfo)#%d (2) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s"
+ ["fileName":"SplFileInfo":private]=>
+ string(%d) "fileobject_001a.txt"
+}
+bool(false)
+bool(true)
+bool(true)
+%s(%d) "%sfileobject_001a.txt"
+string(%d) "%sfileobject_001a.txt"
+bool(true)
+string(19) "fileobject_001a.txt"
+bool(true)
+string(%d) "%stests"
+bool(true)
+string(%d) "%sfileobject_001a.txt"
+string(19) "fileobject_001a.txt"
+string(%d) "%stests"
+===1===
+object(SplFileInfo)#%d (2) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s"
+ ["fileName":"SplFileInfo":private]=>
+ string(%d) "%s"
+}
+object(SplFileInfo)#%d (2) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s"
+ ["fileName":"SplFileInfo":private]=>
+ string(%d) "%s"
+}
+bool(false)
+bool(true)
+bool(true)
+LogicException: Cannot use SplFileObject with directories
+LogicException: Cannot use SplFileObject with directories
+===2===
+object(SplFileInfo)#%d (2) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s"
+ ["fileName":"SplFileInfo":private]=>
+ string(%d) "%s"
+}
+object(SplFileInfo)#%d (2) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s"
+ ["fileName":"SplFileInfo":private]=>
+ string(%d) "%s"
+}
+bool(false)
+bool(true)
+bool(true)
+LogicException: Cannot use SplFileObject with directories
+LogicException: Cannot use SplFileObject with directories
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_004.php b/hphp/test/zend/bad/ext-spl/fileobject_004.php
new file mode 100644
index 000000000..f29f361b0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_004.php
@@ -0,0 +1,14 @@
+getPath());
+var_dump($fo->getFilename());
+var_dump($fo->getRealPath());
+?>
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_004.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_004.php.expectf
new file mode 100644
index 000000000..76a972c04
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_004.php.expectf
@@ -0,0 +1,4 @@
+string(%d) "%sspl%stests"
+string(19) "fileobject_004.phpt"
+string(%d) "%sspl%stests%sfileobject_004.phpt"
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_005.php b/hphp/test/zend/bad/ext-spl/fileobject_005.php
new file mode 100644
index 000000000..c1270c65f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_005.php
@@ -0,0 +1,25 @@
+fwrite("blahlubba");
+var_dump($fo->ftruncate(4));
+
+$fo->rewind();
+var_dump($fo->fgets(8));
+
+$fo->rewind();
+$fo->fwrite("blahlubba");
+
+// This should throw a warning and return NULL since an argument is missing
+var_dump($fo->ftruncate());
+
+?>
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_005.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_005.php.expectf
new file mode 100644
index 000000000..09d6a5426
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_005.php.expectf
@@ -0,0 +1,6 @@
+bool(true)
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_checktype_basic.php b/hphp/test/zend/bad/ext-spl/fileobject_checktype_basic.php
new file mode 100644
index 000000000..3d96e7a7f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_checktype_basic.php
@@ -0,0 +1,6 @@
+isFile());
+var_dump($s->isDir());
+var_dump($s->isLink());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_checktype_basic.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_checktype_basic.php.expectf
new file mode 100644
index 000000000..7fef7dc93
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_checktype_basic.php.expectf
@@ -0,0 +1,3 @@
+bool(true)
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_getbasename_basic.php b/hphp/test/zend/bad/ext-spl/fileobject_getbasename_basic.php
new file mode 100644
index 000000000..160a41103
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_getbasename_basic.php
@@ -0,0 +1,5 @@
+getBasename();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_getbasename_basic.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_getbasename_basic.php.expectf
new file mode 100644
index 000000000..d912cba99
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_getbasename_basic.php.expectf
@@ -0,0 +1 @@
+fileobject_getbasename_basic.php
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_getcurrentline_basic.php b/hphp/test/zend/bad/ext-spl/fileobject_getcurrentline_basic.php
new file mode 100644
index 000000000..95069e2ac
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_getcurrentline_basic.php
@@ -0,0 +1,10 @@
+seek(1);
+echo $s->getCurrentLine();
+echo $s->getCurrentLine();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_getcurrentline_basic.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_getcurrentline_basic.php.expectf
new file mode 100644
index 000000000..a25faf952
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_getcurrentline_basic.php.expectf
@@ -0,0 +1,2 @@
+//line 3
+//line 4
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error001.php b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error001.php
new file mode 100644
index 000000000..6a39ff2fd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error001.php
@@ -0,0 +1,10 @@
+setMaxLineLen(-1);
+}
+catch (DomainException $e) {
+ echo 'DomainException thrown';
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error001.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error001.php.expectf
new file mode 100644
index 000000000..6058dacf6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error001.php.expectf
@@ -0,0 +1 @@
+DomainException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error002.php b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error002.php
new file mode 100644
index 000000000..5ceea2264
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error002.php
@@ -0,0 +1,5 @@
+setMaxLineLen();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error002.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error002.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error002.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error003.php b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error003.php
new file mode 100644
index 000000000..4df7dc4ff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error003.php
@@ -0,0 +1,5 @@
+setMaxLineLen('string');
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error003.php.expectf b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error003.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fileobject_setmaxlinelen_error003.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/filesystemiterator_flags.php b/hphp/test/zend/bad/ext-spl/filesystemiterator_flags.php
new file mode 100644
index 000000000..157fa17f6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/filesystemiterator_flags.php
@@ -0,0 +1,22 @@
+setFlags(FileSystemIterator::CURRENT_AS_SELF |
+ FileSystemIterator::KEY_AS_FILENAME |
+ FileSystemIterator::SKIP_DOTS |
+ FileSystemIterator::UNIX_PATHS);
+printflags($it);
+
+$it->setFlags(-1);
+printflags($it);
+
+function printflags($it) {
+ printf("%08X\n", $it->getFlags());
+ printf("%08X\n", ($it->getFlags() & FileSystemIterator::CURRENT_MODE_MASK));
+ printf("%08X\n", ($it->getFlags() & FileSystemIterator::KEY_MODE_MASK));
+ printf("%08X\n", ($it->getFlags() & FileSystemIterator::OTHER_MODE_MASK));
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/filesystemiterator_flags.php.expectf b/hphp/test/zend/bad/ext-spl/filesystemiterator_flags.php.expectf
new file mode 100644
index 000000000..15d95e279
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/filesystemiterator_flags.php.expectf
@@ -0,0 +1,12 @@
+00001000
+00000000
+00000000
+00001000
+00003110
+00000010
+00000100
+00003000
+00003FF0
+000000F0
+00000F00
+00003000
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_001.php b/hphp/test/zend/bad/ext-spl/fixedarray_001.php
new file mode 100644
index 000000000..519a6c571
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_001.php
@@ -0,0 +1,44 @@
+getMessage()."\n";
+}
+try {
+ var_dump($a["asdf"]);
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ unset($a[-1]);
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+$a->setSize(10);
+
+
+$a[0] = "value0";
+$a[1] = "value1";
+$a[2] = "value2";
+$a[3] = "value3";
+$ref = "value4";
+$ref2 =&$ref;
+$a[4] = $ref;
+$ref = "value5";
+
+unset($a[1]);
+
+var_dump($a[0], $a[2], $a[3], $a[4]);
+
+// countable
+
+var_dump(count($a), $a->getSize(), count($a) == $a->getSize());
+
+// clonable
+$b = clone $a;
+$a[0] = "valueNew";
+var_dump($b[0]);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_001.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_001.php.expectf
new file mode 100644
index 000000000..4a2ba9940
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_001.php.expectf
@@ -0,0 +1,12 @@
+Exception: Index invalid or out of range
+Exception: Index invalid or out of range
+Exception: Index invalid or out of range
+string(6) "value0"
+string(6) "value2"
+string(6) "value3"
+string(6) "value4"
+int(10)
+int(10)
+bool(true)
+string(6) "value0"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_002.php b/hphp/test/zend/bad/ext-spl/fixedarray_002.php
new file mode 100644
index 000000000..69e8c1112
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_002.php
@@ -0,0 +1,64 @@
+getMessage()."\n";
+}
+try {
+ var_dump($a["asdf"]);
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ unset($a[-1]);
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+$a->setSize(10);
+
+
+$a[0] = "value0";
+$a[1] = "value1";
+$a[2] = "value2";
+$a[3] = "value3";
+$ref = "value4";
+$ref2 =&$ref;
+$a[4] = $ref;
+$ref = "value5";
+
+unset($a[1]);
+var_dump(isset($a[1]), isset($a[2]), empty($a[1]), empty($a[2]));
+
+var_dump($a[0], $a[2], $a[3], $a[4]);
+
+// countable
+
+var_dump(count($a), $a->getSize(), count($a) == $a->getSize());
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_002.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_002.php.expectf
new file mode 100644
index 000000000..a7cc7cb18
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_002.php.expectf
@@ -0,0 +1,32 @@
+A::offsetSet
+Exception: Index invalid or out of range
+A::offsetGet
+Exception: Index invalid or out of range
+A::offsetUnset
+Exception: Index invalid or out of range
+A::offsetSet
+A::offsetSet
+A::offsetSet
+A::offsetSet
+A::offsetSet
+A::offsetUnset
+A::offsetExists
+A::offsetExists
+A::offsetExists
+A::offsetExists
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+A::offsetGet
+A::offsetGet
+A::offsetGet
+A::offsetGet
+string(6) "value0"
+string(6) "value2"
+string(6) "value3"
+string(6) "value4"
+int(2)
+int(10)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_003.php b/hphp/test/zend/bad/ext-spl/fixedarray_003.php
new file mode 100644
index 000000000..2c5612a06
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_003.php
@@ -0,0 +1,47 @@
+ $v) {
+ echo "$k => $v\n";
+}
+echo "==Child instance==\n";
+$a = new A(5);
+$a[0] = "a";
+$a[1] = "c";
+$a[2] = "d";
+$a[3] = "e";
+$a[4] = "f";
+foreach ($a as $k => $v) {
+ echo "$k => $v\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_003.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_003.php.expectf
new file mode 100644
index 000000000..1385537a3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_003.php.expectf
@@ -0,0 +1,35 @@
+==Direct instance==
+0 => a
+1 => c
+2 => d
+3 => e
+4 => f
+==Child instance==
+A::rewind
+A::valid
+A::current
+A::key
+0 => a
+A::next
+A::valid
+A::current
+A::key
+1 => c
+A::next
+A::valid
+A::current
+A::key
+2 => d
+A::next
+A::valid
+A::current
+A::key
+3 => e
+A::next
+A::valid
+A::current
+A::key
+4 => f
+A::next
+A::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_004.php b/hphp/test/zend/bad/ext-spl/fixedarray_004.php
new file mode 100644
index 000000000..3258975eb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_004.php
@@ -0,0 +1,12 @@
+getMessage());
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_004.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_004.php.expectf
new file mode 100644
index 000000000..3960d4d73
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_004.php.expectf
@@ -0,0 +1,2 @@
+string(29) "Index invalid or out of range"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_005.php b/hphp/test/zend/bad/ext-spl/fixedarray_005.php
new file mode 100644
index 000000000..fcc0b7185
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_005.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_005.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_005.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_005.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_006.php b/hphp/test/zend/bad/ext-spl/fixedarray_006.php
new file mode 100644
index 000000000..754d28bef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_006.php
@@ -0,0 +1,16 @@
+getMessage(), "\n";
+}
+
+print "ok\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_006.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_006.php.expectf
new file mode 100644
index 000000000..537e4178d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_006.php.expectf
@@ -0,0 +1,2 @@
+Index invalid or out of range
+ok
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_007.php b/hphp/test/zend/bad/ext-spl/fixedarray_007.php
new file mode 100644
index 000000000..c7402b8a3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_007.php
@@ -0,0 +1,20 @@
+getMessage(), "\n";
+}
+
+foreach ($a as $c) {
+ if ($c) {
+ echo $c->getSize(), "\n";
+ }
+}
+
+print "ok\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_007.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_007.php.expectf
new file mode 100644
index 000000000..9671fc167
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_007.php.expectf
@@ -0,0 +1,2 @@
+10
+ok
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_008.php b/hphp/test/zend/bad/ext-spl/fixedarray_008.php
new file mode 100644
index 000000000..abb846552
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_008.php
@@ -0,0 +1,22 @@
+getSize());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_008.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_008.php.expectf
new file mode 100644
index 000000000..fbc581e77
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_008.php.expectf
@@ -0,0 +1,4 @@
+int(3)
+int(2)
+int(3)
+int(3)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_009.php b/hphp/test/zend/bad/ext-spl/fixedarray_009.php
new file mode 100644
index 000000000..5442f6c1e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_009.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_009.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_009.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_009.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_010.php b/hphp/test/zend/bad/ext-spl/fixedarray_010.php
new file mode 100644
index 000000000..2244e4390
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_010.php
@@ -0,0 +1,40 @@
+setSize(2);
+$a->setSize(3);
+$a->setSize(0);
+
+$a = new SplFixedArray(0);
+$a->setSize(0);
+var_dump($a->getSize());
+
+$a = new SplFixedArray(10);
+$a->setSize(10);
+var_dump($a->getSize());
+
+$a = new SplFixedArray(1);
+$a->setSize(5);
+var_dump($a->getSize());
+
+$a = new SplFixedArray(20);
+$a->setSize(3);
+var_dump($a->getSize());
+
+$a = new SplFixedArray(3);
+
+$a[0] = "test";
+$a[1] = array(1,2,"blah");
+$a[2] = 1;
+$a[0] = "test";
+
+$a->setSize(0);
+var_dump($a->getSize());
+
+print "ok\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_010.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_010.php.expectf
new file mode 100644
index 000000000..0556daeba
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_010.php.expectf
@@ -0,0 +1,6 @@
+int(0)
+int(10)
+int(5)
+int(3)
+int(0)
+ok
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_011.php b/hphp/test/zend/bad/ext-spl/fixedarray_011.php
new file mode 100644
index 000000000..44ba03361
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_011.php
@@ -0,0 +1,9 @@
+setSize(NULL);
+
+print "ok\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_011.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_011.php.expectf
new file mode 100644
index 000000000..b5754e203
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_011.php.expectf
@@ -0,0 +1 @@
+ok
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_012.php b/hphp/test/zend/bad/ext-spl/fixedarray_012.php
new file mode 100644
index 000000000..56a28ab25
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_012.php
@@ -0,0 +1,13 @@
+getMessage(), "\n";
+}
+
+print "ok\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_012.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_012.php.expectf
new file mode 100644
index 000000000..537e4178d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_012.php.expectf
@@ -0,0 +1,2 @@
+Index invalid or out of range
+ok
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_013.php b/hphp/test/zend/bad/ext-spl/fixedarray_013.php
new file mode 100644
index 000000000..6da965155
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_013.php
@@ -0,0 +1,16 @@
+getMessage(), "\n";
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_013.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_013.php.expectf
new file mode 100644
index 000000000..4067f6ba2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_013.php.expectf
@@ -0,0 +1 @@
+Index invalid or out of range
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_014.php b/hphp/test/zend/bad/ext-spl/fixedarray_014.php
new file mode 100644
index 000000000..c8ee092ef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_014.php
@@ -0,0 +1,10 @@
+getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_014.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_014.php.expectf
new file mode 100644
index 000000000..4067f6ba2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_014.php.expectf
@@ -0,0 +1 @@
+Index invalid or out of range
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_015.php b/hphp/test/zend/bad/ext-spl/fixedarray_015.php
new file mode 100644
index 000000000..220bb6672
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_015.php
@@ -0,0 +1,38 @@
+getMessage(), "\n";
+}
+try {
+ $a[1] = 1;
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(count($a[1]));
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($a->getSize());
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ foreach ($a as $v) {
+ }
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($a->setSize(10));
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "Done\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_015.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_015.php.expectf
new file mode 100644
index 000000000..bf6a809d2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_015.php.expectf
@@ -0,0 +1,7 @@
+HipHop Warning: %a
+Index invalid or out of range
+Index invalid or out of range
+Index invalid or out of range
+int(0)
+bool(true)
+Done
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_016.php b/hphp/test/zend/bad/ext-spl/fixedarray_016.php
new file mode 100644
index 000000000..ff28e5fd2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_016.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_016.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_016.php.expectf
new file mode 100644
index 000000000..4fb9e437e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_016.php.expectf
@@ -0,0 +1,8 @@
+bool(false)
+bool(true)
+object(SplFixedArray)#%d (2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_017.php b/hphp/test/zend/bad/ext-spl/fixedarray_017.php
new file mode 100644
index 000000000..ff28e5fd2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_017.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_017.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_017.php.expectf
new file mode 100644
index 000000000..4fb9e437e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_017.php.expectf
@@ -0,0 +1,8 @@
+bool(false)
+bool(true)
+object(SplFixedArray)#%d (2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ NULL
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_018.php b/hphp/test/zend/bad/ext-spl/fixedarray_018.php
new file mode 100644
index 000000000..2c694467c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_018.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_018.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_018.php.expectf
new file mode 100644
index 000000000..e14ca2b76
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_018.php.expectf
@@ -0,0 +1,2 @@
+int(2)
+int(-2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_019.php b/hphp/test/zend/bad/ext-spl/fixedarray_019.php
new file mode 100644
index 000000000..084ffdc21
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_019.php
@@ -0,0 +1,30 @@
+$v) {
+ echo "$k=>";
+ var_dump($v);
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_019.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_019.php.expectf
new file mode 100644
index 000000000..7ddaced1a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_019.php.expectf
@@ -0,0 +1,17 @@
+rewind
+valid
+current
+key
+0=>NULL
+next
+valid
+current
+key
+1=>NULL
+next
+valid
+current
+key
+2=>NULL
+next
+valid
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_020.php b/hphp/test/zend/bad/ext-spl/fixedarray_020.php
new file mode 100644
index 000000000..5dbbe42f3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_020.php
@@ -0,0 +1,23 @@
+'foo', 2=>'bar', 0=>'gee');
+$fa = SplFixedArray::fromArray($a, false);
+var_dump(count($fa), $fa->toArray() === array_values($a));
+
+$fa = SplFixedArray::fromArray($a, true);
+var_dump(count($fa), $fa->toArray() === $a, $fa->toArray() === (array)$fa);
+
+try {
+ echo "From Array with string keys, no preserve\n";
+ SplFixedArray::fromArray(array("foo"=>"bar"), false);
+ echo "No exception\n";
+} catch (Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ echo "From Array with string keys, preserve\n";
+ SplFixedArray::fromArray(array("foo"=>"bar"), true);
+ echo "No exception\n";
+} catch (Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_020.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_020.php.expectf
new file mode 100644
index 000000000..844487b6d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_020.php.expectf
@@ -0,0 +1,9 @@
+int(3)
+bool(true)
+int(3)
+bool(false)
+bool(true)
+From Array with string keys, no preserve
+No exception
+From Array with string keys, preserve
+Exception: array must contain only positive integer keys
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_021.php b/hphp/test/zend/bad/ext-spl/fixedarray_021.php
new file mode 100644
index 000000000..b30da1b91
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_021.php
@@ -0,0 +1,60 @@
+count());
+
+/* negative init value */
+try {
+ $b = new SplFixedArray(-10);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+/* resize and negative value */
+$b = new SplFixedArray();
+try {
+ $b->setSize(-5);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+/* calling __construct() twice */
+$c = new SplFixedArray(0);
+var_dump($c->__construct());
+
+/* fromArray() from empty array */
+$d = new SplFixedArray();
+$d->fromArray(array());
+
+var_dump(count($a));
+var_dump($a->count());
+var_dump($a);
+
+/* foreach by ref */
+$e = new SplFixedArray(10);
+$e[0] = 1;
+$e[1] = 5;
+$e[2] = 10;
+
+try {
+ foreach ($e as $k=>&$v) {
+ var_dump($v);
+ }
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+//non-long indexes
+$a = new SplFixedArray(4);
+$a["2"] = "foo";
+$a["1"] = "foo";
+$a["3"] = "0";
+
+var_dump(isset($a["0"], $a[-1]), $a["1"]);
+var_dump(empty($a["3"]));
+
+?>
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/fixedarray_021.php.expectf b/hphp/test/zend/bad/ext-spl/fixedarray_021.php.expectf
new file mode 100644
index 000000000..2db974b69
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/fixedarray_021.php.expectf
@@ -0,0 +1,14 @@
+int(0)
+int(0)
+string(35) "array size cannot be less than zero"
+string(35) "array size cannot be less than zero"
+NULL
+int(0)
+int(0)
+object(SplFixedArray)#%d (0) {
+}
+string(52) "An iterator cannot be used with foreach by reference"
+bool(false)
+string(3) "foo"
+bool(true)
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_001.php b/hphp/test/zend/bad/ext-spl/heap_001.php
new file mode 100644
index 000000000..7b0ed1844
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_001.php
@@ -0,0 +1,37 @@
+extract();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+
+$h->insert(1);
+$h->insert(2);
+$h->insert(3);
+$h->insert(3);
+$h->insert(3);
+
+echo $h->count()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->count()."\n";
+
+echo "--\n";
+
+$b = 4;
+$h->insert($b);
+$b = 5;
+
+$h2 = clone $h;
+echo $h->extract()."\n";
+echo $h2->extract()."\n";
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_001.php.expectf b/hphp/test/zend/bad/ext-spl/heap_001.php.expectf
new file mode 100644
index 000000000..3a6e1e739
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_001.php.expectf
@@ -0,0 +1,12 @@
+Exception: Can't extract from an empty heap
+5
+3
+3
+3
+2
+1
+0
+--
+4
+4
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_002.php b/hphp/test/zend/bad/ext-spl/heap_002.php
new file mode 100644
index 000000000..fa62d71d7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_002.php
@@ -0,0 +1,35 @@
+extract();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+
+$h->insert(1);
+$h->insert(2);
+$h->insert(3);
+$h->insert(3);
+$h->insert(3);
+
+echo $h->count()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->extract()."\n";
+echo $h->count()."\n";
+
+echo "--\n";
+
+$b = 4;
+$h->insert($b);
+$b = 5;
+
+echo $h->extract()."\n";
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_002.php.expectf b/hphp/test/zend/bad/ext-spl/heap_002.php.expectf
new file mode 100644
index 000000000..b8e3f220b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_002.php.expectf
@@ -0,0 +1,11 @@
+Exception: Can't extract from an empty heap
+5
+1
+2
+3
+3
+3
+0
+--
+4
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_003.php b/hphp/test/zend/bad/ext-spl/heap_003.php
new file mode 100644
index 000000000..ab5118600
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_003.php
@@ -0,0 +1,28 @@
+ $b) {
+ $result = 1;
+ } else if ($a < $b) {
+ $result = -1;
+ } else {
+ $result = 0;
+ }
+ return $result;
+ }
+}
+
+$h = new myHeap;
+
+$in = range(0,10);
+shuffle($in);
+foreach ($in as $i) {
+ $h->insert($i);
+}
+
+foreach ($h as $out) {
+ echo $out."\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_003.php.expectf b/hphp/test/zend/bad/ext-spl/heap_003.php.expectf
new file mode 100644
index 000000000..adcd03081
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_003.php.expectf
@@ -0,0 +1,12 @@
+10
+9
+8
+7
+6
+5
+4
+3
+2
+1
+0
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_004.php b/hphp/test/zend/bad/ext-spl/heap_004.php
new file mode 100644
index 000000000..b897eae35
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_004.php
@@ -0,0 +1,54 @@
+insert(1);
+ echo "inserted 1\n";
+ $h->insert(2);
+ echo "inserted 2\n";
+ $h->insert(3);
+ echo "inserted 3\n";
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ $h->insert(4);
+ echo "inserted 4\n";
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+echo "Recovering..\n";
+$h->recoverFromCorruption();
+
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_004.php.expectf b/hphp/test/zend/bad/ext-spl/heap_004.php.expectf
new file mode 100644
index 000000000..57b714bc4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_004.php.expectf
@@ -0,0 +1,9 @@
+inserted 1
+Exception: foo
+Exception: Heap is corrupted, heap properties are no longer ensured.
+Exception: Heap is corrupted, heap properties are no longer ensured.
+Exception: Heap is corrupted, heap properties are no longer ensured.
+Recovering..
+int(1)
+int(2)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_005.php b/hphp/test/zend/bad/ext-spl/heap_005.php
new file mode 100644
index 000000000..2aeaa2c15
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_005.php
@@ -0,0 +1,16 @@
+insert($i);
+}
+
+foreach ($h as $k => $o) {
+ echo "$k => $o\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_005.php.expectf b/hphp/test/zend/bad/ext-spl/heap_005.php.expectf
new file mode 100644
index 000000000..736a71af2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_005.php.expectf
@@ -0,0 +1,101 @@
+99 => 1
+98 => 2
+97 => 3
+96 => 4
+95 => 5
+94 => 6
+93 => 7
+92 => 8
+91 => 9
+90 => 10
+89 => 11
+88 => 12
+87 => 13
+86 => 14
+85 => 15
+84 => 16
+83 => 17
+82 => 18
+81 => 19
+80 => 20
+79 => 21
+78 => 22
+77 => 23
+76 => 24
+75 => 25
+74 => 26
+73 => 27
+72 => 28
+71 => 29
+70 => 30
+69 => 31
+68 => 32
+67 => 33
+66 => 34
+65 => 35
+64 => 36
+63 => 37
+62 => 38
+61 => 39
+60 => 40
+59 => 41
+58 => 42
+57 => 43
+56 => 44
+55 => 45
+54 => 46
+53 => 47
+52 => 48
+51 => 49
+50 => 50
+49 => 51
+48 => 52
+47 => 53
+46 => 54
+45 => 55
+44 => 56
+43 => 57
+42 => 58
+41 => 59
+40 => 60
+39 => 61
+38 => 62
+37 => 63
+36 => 64
+35 => 65
+34 => 66
+33 => 67
+32 => 68
+31 => 69
+30 => 70
+29 => 71
+28 => 72
+27 => 73
+26 => 74
+25 => 75
+24 => 76
+23 => 77
+22 => 78
+21 => 79
+20 => 80
+19 => 81
+18 => 82
+17 => 83
+16 => 84
+15 => 85
+14 => 86
+13 => 87
+12 => 88
+11 => 89
+10 => 90
+9 => 91
+8 => 92
+7 => 93
+6 => 94
+5 => 95
+4 => 96
+3 => 97
+2 => 98
+1 => 99
+0 => 100
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_006.php b/hphp/test/zend/bad/ext-spl/heap_006.php
new file mode 100644
index 000000000..8e29cd26a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_006.php
@@ -0,0 +1,16 @@
+insert($i);
+}
+
+foreach ($h as $k => $o) {
+ echo "$k => $o\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_006.php.expectf b/hphp/test/zend/bad/ext-spl/heap_006.php.expectf
new file mode 100644
index 000000000..0028306ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_006.php.expectf
@@ -0,0 +1,101 @@
+99 => 100
+98 => 99
+97 => 98
+96 => 97
+95 => 96
+94 => 95
+93 => 94
+92 => 93
+91 => 92
+90 => 91
+89 => 90
+88 => 89
+87 => 88
+86 => 87
+85 => 86
+84 => 85
+83 => 84
+82 => 83
+81 => 82
+80 => 81
+79 => 80
+78 => 79
+77 => 78
+76 => 77
+75 => 76
+74 => 75
+73 => 74
+72 => 73
+71 => 72
+70 => 71
+69 => 70
+68 => 69
+67 => 68
+66 => 67
+65 => 66
+64 => 65
+63 => 64
+62 => 63
+61 => 62
+60 => 61
+59 => 60
+58 => 59
+57 => 58
+56 => 57
+55 => 56
+54 => 55
+53 => 54
+52 => 53
+51 => 52
+50 => 51
+49 => 50
+48 => 49
+47 => 48
+46 => 47
+45 => 46
+44 => 45
+43 => 44
+42 => 43
+41 => 42
+40 => 41
+39 => 40
+38 => 39
+37 => 38
+36 => 37
+35 => 36
+34 => 35
+33 => 34
+32 => 33
+31 => 32
+30 => 31
+29 => 30
+28 => 29
+27 => 28
+26 => 27
+25 => 26
+24 => 25
+23 => 24
+22 => 23
+21 => 22
+20 => 21
+19 => 20
+18 => 19
+17 => 18
+16 => 17
+15 => 16
+14 => 15
+13 => 14
+12 => 13
+11 => 12
+10 => 11
+9 => 10
+8 => 9
+7 => 8
+6 => 7
+5 => 6
+4 => 5
+3 => 4
+2 => 3
+1 => 2
+0 => 1
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_007.php b/hphp/test/zend/bad/ext-spl/heap_007.php
new file mode 100644
index 000000000..e3cc5160b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_007.php
@@ -0,0 +1,21 @@
+insert(1);
+$h->insert(5);
+$h->insert(0);
+$h->insert(4);
+
+$h->rewind();
+echo "count(\$h) = ".count($h)."\n";
+echo "\$h->count() = ".$h->count()."\n";
+
+while ($h->valid()) {
+ $k = $h->key();
+ $v = $h->current();
+ echo "$k=>$v\n";
+ $h->next();
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_007.php.expectf b/hphp/test/zend/bad/ext-spl/heap_007.php.expectf
new file mode 100644
index 000000000..bcd87bc82
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_007.php.expectf
@@ -0,0 +1,7 @@
+count($h) = 4
+$h->count() = 4
+3=>5
+2=>4
+1=>1
+0=>0
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_008.php b/hphp/test/zend/bad/ext-spl/heap_008.php
new file mode 100644
index 000000000..1ebe09978
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_008.php
@@ -0,0 +1,12 @@
+insert(1);
+$h->insert(5);
+$h->insert(0);
+$h->insert(4);
+
+var_dump($h);
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_008.php.expectf b/hphp/test/zend/bad/ext-spl/heap_008.php.expectf
new file mode 100644
index 000000000..f321093fd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_008.php.expectf
@@ -0,0 +1,18 @@
+object(SplMaxHeap)#1 (3) {
+ ["flags":"SplHeap":private]=>
+ int(0)
+ ["isCorrupted":"SplHeap":private]=>
+ bool(false)
+ ["heap":"SplHeap":private]=>
+ array(4) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(4)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_009.php b/hphp/test/zend/bad/ext-spl/heap_009.php
new file mode 100644
index 000000000..86937b20f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_009.php
@@ -0,0 +1,42 @@
+getMessage(),"\n";
+ }
+}
+
+// 1. SplMinHeap emtpy
+$heap = new SplMinHeap;
+testForException( $heap );
+
+// 2. SplMinHeap non-emtpy
+$heap = new SplMinHeap;
+$heap->insert( 1 );
+testForException( $heap );
+
+// 3. SplMaxHeap emtpy
+$heap = new SplMaxHeap;
+testForException( $heap );
+
+// 4. SplMaxHeap non-emtpy
+$heap = new SplMaxHeap;
+$heap->insert( 1 );
+testForException( $heap );
+
+// 5. SplPriorityQueue empty
+$heap = new SplPriorityQueue;
+testForException( $heap );
+
+// 6. SplPriorityQueue non-empty
+$heap = new SplPriorityQueue;
+$heap->insert( 1, 2 );
+testForException( $heap );
+
+?>
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_009.php.expectf b/hphp/test/zend/bad/ext-spl/heap_009.php.expectf
new file mode 100644
index 000000000..f2ab83d69
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_009.php.expectf
@@ -0,0 +1,7 @@
+An iterator cannot be used with foreach by reference
+An iterator cannot be used with foreach by reference
+An iterator cannot be used with foreach by reference
+An iterator cannot be used with foreach by reference
+An iterator cannot be used with foreach by reference
+An iterator cannot be used with foreach by reference
+==DONE==
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_010.php b/hphp/test/zend/bad/ext-spl/heap_010.php
new file mode 100644
index 000000000..e591e57c3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_010.php
@@ -0,0 +1,15 @@
+insert(1);
+$obj->insert(2);
+var_dump(count($obj));
+class SplMaxHeap2 extends SplMaxHeap{
+ public function count() {
+ return -parent::count();
+ }
+}
+$obj = new SplMaxHeap2();
+$obj->insert(1);
+$obj->insert(2);
+var_dump(count($obj));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_010.php.expectf b/hphp/test/zend/bad/ext-spl/heap_010.php.expectf
new file mode 100644
index 000000000..e14ca2b76
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_010.php.expectf
@@ -0,0 +1,2 @@
+int(2)
+int(-2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_011.php b/hphp/test/zend/bad/ext-spl/heap_011.php
new file mode 100644
index 000000000..c7455a384
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_011.php
@@ -0,0 +1,25 @@
+insert(1);
+$h->insert(6);
+$h->insert(5);
+$h->insert(2);
+var_dump($h->top());
+
+class SplMaxHeap2 extends SplMaxHeap {
+ public function compare($a, $b) {
+ return -parent::compare($a,$b);
+ }
+}
+$h = new SplMaxHeap2();
+$h->insert(1);
+$h->insert(6);
+$h->insert(5);
+$h->insert(2);
+var_dump($h->top());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_011.php.expectf b/hphp/test/zend/bad/ext-spl/heap_011.php.expectf
new file mode 100644
index 000000000..68ae6ab0f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_011.php.expectf
@@ -0,0 +1,2 @@
+int(6)
+int(1)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_012.php b/hphp/test/zend/bad/ext-spl/heap_012.php
new file mode 100644
index 000000000..113b438f5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_012.php
@@ -0,0 +1,6 @@
+insert($a);
+var_dump($a)
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_012.php.expectf b/hphp/test/zend/bad/ext-spl/heap_012.php.expectf
new file mode 100644
index 000000000..a2fbb5efe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_012.php.expectf
@@ -0,0 +1,12 @@
+object(SplMaxHeap)#%d (3) {
+ ["flags":"SplHeap":private]=>
+ int(0)
+ ["isCorrupted":"SplHeap":private]=>
+ bool(false)
+ ["heap":"SplHeap":private]=>
+ array(1) {
+ [0]=>
+ *RECURSION*
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_corruption.php b/hphp/test/zend/bad/ext-spl/heap_corruption.php
new file mode 100644
index 000000000..245981c33
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_corruption.php
@@ -0,0 +1,53 @@
+allow_compare == true)
+ {
+ if ($v1 > $v2)
+ {
+ return 1;
+ }
+ else if ($v1 < $v2)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ throw new Exception('Compare exception');
+ }
+ }
+}
+
+$heap = new myHeap();
+$heap->insert(1);
+$heap->insert(2);
+$heap->insert(3);
+$heap->insert(4);
+
+$heap->allow_compare = false;
+
+try {
+ $heap->extract();
+}
+catch (Exception $e) {
+ echo "Compare Exception: " . $e->getMessage() . PHP_EOL;
+}
+
+try {
+ $heap->top();
+}
+catch (Exception $e) {
+ echo "Corruption Exception: " . $e->getMessage() . PHP_EOL;
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_corruption.php.expectf b/hphp/test/zend/bad/ext-spl/heap_corruption.php.expectf
new file mode 100644
index 000000000..fbc23ccc7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_corruption.php.expectf
@@ -0,0 +1,2 @@
+Compare Exception: Compare exception
+Corruption Exception: Heap is corrupted, heap properties are no longer ensured.
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_current_variation_001.php b/hphp/test/zend/bad/ext-spl/heap_current_variation_001.php
new file mode 100644
index 000000000..8a7313696
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_current_variation_001.php
@@ -0,0 +1,14 @@
+current());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_current_variation_001.php.expectf b/hphp/test/zend/bad/ext-spl/heap_current_variation_001.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_current_variation_001.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_isempty_variation_001.php b/hphp/test/zend/bad/ext-spl/heap_isempty_variation_001.php
new file mode 100644
index 000000000..6e7ead541
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_isempty_variation_001.php
@@ -0,0 +1,11 @@
+isEmpty(1);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_isempty_variation_001.php.expectf b/hphp/test/zend/bad/ext-spl/heap_isempty_variation_001.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_isempty_variation_001.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_it_current_empty.php b/hphp/test/zend/bad/ext-spl/heap_it_current_empty.php
new file mode 100644
index 000000000..c757c5303
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_it_current_empty.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_it_current_empty.php.expectf b/hphp/test/zend/bad/ext-spl/heap_it_current_empty.php.expectf
new file mode 100644
index 000000000..e69de29bb
diff --git a/hphp/test/zend/bad/ext-spl/heap_top_variation_001.php b/hphp/test/zend/bad/ext-spl/heap_top_variation_001.php
new file mode 100644
index 000000000..c96bf6b6a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_top_variation_001.php
@@ -0,0 +1,6 @@
+insert(5);
+// top doesn't take any args, lets see what happens if we give it one
+$h->top('bogus');
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_top_variation_001.php.expectf b/hphp/test/zend/bad/ext-spl/heap_top_variation_001.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_top_variation_001.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_top_variation_002.php b/hphp/test/zend/bad/ext-spl/heap_top_variation_002.php
new file mode 100644
index 000000000..d4d6e2a8f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_top_variation_002.php
@@ -0,0 +1,23 @@
+insert(4);
+try {
+ $h->insert(5);
+} catch (Exception $e) {}
+
+// call top, should fail with corrupted heap
+try {
+ $h->top();
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_top_variation_002.php.expectf b/hphp/test/zend/bad/ext-spl/heap_top_variation_002.php.expectf
new file mode 100644
index 000000000..c2812b796
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_top_variation_002.php.expectf
@@ -0,0 +1 @@
+Heap is corrupted, heap properties are no longer ensured.
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_top_variation_003.php b/hphp/test/zend/bad/ext-spl/heap_top_variation_003.php
new file mode 100644
index 000000000..34d9a9415
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_top_variation_003.php
@@ -0,0 +1,8 @@
+top();
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/heap_top_variation_003.php.expectf b/hphp/test/zend/bad/ext-spl/heap_top_variation_003.php.expectf
new file mode 100644
index 000000000..627c48440
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/heap_top_variation_003.php.expectf
@@ -0,0 +1 @@
+Can't peek at an empty heap
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_001.php b/hphp/test/zend/bad/ext-spl/iterator_001.php
new file mode 100644
index 000000000..0fcb446ba
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_001.php
@@ -0,0 +1,89 @@
+a = $a;
+ }
+
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->i = 0;
+ }
+
+ public function valid()
+ {
+ $ret = $this->i < count($this->a);
+ echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
+ return $ret;
+ }
+
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i;
+ }
+
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return $this->a[$this->i];
+ }
+
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->i++;
+ }
+
+ public function greaterThan($comp)
+ {
+ echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n";
+ return $this->current() > $comp;
+ }
+}
+
+class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator
+{
+ public function seek($index)
+ {
+ if ($index < count($this->a)) {
+ $this->i = $index;
+ }
+ echo __METHOD__ . '(' . $index . ")\n";
+ }
+}
+
+$a = array(1, 2, 3, 4, 5);
+$it = new LimitIterator(new NumericArrayIterator($a), 1, 3);
+foreach ($it as $v)
+{
+ print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
+}
+
+echo "===SEEKABLE===\n";
+$a = array(1, 2, 3, 4, 5);
+$it = new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3);
+foreach($it as $v)
+{
+ print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
+}
+
+echo "===STACKED===\n";
+echo "Shows '2 is greater than 2' because the test is actually done with the current value which is 3.\n";
+$a = array(1, 2, 3, 4, 5);
+$it = new CachingIterator(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3));
+foreach($it as $v)
+{
+ print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_001.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_001.php.expectf
new file mode 100644
index 000000000..3e9d3ba82
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_001.php.expectf
@@ -0,0 +1,78 @@
+NumericArrayIterator::__construct
+NumericArrayIterator::rewind
+NumericArrayIterator::valid(true)
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+NumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+2 is less than or equal 2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+NumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+3 is greater than 2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+NumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+4 is greater than 2
+NumericArrayIterator::next
+===SEEKABLE===
+NumericArrayIterator::__construct
+NumericArrayIterator::rewind
+SeekableNumericArrayIterator::seek(1)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+SeekableNumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+2 is less than or equal 2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+SeekableNumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+3 is greater than 2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+SeekableNumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+4 is greater than 2
+NumericArrayIterator::next
+===STACKED===
+Shows '2 is greater than 2' because the test is actually done with the current value which is 3.
+NumericArrayIterator::__construct
+NumericArrayIterator::rewind
+SeekableNumericArrayIterator::seek(1)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+SeekableNumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+2 is greater than 2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+SeekableNumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+3 is greater than 2
+NumericArrayIterator::next
+SeekableNumericArrayIterator::greaterThan(2)
+NumericArrayIterator::current
+4 is greater than 2
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_002.php b/hphp/test/zend/bad/ext-spl/iterator_002.php
new file mode 100644
index 000000000..ace19f554
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_002.php
@@ -0,0 +1,44 @@
+current());
+ }
+
+ function getChildren()
+ {
+ return new RecursiceArrayIterator($this->current());
+ }
+}
+
+class CrashIterator extends FilterIterator implements RecursiveIterator
+{
+ function accept()
+ {
+ return true;
+ }
+
+ function hasChildren()
+ {
+ return $this->getInnerIterator()->hasChildren();
+ }
+
+ function getChildren()
+ {
+ return new RecursiceArrayIterator($this->getInnerIterator()->current());
+ }
+}
+
+$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
+
+$dir = new RecursiveIteratorIterator(new CrashIterator(new RecursiceArrayIterator($array)), RecursiveIteratorIterator::LEAVES_ONLY);
+
+foreach ($dir as $file) {
+ print "$file\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_002.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_002.php.expectf
new file mode 100644
index 000000000..a844ea643
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_002.php.expectf
@@ -0,0 +1,7 @@
+1
+21
+221
+222
+231
+3
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_003.php b/hphp/test/zend/bad/ext-spl/iterator_003.php
new file mode 100644
index 000000000..be636467e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_003.php
@@ -0,0 +1,88 @@
+id = $id;
+ $this->name = $name;
+ }
+
+ public function __toString()
+ {
+ return $this->id . ', ' . $this->name;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+}
+
+class StudentIdFilter extends FilterIterator
+{
+ private $id;
+
+ public function __construct(ArrayObject $students, Student $other)
+ {
+ FilterIterator::__construct($students->getIterator());
+ $this->id = $other->getId();
+ }
+
+ public function accept()
+ {
+ echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
+ return $this->current()->getId() == $this->id;
+ }
+}
+
+class StudentList implements IteratorAggregate
+{
+ private $students;
+
+ public function __construct()
+ {
+ $this->students = new ArrayObject(array());
+ }
+
+ public function add(Student $student)
+ {
+ if (!$this->contains($student)) {
+ $this->students[] = $student;
+ }
+ }
+
+ public function contains(Student $student)
+ {
+ foreach ($this->students as $s)
+ {
+ if ($s->getId() == $student->getId()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function getIterator() {
+ return new CachingIterator($this->students->getIterator(), true);
+ }
+}
+
+$students = new StudentList();
+$students->add(new Student('01234123', 'Joe'));
+$students->add(new Student('00000014', 'Bob'));
+$students->add(new Student('00000014', 'Foo'));
+
+// The goal is to verify we can access the cached string value even if it was
+// generated by a call to __toString(). To check this we need to access the
+// iterator's __toString() method.
+$it = $students->getIterator();
+foreach ($it as $student) {
+ echo $it->__toString(), "\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_003.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_003.php.expectf
new file mode 100644
index 000000000..9e96d9db5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_003.php.expectf
@@ -0,0 +1,3 @@
+01234123, Joe
+00000014, Bob
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_004.php b/hphp/test/zend/bad/ext-spl/iterator_004.php
new file mode 100644
index 000000000..e0a64924c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_004.php
@@ -0,0 +1,81 @@
+a = $a;
+ }
+
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->i = 0;
+ }
+
+ public function valid()
+ {
+ $ret = $this->i < count($this->a);
+ echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
+ return $ret;
+ }
+
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i;
+ }
+
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return $this->a[$this->i];
+ }
+
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->i++;
+ }
+}
+
+class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator
+{
+ public function seek($index)
+ {
+ if ($index < count($this->a)) {
+ $this->i = $index;
+ }
+ echo __METHOD__ . '(' . $index . ")\n";
+ }
+}
+
+$a = array(1, 2, 3, 4, 5);
+foreach (new LimitIterator(new NumericArrayIterator($a), 1, 3) as $v)
+{
+ print "$v\n";
+}
+
+echo "===SEEKABLE===\n";
+$a = array(1, 2, 3, 4, 5);
+foreach(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3) as $v)
+{
+ print "$v\n";
+}
+
+echo "===SEEKING===\n";
+$a = array(1, 2, 3, 4, 5);
+$l = new LimitIterator(new SeekableNumericArrayIterator($a));
+for($i = 1; $i < 4; $i++)
+{
+ $l->seek($i);
+ print $l->current() . "\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_004.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_004.php.expectf
new file mode 100644
index 000000000..f5ad433eb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_004.php.expectf
@@ -0,0 +1,57 @@
+NumericArrayIterator::__construct
+NumericArrayIterator::rewind
+NumericArrayIterator::valid(true)
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+3
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+4
+NumericArrayIterator::next
+===SEEKABLE===
+NumericArrayIterator::__construct
+NumericArrayIterator::rewind
+SeekableNumericArrayIterator::seek(1)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+2
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+3
+NumericArrayIterator::next
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+4
+NumericArrayIterator::next
+===SEEKING===
+NumericArrayIterator::__construct
+SeekableNumericArrayIterator::seek(1)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+2
+SeekableNumericArrayIterator::seek(2)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+3
+SeekableNumericArrayIterator::seek(3)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::current
+NumericArrayIterator::key
+4
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_005.php b/hphp/test/zend/bad/ext-spl/iterator_005.php
new file mode 100644
index 000000000..3b57e31ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_005.php
@@ -0,0 +1,37 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_005.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_005.php.expectf
new file mode 100644
index 000000000..7186d76da
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_005.php.expectf
@@ -0,0 +1,11 @@
+ArrayIteratorEx::rewind
+int(0)
+int(1)
+int(2)
+int(3)
+ArrayObjectEx::getIterator
+int(0)
+int(1)
+int(2)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_007.php b/hphp/test/zend/bad/ext-spl/iterator_007.php
new file mode 100644
index 000000000..4d69f3d6a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_007.php
@@ -0,0 +1,96 @@
+getInnerIterator() as $v) {
+ var_dump($v);
+}
+
+echo "===1===\n";
+foreach ($it as $v) {
+ var_dump($v);
+}
+
+$pos =0;
+
+$it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3)));
+
+echo "===2===\n";
+foreach ($it as $v) {
+ var_dump($v);
+ if ($pos++ > 1) {
+ break;
+ }
+}
+
+echo "===3===\n";
+foreach ($it as $v) {
+ var_dump($v);
+}
+
+echo "===4===\n";
+foreach ($it as $v) {
+ var_dump($v);
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_007.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_007.php.expectf
new file mode 100644
index 000000000..2b8c6a33a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_007.php.expectf
@@ -0,0 +1,66 @@
+===0===
+ArrayIteratorEx::rewind
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+int(0)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+int(1)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+int(2)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+int(3)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+===1===
+NoRewindIteratorEx::rewind
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+===2===
+NoRewindIteratorEx::rewind
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+NoRewindIteratorEx::current
+ArrayIteratorEx::current
+int(0)
+NoRewindIteratorEx::next
+ArrayIteratorEx::next
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+NoRewindIteratorEx::current
+ArrayIteratorEx::current
+int(1)
+NoRewindIteratorEx::next
+ArrayIteratorEx::next
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+NoRewindIteratorEx::current
+ArrayIteratorEx::current
+int(2)
+===3===
+NoRewindIteratorEx::rewind
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+NoRewindIteratorEx::current
+int(2)
+NoRewindIteratorEx::next
+ArrayIteratorEx::next
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+NoRewindIteratorEx::current
+ArrayIteratorEx::current
+int(3)
+NoRewindIteratorEx::next
+ArrayIteratorEx::next
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+===4===
+NoRewindIteratorEx::rewind
+NoRewindIteratorEx::valid
+ArrayIteratorEx::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_008.php b/hphp/test/zend/bad/ext-spl/iterator_008.php
new file mode 100644
index 000000000..a335a1994
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_008.php
@@ -0,0 +1,45 @@
+ 5) {
+ break;
+ }
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_008.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_008.php.expectf
new file mode 100644
index 000000000..28f6428d6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_008.php.expectf
@@ -0,0 +1,40 @@
+ArrayIteratorEx::rewind
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(0)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(1)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(2)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::rewind
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(0)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(1)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(2)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::rewind
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(0)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_009.php b/hphp/test/zend/bad/ext-spl/iterator_009.php
new file mode 100644
index 000000000..c7613dce7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_009.php
@@ -0,0 +1,38 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_009.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_009.php.expectf
new file mode 100644
index 000000000..52c2d1237
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_009.php.expectf
@@ -0,0 +1,3 @@
+EmptyIteratorEx::rewind
+EmptyIteratorEx::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_010.php b/hphp/test/zend/bad/ext-spl/iterator_010.php
new file mode 100644
index 000000000..942238b58
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_010.php
@@ -0,0 +1,12 @@
+ $val)
+{
+ echo "$key=>$val\n";
+}
+
+?>
+===DONE===
+$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===InfiniteIterator===\n";
+
+$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
+$it = new InfiniteIterator($it);
+$it = new LimitIterator($it, 2, 5);
+foreach($it as $val=>$key)
+{
+ echo "$val=>$key\n";
+}
+
+echo "===Infinite/LimitIterator===\n";
+
+$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
+$it = new LimitIterator($it, 1, 2);
+$it = new InfiniteIterator($it);
+$it = new LimitIterator($it, 2, 5);
+foreach($it as $val=>$key)
+{
+ echo "$val=>$key\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_011.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_011.php.expectf
new file mode 100644
index 000000000..c088c958c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_011.php.expectf
@@ -0,0 +1,14 @@
+===EmptyIterator===
+===InfiniteIterator===
+2=>C
+3=>D
+0=>A
+1=>B
+2=>C
+===Infinite/LimitIterator===
+1=>B
+2=>C
+1=>B
+2=>C
+1=>B
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_012.php b/hphp/test/zend/bad/ext-spl/iterator_012.php
new file mode 100644
index 000000000..961232851
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_012.php
@@ -0,0 +1,22 @@
+ 'A', 1 => 'B', 2 => 'C')));
+
+echo $it->key() . '=>' . $it->current() . "\n";
+
+echo "===Next===\n";
+
+$it->next();
+
+echo "===Foreach===\n";
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_012.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_012.php.expectf
new file mode 100644
index 000000000..0dc36b991
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_012.php.expectf
@@ -0,0 +1,7 @@
+===Current===
+0=>A
+===Next===
+===Foreach===
+1=>B
+2=>C
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_013.php b/hphp/test/zend/bad/ext-spl/iterator_013.php
new file mode 100644
index 000000000..f70ac79d4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_013.php
@@ -0,0 +1,46 @@
+$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Append===\n";
+
+$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B')));
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Rewind===\n";
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Append===\n";
+
+$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D')));
+
+foreach(new NoRewindIterator($it) as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Rewind===\n";
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_013.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_013.php.expectf
new file mode 100644
index 000000000..c4d893185
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_013.php.expectf
@@ -0,0 +1,16 @@
+===Empty===
+===Append===
+0=>A
+1=>B
+===Rewind===
+0=>A
+1=>B
+===Append===
+2=>C
+3=>D
+===Rewind===
+0=>A
+1=>B
+2=>C
+3=>D
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_014.php b/hphp/test/zend/bad/ext-spl/iterator_014.php
new file mode 100644
index 000000000..499176f3e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_014.php
@@ -0,0 +1,74 @@
+getDepth().")\n";
+ }
+
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+}
+
+foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"))) as $k=>$v)
+{
+ echo "$k=>$v\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_014.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_014.php.expectf
new file mode 100644
index 000000000..8af51a09c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_014.php.expectf
@@ -0,0 +1,60 @@
+RecursiveArrayIteratorIterator::rewind
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>a
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>ba
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+1=>bbb
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(2)
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(3)
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bcaa
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(3)
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(1)
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>ca
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(1)
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+3=>d
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::valid
+MyRecursiveArrayIterator::valid = false
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_015.php b/hphp/test/zend/bad/ext-spl/iterator_015.php
new file mode 100644
index 000000000..b149568a4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_015.php
@@ -0,0 +1,38 @@
+\n";
+ parent::rewind();
+ }
+ function beginChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."\n";
+ }
+
+ function endChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."
\n";
+ }
+ function valid()
+ {
+ if (!parent::valid()) {
+ echo "\n";
+ return false;
+ }
+ return true;
+ }
+}
+
+$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
+$obj = new RecursiveArrayIterator($arr);
+$rit = new RecursiveArrayIteratorIterator($obj);
+foreach($rit as $k=>$v)
+{
+ echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_015.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_015.php.expectf
new file mode 100644
index 000000000..e20bc056e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_015.php.expectf
@@ -0,0 +1,20 @@
+
+ 0=>a
+
+
+ 3=>d
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_016.php b/hphp/test/zend/bad/ext-spl/iterator_016.php
new file mode 100644
index 000000000..b06e96b91
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_016.php
@@ -0,0 +1,51 @@
+\n";
+ parent::rewind();
+ }
+ function beginChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."\n";
+ }
+
+ function endChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."
\n";
+ }
+ function valid()
+ {
+ if (!parent::valid()) {
+ echo "\n";
+ return false;
+ }
+ return true;
+ }
+}
+
+$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
+$obj = new Menu($arr);
+$rit = new MenuOutput($obj);
+foreach($rit as $k=>$v)
+{
+ echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_016.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_016.php.expectf
new file mode 100644
index 000000000..f0025cba1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_016.php.expectf
@@ -0,0 +1,21 @@
+Menu::getIterator
+
+ 0=>a
+
+
+ 3=>d
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_017.php b/hphp/test/zend/bad/ext-spl/iterator_017.php
new file mode 100644
index 000000000..942238b58
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_017.php
@@ -0,0 +1,12 @@
+ $val)
+{
+ echo "$key=>$val\n";
+}
+
+?>
+===DONE===
+$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===InfiniteIterator===\n";
+
+$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
+$it = new InfiniteIterator($it);
+$it = new LimitIterator($it, 2, 5);
+foreach($it as $val=>$key)
+{
+ echo "$val=>$key\n";
+}
+
+echo "===Infinite/LimitIterator===\n";
+
+$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
+$it = new LimitIterator($it, 1, 2);
+$it = new InfiniteIterator($it);
+$it = new LimitIterator($it, 2, 5);
+foreach($it as $val=>$key)
+{
+ echo "$val=>$key\n";
+}
+
+?>
+===DONE===
+C
+3=>D
+0=>A
+1=>B
+2=>C
+===Infinite/LimitIterator===
+1=>B
+2=>C
+1=>B
+2=>C
+1=>B
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_019.php b/hphp/test/zend/bad/ext-spl/iterator_019.php
new file mode 100644
index 000000000..961232851
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_019.php
@@ -0,0 +1,22 @@
+ 'A', 1 => 'B', 2 => 'C')));
+
+echo $it->key() . '=>' . $it->current() . "\n";
+
+echo "===Next===\n";
+
+$it->next();
+
+echo "===Foreach===\n";
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_019.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_019.php.expectf
new file mode 100644
index 000000000..0dc36b991
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_019.php.expectf
@@ -0,0 +1,7 @@
+===Current===
+0=>A
+===Next===
+===Foreach===
+1=>B
+2=>C
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_020.php b/hphp/test/zend/bad/ext-spl/iterator_020.php
new file mode 100644
index 000000000..f70ac79d4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_020.php
@@ -0,0 +1,46 @@
+$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Append===\n";
+
+$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B')));
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Rewind===\n";
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Append===\n";
+
+$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D')));
+
+foreach(new NoRewindIterator($it) as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+echo "===Rewind===\n";
+
+foreach($it as $key=>$val)
+{
+ echo "$key=>$val\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_020.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_020.php.expectf
new file mode 100644
index 000000000..c4d893185
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_020.php.expectf
@@ -0,0 +1,16 @@
+===Empty===
+===Append===
+0=>A
+1=>B
+===Rewind===
+0=>A
+1=>B
+===Append===
+2=>C
+3=>D
+===Rewind===
+0=>A
+1=>B
+2=>C
+3=>D
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_021.php b/hphp/test/zend/bad/ext-spl/iterator_021.php
new file mode 100644
index 000000000..db9541830
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_021.php
@@ -0,0 +1,107 @@
+max_depth = $max_depth;
+ parent::__construct($it);
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->skip = false;
+ parent::rewind();
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ if ($this->skip)
+ {
+ $this->skip = false;
+ $this->next();
+ }
+ return parent::valid();
+ }
+
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
+
+ function callHasChildren()
+ {
+ $this->skip = false;
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ if ($has && !$res)
+ {
+ $this->over++;
+ if ($this->over == 2) {
+ $this->skip = true;
+ }
+ }
+ return $res;
+ }
+
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+}
+
+foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
+{
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_021.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_021.php.expectf
new file mode 100644
index 000000000..6b84d0994
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_021.php.expectf
@@ -0,0 +1,69 @@
+RecursiveArrayIteratorIterator::rewind
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>a
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>ba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+1=>bbb
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bcaa
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+MyRecursiveArrayIterator::getChildren
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>ca
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+3=>d
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::valid
+MyRecursiveArrayIterator::valid = false
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_022.php b/hphp/test/zend/bad/ext-spl/iterator_022.php
new file mode 100644
index 000000000..e7337ba01
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_022.php
@@ -0,0 +1,126 @@
+current();
+ }
+
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . " = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+}
+
+class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
+{
+ private $max_depth;
+ private $over = 0;
+ private $skip = false;
+
+ function __construct($it, $max_depth)
+ {
+ $this->max_depth = $max_depth;
+ parent::__construct($it);
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->skip = false;
+ parent::rewind();
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ if ($this->skip)
+ {
+ $this->skip = false;
+ $this->next();
+ }
+ return parent::valid();
+ }
+
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
+
+ function callHasChildren()
+ {
+ $this->skip = false;
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ if ($has && !$res)
+ {
+ $this->over++;
+ if ($this->over == 2) {
+ $this->skip = true;
+ }
+ }
+ return $res;
+ }
+
+ function callGetChildren()
+ {
+ if ($this->over == 2)
+ {
+ echo __METHOD__ . "(skip)\n";
+ return NULL;
+ }
+ echo __METHOD__ . "(ok:{$this->over})\n";
+ return new MyRecursiveArrayIterator($this->current());
+ }
+
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+}
+
+try
+{
+ foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
+ {
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+ }
+}
+catch(UnexpectedValueException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_022.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_022.php.expectf
new file mode 100644
index 000000000..3db2cd37f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_022.php.expectf
@@ -0,0 +1,56 @@
+RecursiveArrayIteratorIterator::rewind
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>a
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(ok:0)
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>ba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(ok:0)
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+1=>bbb
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(ok:0)
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bcaa
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(skip)
+Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_023.php b/hphp/test/zend/bad/ext-spl/iterator_023.php
new file mode 100644
index 000000000..1ae4de1d8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_023.php
@@ -0,0 +1,126 @@
+current();
+ }
+
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . " = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+}
+
+class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
+{
+ private $max_depth;
+ private $over = 0;
+ private $skip = false;
+
+ function __construct($it, $max_depth)
+ {
+ $this->max_depth = $max_depth;
+ parent::__construct($it, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->skip = false;
+ parent::rewind();
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ if ($this->skip)
+ {
+ $this->skip = false;
+ $this->next();
+ }
+ return parent::valid();
+ }
+
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
+
+ function callHasChildren()
+ {
+ $this->skip = false;
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ if ($has && !$res)
+ {
+ $this->over++;
+ if ($this->over == 2) {
+ $this->skip = true;
+ }
+ }
+ return $res;
+ }
+
+ function callGetChildren()
+ {
+ if ($this->over == 2)
+ {
+ echo __METHOD__ . "(throw)\n";
+ throw new Exception("Thrown in callGetChildren()");
+ }
+ echo __METHOD__ . "(ok:{$this->over})\n";
+ return new MyRecursiveArrayIterator($this->current());
+ }
+
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
+}
+
+try
+{
+ foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
+ {
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+ }
+}
+catch(UnexpectedValueException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_023.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_023.php.expectf
new file mode 100644
index 000000000..585c71885
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_023.php.expectf
@@ -0,0 +1,63 @@
+RecursiveArrayIteratorIterator::rewind
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>a
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(ok:0)
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>ba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(ok:0)
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bba
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+1=>bbb
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(ok:0)
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+0=>bcaa
+RecursiveArrayIteratorIterator::next
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(2)
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::endChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+RecursiveArrayIteratorIterator::callGetChildren(throw)
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::current
+RecursiveArrayIteratorIterator::key
+3=>d
+RecursiveArrayIteratorIterator::next
+MyRecursiveArrayIterator::valid = false
+RecursiveArrayIteratorIterator::valid
+MyRecursiveArrayIterator::valid = false
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_024.php b/hphp/test/zend/bad/ext-spl/iterator_024.php
new file mode 100644
index 000000000..669d01396
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_024.php
@@ -0,0 +1,28 @@
+getIteratorClass());
+
+try
+{
+ foreach(new RecursiveIteratorIterator(new ArrayObject($ar)) as $v) echo "$v\n";
+}
+catch (InvalidArgumentException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+echo "===MANUAL===\n";
+
+$it->setIteratorClass("RecursiveArrayIterator");
+var_dump($it->getIteratorClass());
+foreach(new RecursiveIteratorIterator($it) as $v) echo "$v\n";
+
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_024.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_024.php.expectf
new file mode 100644
index 000000000..6cfa2c5bc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_024.php.expectf
@@ -0,0 +1,17 @@
+1
+2
+31
+32
+331
+4
+string(13) "ArrayIterator"
+An instance of RecursiveIterator or IteratorAggregate creating it is required
+===MANUAL===
+string(22) "RecursiveArrayIterator"
+1
+2
+31
+32
+331
+4
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_025.php b/hphp/test/zend/bad/ext-spl/iterator_025.php
new file mode 100644
index 000000000..368198aff
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_025.php
@@ -0,0 +1,50 @@
+rewind();
+foreach($it as $v) echo "$v\n";
+var_dump($it->valid());
+
+echo "===MANUAL===\n";
+
+$it->rewind();
+while($it->valid())
+{
+ echo $it->current() . "\n";
+ $it->next();
+ break;
+}
+$it->rewind();
+while($it->valid())
+{
+ echo $it->current() . "\n";
+ $it->next();
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_025.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_025.php.expectf
new file mode 100644
index 000000000..b7cb60ba0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_025.php.expectf
@@ -0,0 +1,38 @@
+MyRecursiveIteratorIterator::beginIteration()
+1
+2
+31
+32
+331
+4
+MyRecursiveIteratorIterator::endIteration()
+===MORE===
+MyRecursiveIteratorIterator::beginIteration()
+1
+2
+31
+32
+331
+4
+MyRecursiveIteratorIterator::endIteration()
+===MORE===
+MyRecursiveIteratorIterator::beginIteration()
+1
+2
+31
+32
+331
+4
+MyRecursiveIteratorIterator::endIteration()
+bool(false)
+===MANUAL===
+MyRecursiveIteratorIterator::beginIteration()
+1
+1
+2
+31
+32
+331
+4
+MyRecursiveIteratorIterator::endIteration()
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_026.php b/hphp/test/zend/bad/ext-spl/iterator_026.php
new file mode 100644
index 000000000..daaa55a57
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_026.php
@@ -0,0 +1,17 @@
+$v)
+{
+ echo "$k=>$v\n";
+ echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_026.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_026.php.expectf
new file mode 100644
index 000000000..de4650cd0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_026.php.expectf
@@ -0,0 +1,15 @@
+0=>1
+hasNext: yes
+1=>2
+hasNext: yes
+HipHop Notice: %a
+0=>31
+hasNext: yes
+1=>32
+hasNext: yes
+HipHop Notice: %a
+0=>331
+hasNext: no
+3=>4
+hasNext: no
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_027.php b/hphp/test/zend/bad/ext-spl/iterator_027.php
new file mode 100644
index 000000000..7d0bd5822
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_027.php
@@ -0,0 +1,52 @@
+$v)
+{
+ echo "$k=>$v\n";
+}
+
+echo "===CHECK===\n";
+
+for ($i = 0; $i < 4; $i++)
+{
+ if (isset($it[$i]))
+ {
+ var_dump($i, $it[$i]);
+ }
+}
+
+$it[2] = 'foo';
+$it[3] = 'bar';
+$it['baz'] = '25';
+
+var_dump($it[2]);
+var_dump($it[3]);
+var_dump($it['baz']);
+
+unset($it[0]);
+unset($it[2]);
+unset($it['baz']);
+
+var_dump(isset($it[0])); // unset
+var_dump(isset($it[1])); // still present
+var_dump(isset($it[2])); // unset
+var_dump(isset($it[3])); // still present
+var_dump(isset($it['baz']));
+
+echo "===REWIND===\n";
+
+$it->rewind(); // cleans and reads first element
+var_dump(isset($it[0])); // pre-fetched
+var_dump(isset($it[1])); // deleted
+var_dump(isset($it[2])); // unset
+var_dump(isset($it[3])); // deleted
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_027.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_027.php.expectf
new file mode 100644
index 000000000..2ef45ad95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_027.php.expectf
@@ -0,0 +1,27 @@
+0=>1
+1=>2
+0=>31
+1=>32
+0=>331
+3=>4
+===CHECK===
+int(0)
+int(331)
+int(1)
+int(32)
+int(3)
+int(4)
+string(3) "foo"
+string(3) "bar"
+string(2) "25"
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+===REWIND===
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_028.php b/hphp/test/zend/bad/ext-spl/iterator_028.php
new file mode 100644
index 000000000..2c064fa2f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_028.php
@@ -0,0 +1,51 @@
+getMaxDepth());
+foreach($it as $v) echo $it->getDepth() . ": $v\n";
+
+echo "===2===\n";
+$it->setMaxDepth(2);
+var_dump($it->getMaxDepth());
+foreach($it as $v) echo $it->getDepth() . ": $v\n";
+
+echo "===X===\n";
+$it->setMaxDepth();
+var_dump($it->getMaxDepth());
+foreach($it as $v) echo $it->getDepth() . ": $v\n";
+
+echo "===3===\n";
+$it->setMaxDepth(3);
+var_dump($it->getMaxDepth());
+foreach($it as $v) echo $it->getDepth() . ": $v\n";
+
+echo "===5===\n";
+$it->setMaxDepth(5);
+var_dump($it->getMaxDepth());
+foreach($it as $v) echo $it->getDepth() . ": $v\n";
+
+echo "===0===\n";
+$it->setMaxDepth(0);
+var_dump($it->getMaxDepth());
+foreach($it as $v) echo $it->getDepth() . ": $v\n";
+
+echo "===-1===\n";
+$it->setMaxDepth(-1);
+var_dump($it->getMaxDepth());
+try
+{
+ $it->setMaxDepth(4);
+ $it->setMaxDepth(-2);
+}
+catch(Exception $e)
+{
+ var_dump($e->getMessage());
+}
+var_dump($it->getMaxDepth());
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_028.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_028.php.expectf
new file mode 100644
index 000000000..d82e4050f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_028.php.expectf
@@ -0,0 +1,57 @@
+===?===
+bool(false)
+0: 1
+0: 2
+1: 31
+1: 32
+2: 331
+3: 3321
+4: 33221
+0: 4
+===2===
+int(2)
+0: 1
+0: 2
+1: 31
+1: 32
+2: 331
+0: 4
+===X===
+bool(false)
+0: 1
+0: 2
+1: 31
+1: 32
+2: 331
+3: 3321
+4: 33221
+0: 4
+===3===
+int(3)
+0: 1
+0: 2
+1: 31
+1: 32
+2: 331
+3: 3321
+0: 4
+===5===
+int(5)
+0: 1
+0: 2
+1: 31
+1: 32
+2: 331
+3: 3321
+4: 33221
+0: 4
+===0===
+int(0)
+0: 1
+0: 2
+0: 4
+===-1===
+bool(false)
+string(33) "Parameter max_depth must be >= -1"
+int(4)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_029.php b/hphp/test/zend/bad/ext-spl/iterator_029.php
new file mode 100644
index 000000000..8df1bc658
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_029.php
@@ -0,0 +1,21 @@
+ "abc", "a2b", 22, "a2d" => 7, 42);
+
+foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v)
+{
+ echo "$k=>$v\n";
+}
+
+?>
+===KEY===
+ $v)
+{
+ echo "$k=>$v\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_029.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_029.php.expectf
new file mode 100644
index 000000000..fd8f145a2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_029.php.expectf
@@ -0,0 +1,13 @@
+1=>123
+2=>123
+23=>a2b
+24=>22
+25=>42
+===KEY===
+2=>123
+22=>abc
+23=>a2b
+24=>22
+a2d=>7
+25=>42
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_030.php b/hphp/test/zend/bad/ext-spl/iterator_030.php
new file mode 100644
index 000000000..8701a3b13
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_030.php
@@ -0,0 +1,33 @@
+valid());
+$it->rewind();
+var_dump($it->valid());
+$it->next();
+var_dump($it->valid());
+
+try
+{
+ var_dump($it->key());
+}
+catch(BadMethodCallException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+try
+{
+ var_dump($it->current());
+}
+catch(BadMethodCallException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+var_dump($it->valid());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_030.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_030.php.expectf
new file mode 100644
index 000000000..b84267eaf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_030.php.expectf
@@ -0,0 +1,7 @@
+bool(false)
+bool(false)
+bool(false)
+Accessing the key of an EmptyIterator
+Accessing the value of an EmptyIterator
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_031.php b/hphp/test/zend/bad/ext-spl/iterator_031.php
new file mode 100644
index 000000000..f4c62e884
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_031.php
@@ -0,0 +1,83 @@
+$v)
+{
+ echo "$k=>$v\n";
+}
+
+class MyAppendIterator extends AppendIterator
+{
+ function __construct()
+ {
+ echo __METHOD__ . "\n";
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+
+ function append(Iterator $what)
+ {
+ echo __METHOD__ . "\n";
+ parent::append($what);
+ }
+
+ function parent__construct()
+ {
+ parent::__construct();
+ }
+}
+
+$ap = new MyAppendIterator;
+
+try
+{
+ $ap->append($it);
+}
+catch(LogicException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+$ap->parent__construct();
+
+try
+{
+ $ap->parent__construct($it);
+}
+catch(BadMethodCallException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+$ap->append($it);
+$ap->append($it);
+$ap->append($it);
+
+foreach($ap as $k=>$v)
+{
+ echo "$k=>$v\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_031.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_031.php.expectf
new file mode 100644
index 000000000..14db4c028
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_031.php.expectf
@@ -0,0 +1,29 @@
+MyArrayIterator::rewind
+0=>1
+1=>2
+MyAppendIterator::__construct
+MyAppendIterator::append
+The object is in an invalid state as the parent constructor was not called
+AppendIterator::getIterator() must be called exactly once per instance
+MyAppendIterator::append
+MyArrayIterator::rewind
+MyAppendIterator::append
+MyAppendIterator::append
+MyAppendIterator::rewind
+MyArrayIterator::rewind
+MyAppendIterator::valid
+0=>1
+MyAppendIterator::valid
+1=>2
+MyArrayIterator::rewind
+MyAppendIterator::valid
+0=>1
+MyAppendIterator::valid
+1=>2
+MyArrayIterator::rewind
+MyAppendIterator::valid
+0=>1
+MyAppendIterator::valid
+1=>2
+MyAppendIterator::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_032.php b/hphp/test/zend/bad/ext-spl/iterator_032.php
new file mode 100644
index 000000000..9c46131b3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_032.php
@@ -0,0 +1,37 @@
+$v)
+{
+ echo "$k=>$v\n";
+ var_dump($it->getPosition());
+}
+
+try
+{
+ $it->seek(0);
+}
+catch(OutOfBoundsException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+$it->seek(2);
+var_dump($it->current());
+
+try
+{
+ $it->seek(3);
+}
+catch(OutOfBoundsException $e)
+{
+ echo $e->getMessage() . "\n";
+}
+
+$it->next();
+var_dump($it->valid());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_032.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_032.php.expectf
new file mode 100644
index 000000000..0edb2ac3d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_032.php.expectf
@@ -0,0 +1,9 @@
+1=>2
+int(1)
+2=>3
+int(2)
+Cannot seek to 0 which is below the offset 1
+int(3)
+Cannot seek to 3 which is behind offset 1 plus count 2
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_033.php b/hphp/test/zend/bad/ext-spl/iterator_033.php
new file mode 100644
index 000000000..2849f7db7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_033.php
@@ -0,0 +1,21 @@
+$v)
+{
+ var_dump($k);
+ var_dump($v);
+}
+
+echo "==SECOND==\n";
+
+foreach(new RecursiveIteratorIterator($it, 1) as $k=>$v)
+{
+ var_dump($k);
+ var_dump($v);
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_033.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_033.php.expectf
new file mode 100644
index 000000000..a5302fbef
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_033.php.expectf
@@ -0,0 +1,19 @@
+==SECOND==
+int(1)
+array(3) {
+ [0]=>
+ int(21)
+ [1]=>
+ int(22)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(231)
+ }
+}
+int(2)
+array(1) {
+ [0]=>
+ int(231)
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_034.php b/hphp/test/zend/bad/ext-spl/iterator_034.php
new file mode 100644
index 000000000..b01607d71
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_034.php
@@ -0,0 +1,118 @@
+max_depth = $max_depth;
+ parent::__construct($it);
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "() - BEGIN\n";
+ parent::rewind();
+ echo __METHOD__ . "() - DONE\n";
+ }
+
+ 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";
+ parent::next();
+ }
+
+ function callHasChildren()
+ {
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ return $res;
+ }
+
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ parent::beginChildren();
+ }
+
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ parent::endChildren();
+ }
+}
+
+$p = 0;
+$it = new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2);
+foreach($it as $k=>$v)
+{
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+ if ($p++ == 5)
+ {
+ echo "===BREAK===\n";
+ break;
+ }
+}
+
+echo "===FOREND===\n";
+
+$it->rewind();
+
+echo "===CHECK===\n";
+
+var_dump($it->valid());
+var_dump($it->current() == "a");
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_034.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_034.php.expectf
new file mode 100644
index 000000000..38d96d077
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_034.php.expectf
@@ -0,0 +1,66 @@
+RecursiveArrayIteratorIterator::rewind() - BEGIN
+MyRecursiveArrayIterator::rewind()
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::rewind() - DONE
+RecursiveArrayIteratorIterator::valid()
+RecursiveArrayIteratorIterator::current()
+RecursiveArrayIteratorIterator::key()
+0=>a
+RecursiveArrayIteratorIterator::next()
+RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
+MyRecursiveArrayIterator::getChildren()
+MyRecursiveArrayIterator::rewind()
+RecursiveArrayIteratorIterator::beginChildren(1)
+RecursiveArrayIteratorIterator::callHasChildren(1) = no/no
+RecursiveArrayIteratorIterator::valid()
+RecursiveArrayIteratorIterator::current()
+RecursiveArrayIteratorIterator::key()
+0=>ba
+RecursiveArrayIteratorIterator::next()
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+MyRecursiveArrayIterator::getChildren()
+MyRecursiveArrayIterator::rewind()
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid()
+RecursiveArrayIteratorIterator::current()
+RecursiveArrayIteratorIterator::key()
+0=>bba
+RecursiveArrayIteratorIterator::next()
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/no
+RecursiveArrayIteratorIterator::valid()
+RecursiveArrayIteratorIterator::current()
+RecursiveArrayIteratorIterator::key()
+1=>bbb
+RecursiveArrayIteratorIterator::next()
+MyRecursiveArrayIterator::valid() = false
+RecursiveArrayIteratorIterator::endChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(1) = yes/yes
+MyRecursiveArrayIterator::getChildren()
+MyRecursiveArrayIterator::rewind()
+RecursiveArrayIteratorIterator::beginChildren(2)
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid()
+RecursiveArrayIteratorIterator::current()
+RecursiveArrayIteratorIterator::key()
+0=>bcaa
+RecursiveArrayIteratorIterator::next()
+RecursiveArrayIteratorIterator::callHasChildren(2) = no/yes
+RecursiveArrayIteratorIterator::valid()
+RecursiveArrayIteratorIterator::current()
+RecursiveArrayIteratorIterator::key()
+1=>bcba
+===BREAK===
+===FOREND===
+RecursiveArrayIteratorIterator::rewind() - BEGIN
+RecursiveArrayIteratorIterator::endChildren(1)
+RecursiveArrayIteratorIterator::endChildren(0)
+MyRecursiveArrayIterator::rewind()
+RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
+RecursiveArrayIteratorIterator::rewind() - DONE
+===CHECK===
+RecursiveArrayIteratorIterator::valid()
+bool(true)
+RecursiveArrayIteratorIterator::current()
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_035.php b/hphp/test/zend/bad/ext-spl/iterator_035.php
new file mode 100644
index 000000000..6e8d967f1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_035.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_035.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_035.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_035.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_037.php b/hphp/test/zend/bad/ext-spl/iterator_037.php
new file mode 100644
index 000000000..ded842365
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_037.php
@@ -0,0 +1,88 @@
+setFlags($flags);
+ }
+ catch (Exception $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ var_dump($it->getFlags());
+ return;
+ }
+ var_dump($it->getFlags());
+ try
+ {
+ foreach($it as $v)
+ {
+ var_dump((string)$it);
+ }
+ }
+ catch (Exception $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ }
+}
+
+class MyItem
+{
+ function __construct($value)
+ {
+ $this->value = $value;
+ }
+
+ function __toString()
+ {
+ return (string)$this->value;
+ }
+}
+
+class MyArrayIterator extends ArrayIterator
+{
+ function __toString()
+ {
+ return $this->key() . ':' . $this->current();
+ }
+}
+
+$ar = new MyArrayIterator(array(1, 2, 3));
+
+test($ar, CachingIterator::CALL_TOSTRING);
+test($ar, CachingIterator::TOSTRING_USE_KEY);
+test($ar, CachingIterator::TOSTRING_USE_CURRENT);
+
+$ar = new MyArrayIterator(array(new MyItem(1), new MyItem(2), new MyItem(3)));
+
+test($ar, CachingIterator::TOSTRING_USE_INNER);
+test($ar, CachingIterator::CALL_TOSTRING | CachingIterator::TOSTRING_USE_KEY);
+test($ar, CachingIterator::CALL_TOSTRING | CachingIterator::TOSTRING_USE_CURRENT);
+test($ar, CachingIterator::CALL_TOSTRING | CachingIterator::TOSTRING_USE_INNER);
+test($ar, CachingIterator::TOSTRING_USE_KEY | CachingIterator::TOSTRING_USE_CURRENT);
+test($ar, CachingIterator::TOSTRING_USE_KEY | CachingIterator::TOSTRING_USE_INNER);
+
+echo "===X===\n";
+try
+{
+ $it = new CachingIterator($ar, CachingIterator::CALL_TOSTRING);
+ $it->setFlags(0);
+}
+catch (Exception $e)
+{
+ echo 'Exception: ' . $e->getMessage() . "\n";
+}
+try
+{
+ $it = new CachingIterator($ar, CachingIterator::TOSTRING_USE_INNER);
+ $it->setFlags(0);
+}
+catch (Exception $e)
+{
+ echo 'Exception: ' . $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_037.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_037.php.expectf
new file mode 100644
index 000000000..393d61bc8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_037.php.expectf
@@ -0,0 +1,39 @@
+===1===
+int(1)
+string(1) "1"
+string(1) "2"
+string(1) "3"
+===2===
+int(2)
+string(1) "0"
+string(1) "1"
+string(1) "2"
+===4===
+int(4)
+string(1) "1"
+string(1) "2"
+string(1) "3"
+===8===
+int(8)
+string(3) "0:1"
+string(3) "1:2"
+string(3) "2:3"
+===3===
+Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
+int(0)
+===5===
+Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
+int(0)
+===9===
+Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
+int(0)
+===6===
+Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
+int(0)
+===10===
+Exception: Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
+int(0)
+===X===
+Exception: Unsetting flag CALL_TO_STRING is not possible
+Exception: Unsetting flag TOSTRING_USE_INNER is not possible
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_038.php b/hphp/test/zend/bad/ext-spl/iterator_038.php
new file mode 100644
index 000000000..85aa38d73
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_038.php
@@ -0,0 +1,10 @@
+0, 'World'=>1))) as $k => $v)
+{
+ var_dump($v);
+ var_dump($k);
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_038.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_038.php.expectf
new file mode 100644
index 000000000..ed159839f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_038.php.expectf
@@ -0,0 +1,5 @@
+int(0)
+string(5) "Hello"
+int(1)
+string(5) "World"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_039.php b/hphp/test/zend/bad/ext-spl/iterator_039.php
new file mode 100644
index 000000000..361008209
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_039.php
@@ -0,0 +1,67 @@
+a = $a;
+ }
+
+ public function valid()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i < count($this->a);
+ }
+
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->i = 0;
+ }
+
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i;
+ }
+
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return $this->a[$this->i];
+ }
+
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->i++;
+ }
+}
+
+$it = new LimitIterator(new NumericArrayIterator(array(12, 25, 42, 56)));
+
+foreach($it as $k => $v)
+{
+ var_dump($k);
+ var_dump($v);
+}
+
+echo "===SEEK===\n";
+
+$it->seek(2);
+
+echo "===LOOP===\n";
+
+foreach(new NoRewindIterator($it) as $k => $v)
+{
+ var_dump($k);
+ var_dump($v);
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_039.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_039.php.expectf
new file mode 100644
index 000000000..2edb23f3d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_039.php.expectf
@@ -0,0 +1,50 @@
+NumericArrayIterator::__construct
+NumericArrayIterator::rewind
+NumericArrayIterator::valid
+NumericArrayIterator::valid
+NumericArrayIterator::current
+NumericArrayIterator::key
+int(0)
+int(12)
+NumericArrayIterator::next
+NumericArrayIterator::valid
+NumericArrayIterator::current
+NumericArrayIterator::key
+int(1)
+int(25)
+NumericArrayIterator::next
+NumericArrayIterator::valid
+NumericArrayIterator::current
+NumericArrayIterator::key
+int(2)
+int(42)
+NumericArrayIterator::next
+NumericArrayIterator::valid
+NumericArrayIterator::current
+NumericArrayIterator::key
+int(3)
+int(56)
+NumericArrayIterator::next
+NumericArrayIterator::valid
+===SEEK===
+NumericArrayIterator::rewind
+NumericArrayIterator::valid
+NumericArrayIterator::next
+NumericArrayIterator::valid
+NumericArrayIterator::next
+NumericArrayIterator::valid
+NumericArrayIterator::valid
+NumericArrayIterator::current
+NumericArrayIterator::key
+===LOOP===
+int(2)
+int(42)
+NumericArrayIterator::next
+NumericArrayIterator::valid
+NumericArrayIterator::current
+NumericArrayIterator::key
+int(3)
+int(56)
+NumericArrayIterator::next
+NumericArrayIterator::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_040.php b/hphp/test/zend/bad/ext-spl/iterator_040.php
new file mode 100644
index 000000000..c2aa0dbba
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_040.php
@@ -0,0 +1,26 @@
+ $v)
+{
+ echo "===\n";
+ var_dump($it->getDepth());
+ var_dump($k);
+ var_dump($v);
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_040.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_040.php.expectf
new file mode 100644
index 000000000..8704b09e1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_040.php.expectf
@@ -0,0 +1,17 @@
+===
+int(0)
+int(0)
+int(1)
+===
+int(1)
+int(0)
+int(21)
+===
+int(1)
+int(1)
+int(22)
+===
+int(0)
+int(2)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_041a.php b/hphp/test/zend/bad/ext-spl/iterator_041a.php
new file mode 100644
index 000000000..9a61a16d2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_041a.php
@@ -0,0 +1,91 @@
+state = MyArrayIterator::$fail;
+ self::fail(0, __FUNCTION__);
+ parent::__construct(array(1, 2));
+ self::fail(1, __FUNCTION__);
+ }
+
+ function rewind()
+ {
+ self::fail(2, __FUNCTION__);
+ return parent::rewind();
+ }
+
+ function valid()
+ {
+ self::fail(3, __FUNCTION__);
+ return parent::valid();
+ }
+
+ function current()
+ {
+ self::fail(4, __FUNCTION__);
+ return parent::current();
+ }
+
+ function key()
+ {
+ self::fail(5, __FUNCTION__);
+ return parent::key();
+ }
+
+ function next()
+ {
+ self::fail(6, __FUNCTION__);
+ return parent::next();
+ }
+
+ function __destruct()
+ {
+ self::fail(7, __FUNCTION__);
+ }
+
+ static function test($func, $skip = null)
+ {
+ echo "===$func===\n";
+ self::$fail = 7;
+ while(self::$fail < 10)
+ {
+ try
+ {
+ var_dump($func(new MyArrayIterator()));
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ if (isset($skip[self::$fail]))
+ {
+ self::$fail = $skip[self::$fail];
+ }
+ else
+ {
+ self::$fail++;
+ }
+ }
+ }
+}
+
+MyArrayIterator::test('iterator_to_array');
+MyArrayIterator::test('iterator_count', array(3 => 6));
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_041a.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_041a.php.expectf
new file mode 100644
index 000000000..0e8f1286a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_041a.php.expectf
@@ -0,0 +1,12 @@
+===iterator_to_array===
+State 7: __destruct()
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+===iterator_count===
+State 7: __destruct()
+int(2)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_041b.php b/hphp/test/zend/bad/ext-spl/iterator_041b.php
new file mode 100644
index 000000000..e67066ff6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_041b.php
@@ -0,0 +1,95 @@
+state = MyArrayIterator::$fail;
+ self::fail(0, __FUNCTION__);
+ parent::__construct(array(1, 2));
+ self::fail(1, __FUNCTION__);
+ }
+
+ function rewind()
+ {
+ self::fail(2, __FUNCTION__);
+ return parent::rewind();
+ }
+
+ function valid()
+ {
+ self::fail(3, __FUNCTION__);
+ return parent::valid();
+ }
+
+ function current()
+ {
+ self::fail(4, __FUNCTION__);
+ return parent::current();
+ }
+
+ function key()
+ {
+ self::fail(5, __FUNCTION__);
+ return parent::key();
+ }
+
+ function next()
+ {
+ self::fail(6, __FUNCTION__);
+ return parent::next();
+ }
+
+ function __destruct()
+ {
+ self::fail(7, __FUNCTION__);
+ }
+
+ static function test($func, $skip = null)
+ {
+ echo "===$func===\n";
+ self::$fail = 0;
+ while(self::$fail < 10)
+ {
+ try
+ {
+ var_dump($func(new MyArrayIterator()));
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ if (isset($skip[self::$fail]))
+ {
+ self::$fail = $skip[self::$fail];
+ }
+ else
+ {
+ self::$fail++;
+ }
+ try {
+ $e = null;
+ } catch (Exception $e) {
+ }
+ }
+ }
+}
+
+MyArrayIterator::test('iterator_to_array');
+MyArrayIterator::test('iterator_count', array(3 => 6));
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_041b.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_041b.php.expectf
new file mode 100644
index 000000000..e98394204
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_041b.php.expectf
@@ -0,0 +1,24 @@
+===iterator_to_array===
+State 0: __construct()
+State 1: __construct()
+State 2: rewind()
+State 3: valid()
+State 4: current()
+State 5: key()
+State 6: next()
+State 7: __destruct()
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+===iterator_count===
+State 0: __construct()
+State 1: __construct()
+State 2: rewind()
+State 3: valid()
+State 6: next()
+State 7: __destruct()
+int(2)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_042.php b/hphp/test/zend/bad/ext-spl/iterator_042.php
new file mode 100644
index 000000000..e1de7a875
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_042.php
@@ -0,0 +1,35 @@
+append(array());
+$it->append(new ArrayIterator(array(1)));
+$it->append(new ArrayIterator(array(21, 22)));
+
+var_dump($it->getArrayIterator());
+
+$it->append(new ArrayIterator(array(31, 32, 33)));
+
+var_dump($it->getArrayIterator());
+
+$idx = 0;
+
+foreach($it as $k => $v)
+{
+ echo '===' . $idx++ . "===\n";
+ var_dump($it->getIteratorIndex());
+ var_dump($k);
+ var_dump($v);
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_042.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_042.php.expectf
new file mode 100644
index 000000000..be3afe789
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_042.php.expectf
@@ -0,0 +1,84 @@
+Error Argument 1 passed to AppendIterator::append() must implement interface Iterator, array given in %siterator_042.php on line %d
+object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(2) {
+ [0]=>
+ object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+ [1]=>
+ object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(2) {
+ [0]=>
+ int(21)
+ [1]=>
+ int(22)
+ }
+ }
+ }
+}
+object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(3) {
+ [0]=>
+ object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+ [1]=>
+ object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(2) {
+ [0]=>
+ int(21)
+ [1]=>
+ int(22)
+ }
+ }
+ [2]=>
+ object(ArrayIterator)#5 (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(3) {
+ [0]=>
+ int(31)
+ [1]=>
+ int(32)
+ [2]=>
+ int(33)
+ }
+ }
+ }
+}
+===0===
+int(0)
+int(0)
+int(1)
+===1===
+int(1)
+int(0)
+int(21)
+===2===
+int(1)
+int(1)
+int(22)
+===3===
+int(2)
+int(0)
+int(31)
+===4===
+int(2)
+int(1)
+int(32)
+===5===
+int(2)
+int(2)
+int(33)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_043.php b/hphp/test/zend/bad/ext-spl/iterator_043.php
new file mode 100644
index 000000000..2a8f4cc29
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_043.php
@@ -0,0 +1,11 @@
+getChildren());
+$it->rewind();
+var_dump($it->getChildren());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_043.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_043.php.expectf
new file mode 100644
index 000000000..e06ee1ac3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_043.php.expectf
@@ -0,0 +1,3 @@
+NULL
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_044.php b/hphp/test/zend/bad/ext-spl/iterator_044.php
new file mode 100644
index 000000000..3679a54a5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_044.php
@@ -0,0 +1,67 @@
+ $v)
+ {
+ echo "===$k===\n";
+ var_dump($v);
+ var_dump($this->offsetExists($v));
+ var_dump($this->offsetGet($v));
+ }
+ }
+}
+
+$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)));
+
+try
+{
+ var_dump($it->offsetExists(0));
+}
+catch(Exception $e)
+{
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+
+try
+{
+ var_dump($it->offsetGet(0));
+}
+catch(Exception $e)
+{
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+
+$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE);
+
+var_dump($it->offsetExists());
+var_dump($it->offsetGet());
+
+$checks = array(0, new stdClass, new MyFoo, NULL, 2, 'foo', 3);
+
+$it->test($checks);
+
+echo "===FILL===\n";
+
+foreach($it as $v); // read all into cache
+
+$it->test($checks);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_044.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_044.php.expectf
new file mode 100644
index 000000000..cfe6f7e2b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_044.php.expectf
@@ -0,0 +1,80 @@
+Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+===0===
+int(0)
+bool(false)
+HipHop Notice: %a
+NULL
+===1===
+object(stdClass)#%d (0) {
+}
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+===2===
+object(MyFoo)#%d (0) {
+}
+bool(false)
+HipHop Notice: %a
+NULL
+===3===
+NULL
+bool(false)
+HipHop Notice: %a
+NULL
+===4===
+int(2)
+bool(false)
+HipHop Notice: %a
+NULL
+===5===
+string(3) "foo"
+bool(false)
+HipHop Notice: %a
+NULL
+===6===
+int(3)
+bool(false)
+HipHop Notice: %a
+NULL
+===FILL===
+===0===
+int(0)
+bool(true)
+int(0)
+===1===
+object(stdClass)#1 (0) {
+}
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+===2===
+object(MyFoo)#2 (0) {
+}
+bool(true)
+int(1)
+===3===
+NULL
+bool(false)
+HipHop Notice: %a
+NULL
+===4===
+int(2)
+bool(true)
+int(4)
+===5===
+string(3) "foo"
+bool(true)
+int(1)
+===6===
+int(3)
+bool(false)
+HipHop Notice: %a
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_045.php b/hphp/test/zend/bad/ext-spl/iterator_045.php
new file mode 100644
index 000000000..1f3429937
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_045.php
@@ -0,0 +1,93 @@
+ $v)
+ {
+ echo "set($k,$v)\n";
+ $this->offsetSet($k, $v);
+ }
+ }
+
+ function testUnset($ar)
+ {
+ echo __METHOD__ . "()\n";
+ foreach($ar as $k => $v)
+ {
+ echo "unset($v)\n";
+ $this->offsetUnset($v);
+ }
+ }
+
+ function fill()
+ {
+ echo __METHOD__ . "()\n";
+ foreach($this as $v) ;
+ }
+
+ function show()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($this->getCache());
+ }
+}
+
+$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)));
+
+try
+{
+ var_dump($it->offsetSet(0, 0));
+}
+catch(Exception $e)
+{
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+
+try
+{
+ var_dump($it->offsetUnset(0));
+}
+catch(Exception $e)
+{
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+
+$it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE);
+
+var_dump($it->offsetSet());
+var_dump($it->offsetSet(0));
+var_dump($it->offsetUnset());
+
+$checks = array(0 => 25, 1 => 42, 3 => 'FooBar');
+$unsets = array(0, 2);
+
+$it->testSet($checks);
+$it->show();
+$it->testUnset($unsets);
+$it->show();
+$it->fill();
+$it->show();
+$it->testSet($checks);
+$it->show();
+$it->testUnset($unsets);
+$it->show();
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_045.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_045.php.expectf
new file mode 100644
index 000000000..cb0040079
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_045.php.expectf
@@ -0,0 +1,69 @@
+Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+MyCachingIterator::testSet()
+set(0,25)
+set(1,42)
+set(3,FooBar)
+MyCachingIterator::show()
+array(3) {
+ [0]=>
+ int(25)
+ [1]=>
+ int(42)
+ [3]=>
+ string(6) "FooBar"
+}
+MyCachingIterator::testUnset()
+unset(0)
+unset(2)
+MyCachingIterator::show()
+array(2) {
+ [1]=>
+ int(42)
+ [3]=>
+ string(6) "FooBar"
+}
+MyCachingIterator::fill()
+MyCachingIterator::show()
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+MyCachingIterator::testSet()
+set(0,25)
+set(1,42)
+set(3,FooBar)
+MyCachingIterator::show()
+array(4) {
+ [0]=>
+ int(25)
+ [1]=>
+ int(42)
+ [2]=>
+ int(2)
+ [3]=>
+ string(6) "FooBar"
+}
+MyCachingIterator::testUnset()
+unset(0)
+unset(2)
+MyCachingIterator::show()
+array(2) {
+ [1]=>
+ int(42)
+ [3]=>
+ string(6) "FooBar"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_046.php b/hphp/test/zend/bad/ext-spl/iterator_046.php
new file mode 100644
index 000000000..cb1b3abe2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_046.php
@@ -0,0 +1,41 @@
+1, 'bar'=>2)), CachingIterator::TOSTRING_USE_KEY);
+
+$it->fill();
+$it->show();
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_046.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_046.php.expectf
new file mode 100644
index 000000000..213b14641
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_046.php.expectf
@@ -0,0 +1,6 @@
+MyCachingIterator::fill()
+MyCachingIterator::show()
+string(1) "0"
+string(3) "foo"
+string(3) "bar"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_047.php b/hphp/test/zend/bad/ext-spl/iterator_047.php
new file mode 100644
index 000000000..5fed78225
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_047.php
@@ -0,0 +1,62 @@
+ $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
+ }
+ MyRecursiveArrayIterator::$fail++;
+ }
+ }
+}
+
+$it = new MyRecursiveArrayIterator(array(0, array(10), 2, array(30), 4));
+$it = new MyRecursiveCachingIterator($it);
+
+$it->show();
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_047.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_047.php.expectf
new file mode 100644
index 000000000..af2df5fda
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_047.php.expectf
@@ -0,0 +1,55 @@
+===0===
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(0)
+MyRecursiveArrayIterator::hasChildren()
+MyRecursiveArrayIterator::getChildren()
+HipHop Notice: %a
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(10)
+MyRecursiveArrayIterator::hasChildren()
+int(2)
+int(2)
+MyRecursiveArrayIterator::hasChildren()
+MyRecursiveArrayIterator::getChildren()
+HipHop Notice: %a
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(30)
+MyRecursiveArrayIterator::hasChildren()
+int(4)
+int(4)
+===1===
+MyRecursiveArrayIterator::hasChildren()
+Exception: State 1: MyRecursiveArrayIterator::hasChildren() in hphp/test/zend/bad/ext-spl/iterator_047.php on line %d
+===2===
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(0)
+MyRecursiveArrayIterator::hasChildren()
+MyRecursiveArrayIterator::getChildren()
+Exception: State 2: MyRecursiveArrayIterator::getChildren() in hphp/test/zend/bad/ext-spl/iterator_047.php on line %d
+===3===
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(0)
+MyRecursiveArrayIterator::hasChildren()
+MyRecursiveArrayIterator::getChildren()
+HipHop Notice: %a
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(10)
+MyRecursiveArrayIterator::hasChildren()
+int(2)
+int(2)
+MyRecursiveArrayIterator::hasChildren()
+MyRecursiveArrayIterator::getChildren()
+HipHop Notice: %a
+MyRecursiveArrayIterator::hasChildren()
+int(0)
+int(30)
+MyRecursiveArrayIterator::hasChildren()
+int(4)
+int(4)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_048.php b/hphp/test/zend/bad/ext-spl/iterator_048.php
new file mode 100644
index 000000000..8f138063c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_048.php
@@ -0,0 +1,27 @@
+ $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+
+ function accept()
+ {
+ return $this->hasChildren() || parent::accept();
+ }
+}
+
+$ar = new RecursiveArrayIterator(array('Foo', array('Bar'), 'FooBar', array('Baz'), 'Biz'));
+$it = new MyRecursiveRegexIterator($ar, '/Bar/');
+
+$it->show();
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_048.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_048.php.expectf
new file mode 100644
index 000000000..aca38cbd8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_048.php.expectf
@@ -0,0 +1,5 @@
+int(0)
+string(3) "Bar"
+int(2)
+string(6) "FooBar"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_049.php b/hphp/test/zend/bad/ext-spl/iterator_049.php
new file mode 100644
index 000000000..9d314d365
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_049.php
@@ -0,0 +1,9 @@
+NULL));
+@var_dump($ar);
+var_dump($ar->getArrayCopy());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_049.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_049.php.expectf
new file mode 100644
index 000000000..ca36ba76b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_049.php.expectf
@@ -0,0 +1,12 @@
+object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(1) {
+ [""]=>
+ NULL
+ }
+}
+array(1) {
+ [""]=>
+ NULL
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_049b.php b/hphp/test/zend/bad/ext-spl/iterator_049b.php
new file mode 100644
index 000000000..70b678caa
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_049b.php
@@ -0,0 +1,16 @@
+1,
+ "\0"=>2,
+ "\0\0"=>3,
+ "\0\0\0"=>4,
+ "\0*"=>5,
+ "\0*\0"=>6,
+ ));
+@var_dump($ar);
+var_dump($ar->getArrayCopy());
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_049b.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_049b.php.expectf
new file mode 100644
index 000000000..af0319bbd
Binary files /dev/null and b/hphp/test/zend/bad/ext-spl/iterator_049b.php.expectf differ
diff --git a/hphp/test/zend/bad/ext-spl/iterator_050.php b/hphp/test/zend/bad/ext-spl/iterator_050.php
new file mode 100644
index 000000000..45eacfd6a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_050.php
@@ -0,0 +1,26 @@
+ $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+}
+
+$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
+$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::GET_MATCH);
+$it->show();
+
+$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::GET_MATCH);
+$it->show();
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_050.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_050.php.expectf
new file mode 100644
index 000000000..2fffee652
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_050.php.expectf
@@ -0,0 +1,66 @@
+int(1)
+array(3) {
+ [0]=>
+ %s(3) "1,2"
+ [1]=>
+ %s(1) "1"
+ [2]=>
+ %s(1) "2"
+}
+int(2)
+array(3) {
+ [0]=>
+ %s(3) "1,2"
+ [1]=>
+ %s(1) "1"
+ [2]=>
+ %s(1) "2"
+}
+HipHop Notice: %a
+int(0)
+array(2) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(1) "1"
+}
+int(1)
+array(2) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(1) "1"
+}
+int(2)
+array(2) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(1) "1"
+}
+HipHop Notice: %a
+object(ArrayIterator)#%d (1) {
+ %s"storage"%s"ArrayIterator":private]=>
+ array(9) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(3) "1,2"
+ [2]=>
+ %s(5) "1,2,3"
+ [3]=>
+ %s(0) ""
+ [4]=>
+ NULL
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ %s(6) "FooBar"
+ [7]=>
+ %s(1) ","
+ [8]=>
+ %s(2) ",,"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_051.php b/hphp/test/zend/bad/ext-spl/iterator_051.php
new file mode 100644
index 000000000..e13021168
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_051.php
@@ -0,0 +1,26 @@
+ $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+}
+
+$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6));
+$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::GET_MATCH, RegexIterator::USE_KEY);
+$it->show();
+
+$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::GET_MATCH, RegexIterator::USE_KEY);
+$it->show();
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_051.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_051.php.expectf
new file mode 100644
index 000000000..b5ae88001
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_051.php.expectf
@@ -0,0 +1,66 @@
+string(3) "1,2"
+array(3) {
+ [0]=>
+ string(3) "1,2"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+}
+string(5) "1,2,3"
+array(3) {
+ [0]=>
+ string(3) "1,2"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+}
+int(1)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+string(3) "1,2"
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+string(5) "1,2,3"
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+int(0)
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(1) "0"
+}
+object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(7) {
+ [1]=>
+ int(0)
+ ["1,2"]=>
+ int(1)
+ ["1,2,3"]=>
+ int(2)
+ [0]=>
+ int(3)
+ ["FooBar"]=>
+ int(4)
+ [","]=>
+ int(5)
+ [",,"]=>
+ int(6)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_052.php b/hphp/test/zend/bad/ext-spl/iterator_052.php
new file mode 100644
index 000000000..9c27b48d2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_052.php
@@ -0,0 +1,43 @@
+uk = $flags & self::USE_KEY;
+ $this->re = $re;
+ parent::__construct($it, $re, $mode, $flags);
+ }
+
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+
+ function accept()
+ {
+ @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub);
+ $ret = parent::accept();
+ var_dump($sub == $this->current());
+ return $ret;
+ }
+}
+
+$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
+$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::ALL_MATCHES);
+$it->show();
+
+$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::ALL_MATCHES);
+$it->show();
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_052.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_052.php.expectf
new file mode 100644
index 000000000..0b0cf7a95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_052.php.expectf
@@ -0,0 +1,270 @@
+bool(true)
+int(0)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(1)
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(3) "1,2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ string(1) "2"
+ }
+}
+bool(true)
+int(2)
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(3) "1,2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ string(1) "2"
+ }
+}
+bool(true)
+int(3)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(4)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+HipHop Notice: %a
+bool(true)
+int(5)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(6)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(7)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(8)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(0)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+bool(true)
+int(1)
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ }
+}
+bool(true)
+int(2)
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ }
+}
+bool(true)
+int(3)
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+bool(true)
+int(4)
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+HipHop Notice: %a
+bool(true)
+int(5)
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+bool(true)
+int(6)
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+bool(true)
+int(7)
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+bool(true)
+int(8)
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(9) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(3) "1,2"
+ [2]=>
+ %s(5) "1,2,3"
+ [3]=>
+ %s(0) ""
+ [4]=>
+ NULL
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ %s(6) "FooBar"
+ [7]=>
+ %s(1) ","
+ [8]=>
+ %s(2) ",,"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_053.php b/hphp/test/zend/bad/ext-spl/iterator_053.php
new file mode 100644
index 000000000..e6fbe6816
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_053.php
@@ -0,0 +1,43 @@
+uk = $flags & self::USE_KEY;
+ $this->re = $re;
+ parent::__construct($it, $re, $mode, $flags);
+ }
+
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+
+ function accept()
+ {
+ @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub);
+ $ret = parent::accept();
+ var_dump($sub == $this->current());
+ return $ret;
+ }
+}
+
+$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
+$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::ALL_MATCHES, RegexIterator::USE_KEY);
+$it->show();
+
+$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::ALL_MATCHES, RegexIterator::USE_KEY);
+$it->show();
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_053.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_053.php.expectf
new file mode 100644
index 000000000..8b86ca55d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_053.php.expectf
@@ -0,0 +1,268 @@
+bool(true)
+int(0)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(1)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(2)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(3)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(4)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(5)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(6)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(7)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(8)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
+bool(true)
+int(0)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+bool(true)
+int(1)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+bool(true)
+int(2)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "2"
+ }
+}
+bool(true)
+int(3)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "3"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "3"
+ }
+}
+bool(true)
+int(4)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "4"
+ }
+}
+bool(true)
+int(5)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "5"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "5"
+ }
+}
+bool(true)
+int(6)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "6"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "6"
+ }
+}
+bool(true)
+int(7)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "7"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "7"
+ }
+}
+bool(true)
+int(8)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "8"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "8"
+ }
+}
+object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(9) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(3) "1,2"
+ [2]=>
+ %s(5) "1,2,3"
+ [3]=>
+ %s(0) ""
+ [4]=>
+ NULL
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ %s(6) "FooBar"
+ [7]=>
+ %s(1) ","
+ [8]=>
+ %s(2) ",,"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_054.php b/hphp/test/zend/bad/ext-spl/iterator_054.php
new file mode 100644
index 000000000..b69155ebd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_054.php
@@ -0,0 +1,24 @@
+ $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+}
+
+$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
+$it = new MyRegexIterator($ar, '/,/', RegexIterator::SPLIT);
+
+$it->show();
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_054.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_054.php.expectf
new file mode 100644
index 000000000..4b86cb84e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_054.php.expectf
@@ -0,0 +1,58 @@
+int(1)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+}
+int(2)
+array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+}
+HipHop Notice: %a
+int(7)
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+int(8)
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+}
+object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(9) {
+ [0]=>
+ %s(1) "1"
+ [1]=>
+ %s(3) "1,2"
+ [2]=>
+ %s(5) "1,2,3"
+ [3]=>
+ %s(0) ""
+ [4]=>
+ NULL
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ %s(6) "FooBar"
+ [7]=>
+ %s(1) ","
+ [8]=>
+ %s(2) ",,"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_055.php b/hphp/test/zend/bad/ext-spl/iterator_055.php
new file mode 100644
index 000000000..34c754c8b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_055.php
@@ -0,0 +1,24 @@
+ $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+}
+
+$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6));
+$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::SPLIT, RegexIterator::USE_KEY);
+
+$it->show();
+
+var_dump($ar);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_055.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_055.php.expectf
new file mode 100644
index 000000000..1960d3f88
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_055.php.expectf
@@ -0,0 +1,34 @@
+string(3) "1,2"
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+string(5) "1,2,3"
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(2) ",3"
+}
+object(ArrayIterator)#%d (1) {
+ ["storage":"ArrayIterator":private]=>
+ array(7) {
+ [1]=>
+ int(0)
+ ["1,2"]=>
+ int(1)
+ ["1,2,3"]=>
+ int(2)
+ [0]=>
+ int(3)
+ ["FooBar"]=>
+ int(4)
+ [","]=>
+ int(5)
+ [",,"]=>
+ int(6)
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_056.php b/hphp/test/zend/bad/ext-spl/iterator_056.php
new file mode 100644
index 000000000..8919e3a2d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_056.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_056.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_056.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_056.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_057.php b/hphp/test/zend/bad/ext-spl/iterator_057.php
new file mode 100644
index 000000000..291ffaf9d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_057.php
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_057.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_057.php.expectf
new file mode 100644
index 000000000..c2317d63a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_057.php.expectf
@@ -0,0 +1 @@
+no Exception thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_059.php b/hphp/test/zend/bad/ext-spl/iterator_059.php
new file mode 100644
index 000000000..ba14010a8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_059.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_059.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_059.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_059.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_060.php b/hphp/test/zend/bad/ext-spl/iterator_060.php
new file mode 100644
index 000000000..426c97760
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_060.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_060.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_060.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_060.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_061.php b/hphp/test/zend/bad/ext-spl/iterator_061.php
new file mode 100644
index 000000000..c12cc3e0b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_061.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_061.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_061.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_061.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_062.php b/hphp/test/zend/bad/ext-spl/iterator_062.php
new file mode 100644
index 000000000..2da1cb21f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_062.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_062.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_062.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_062.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_063.php b/hphp/test/zend/bad/ext-spl/iterator_063.php
new file mode 100644
index 000000000..f0b4989c2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_063.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_063.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_063.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_063.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_064.php b/hphp/test/zend/bad/ext-spl/iterator_064.php
new file mode 100644
index 000000000..bc15fa45f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_064.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_064.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_064.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_064.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_065.php b/hphp/test/zend/bad/ext-spl/iterator_065.php
new file mode 100644
index 000000000..7937cc75e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_065.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_065.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_065.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_065.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_066.php b/hphp/test/zend/bad/ext-spl/iterator_066.php
new file mode 100644
index 000000000..8f7e0eced
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_066.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_066.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_066.php.expectf
new file mode 100644
index 000000000..194c0ff95
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_066.php.expectf
@@ -0,0 +1 @@
+InvalidArgumentException thrown
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_070.php b/hphp/test/zend/bad/ext-spl/iterator_070.php
new file mode 100644
index 000000000..02534bcd4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_070.php
@@ -0,0 +1,12 @@
+beginIteration());
+var_dump($recItIt->endIteration());
+var_dump($recItIt->nextElement());
+
+?>
diff --git a/hphp/test/zend/bad/ext-spl/iterator_070.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_070.php.expectf
new file mode 100644
index 000000000..7aca65c67
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_070.php.expectf
@@ -0,0 +1,3 @@
+NULL
+NULL
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_071.php b/hphp/test/zend/bad/ext-spl/iterator_071.php
new file mode 100644
index 000000000..bd82b66d4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_071.php
@@ -0,0 +1,20 @@
+getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function nextelement() {
+ echo __METHOD__."\n";
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
+
+foreach ($recItIt as $key => $val) echo "$key\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_071.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_071.php.expectf
new file mode 100644
index 000000000..02c2a885e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_071.php.expectf
@@ -0,0 +1,8 @@
+MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
+1
+MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
+1
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_count.php b/hphp/test/zend/bad/ext-spl/iterator_count.php
new file mode 100644
index 000000000..60262006f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_count.php
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_count.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_count.php.expectf
new file mode 100644
index 000000000..f9ae1cde6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_count.php.expectf
@@ -0,0 +1,4 @@
+HipHop Warning: %a
+HipHop Warning: %a
+
+Catchable fatal error: Argument 1 passed to iterator_count() must implement interface Traversable, %unicode_string_optional% given %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_to_array.php b/hphp/test/zend/bad/ext-spl/iterator_to_array.php
new file mode 100644
index 000000000..5f72bdf52
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_to_array.php
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/iterator_to_array.php.expectf b/hphp/test/zend/bad/ext-spl/iterator_to_array.php.expectf
new file mode 100644
index 000000000..d6b55d544
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/iterator_to_array.php.expectf
@@ -0,0 +1,4 @@
+HipHop Warning: %a
+HipHop Warning: %a
+
+Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, %unicode_string_optional% given %s
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/limititerator_seek.php b/hphp/test/zend/bad/ext-spl/limititerator_seek.php
new file mode 100644
index 000000000..f020880a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/limititerator_seek.php
@@ -0,0 +1,8 @@
+seek(1,1); // Should throw a warning as seek expects only 1 argument
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/limititerator_seek.php.expectf b/hphp/test/zend/bad/ext-spl/limititerator_seek.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/limititerator_seek.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/multiple_iterator_001.php b/hphp/test/zend/bad/ext-spl/multiple_iterator_001.php
new file mode 100644
index 000000000..409d66583
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/multiple_iterator_001.php
@@ -0,0 +1,102 @@
+current());
+
+$m->attachIterator($iter1);
+$m->attachIterator($iter2);
+$m->attachIterator($iter3);
+
+echo "-- Default flags, MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC --\n";
+
+var_dump($m->getFlags() === (MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC));
+
+foreach($m as $value) {
+ var_dump($m->key(), $value);
+}
+try {
+ $m->current();
+} catch(RuntimeException $e) {
+ echo "RuntimeException thrown: " . $e->getMessage() . "\n";
+}
+try {
+ $m->key();
+} catch(RuntimeException $e) {
+ echo "RuntimeException thrown: " . $e->getMessage() . "\n";
+}
+
+echo "-- Flags = MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC --\n";
+
+$m->setFlags(MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC);
+var_dump($m->getFlags() === (MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC));
+
+foreach($m as $value) {
+ var_dump($m->key(), $value);
+}
+
+echo "-- Default flags, added element --\n";
+
+$m->setFlags(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC);
+
+$iter2[] = 3;
+foreach($m as $value) {
+ var_dump($m->key(), $value);
+}
+
+echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated with NULL --\n";
+
+$m->setFlags(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_ASSOC);
+$m->rewind();
+try {
+ $m->current();
+} catch(InvalidArgumentException $e) {
+ echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+}
+
+echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC --\n";
+
+$m->attachIterator($iter1, "iter1");
+$m->attachIterator($iter2, b"iter2");
+$m->attachIterator($iter3, 3);
+
+foreach($m as $value) {
+ var_dump($m->key(), $value);
+}
+
+echo "-- Associate with invalid value --\n";
+
+try {
+ $m->attachIterator($iter3, new stdClass());
+} catch(InvalidArgumentException $e) {
+ echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+}
+
+echo "-- Associate with duplicate value --\n";
+
+try {
+ $m->attachIterator($iter3, "iter1");
+} catch(InvalidArgumentException $e) {
+ echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+}
+
+echo "-- Count, contains, detach, count, contains, iterate --\n";
+
+var_dump($m->countIterators());
+var_dump($m->containsIterator($iter2));
+var_dump($m->detachIterator($iter2));
+var_dump($m->countIterators());
+var_dump($m->containsIterator($iter2));
+foreach($m as $value) {
+ var_dump($m->key(), $value);
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/multiple_iterator_001.php.expectf b/hphp/test/zend/bad/ext-spl/multiple_iterator_001.php.expectf
new file mode 100644
index 000000000..1489ef5bc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/multiple_iterator_001.php.expectf
@@ -0,0 +1,239 @@
+-- Default flags, no iterators --
+bool(false)
+-- Default flags, MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC --
+bool(true)
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+}
+RuntimeException thrown: Called current() with non valid sub iterator
+RuntimeException thrown: Called key() with non valid sub iterator
+-- Flags = MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC --
+bool(true)
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+}
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ NULL
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(3)
+ [1]=>
+ NULL
+ [2]=>
+ int(3)
+}
+-- Default flags, added element --
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+}
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ [2]=>
+ int(3)
+}
+-- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated with NULL --
+InvalidArgumentException thrown: Sub-Iterator is associated with NULL
+-- Flags |= MultipleIterator::MIT_KEYS_ASSOC --
+array(3) {
+ ["iter1"]=>
+ int(0)
+ ["iter2"]=>
+ int(0)
+ [3]=>
+ int(0)
+}
+array(3) {
+ ["iter1"]=>
+ int(1)
+ ["iter2"]=>
+ int(1)
+ [3]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(3) {
+ ["iter1"]=>
+ int(1)
+ ["iter2"]=>
+ int(1)
+ [3]=>
+ int(1)
+}
+array(3) {
+ ["iter1"]=>
+ int(2)
+ ["iter2"]=>
+ int(2)
+ [3]=>
+ string(6) "string"
+}
+array(3) {
+ ["iter1"]=>
+ int(2)
+ ["iter2"]=>
+ int(2)
+ [3]=>
+ int(2)
+}
+array(3) {
+ ["iter1"]=>
+ int(3)
+ ["iter2"]=>
+ int(3)
+ [3]=>
+ int(3)
+}
+-- Associate with invalid value --
+InvalidArgumentException thrown: Info must be NULL, integer or string
+-- Associate with duplicate value --
+InvalidArgumentException thrown: Key duplication error
+-- Count, contains, detach, count, contains, iterate --
+int(3)
+bool(true)
+NULL
+int(2)
+bool(false)
+array(2) {
+ ["iter1"]=>
+ int(0)
+ [3]=>
+ int(0)
+}
+array(2) {
+ ["iter1"]=>
+ int(1)
+ [3]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(2) {
+ ["iter1"]=>
+ int(1)
+ [3]=>
+ int(1)
+}
+array(2) {
+ ["iter1"]=>
+ int(2)
+ [3]=>
+ string(6) "string"
+}
+array(2) {
+ ["iter1"]=>
+ int(2)
+ [3]=>
+ int(2)
+}
+array(2) {
+ ["iter1"]=>
+ int(3)
+ [3]=>
+ int(3)
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_001.php b/hphp/test/zend/bad/ext-spl/observer_001.php
new file mode 100644
index 000000000..cb9376448
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_001.php
@@ -0,0 +1,93 @@
+name = '$' . $name;
+ }
+
+ function update(SplSubject $subject)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
+}
+
+class SubjectImpl implements SplSubject
+{
+ protected $name = '';
+ protected $observers = array();
+
+ function __construct($name = 'sub')
+ {
+ $this->name = '$' . $name;
+ }
+
+ function attach(SplObserver $observer)
+ {
+ echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ if (!in_array($observer, $this->observers))
+ {
+ $this->observers[] = $observer;
+ }
+ }
+
+ function detach(SplObserver $observer)
+ {
+ echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ $idx = array_search($observer, $this->observers);
+ if ($idx !== false)
+ {
+ unset($this->observers[$idx]);
+ }
+ }
+
+ function notify()
+ {
+ echo '$sub->' . __METHOD__ . "();\n";
+ foreach($this->observers as $observer)
+ {
+ $observer->update($this);
+ }
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
+}
+
+$sub = new SubjectImpl;
+
+$ob1 = new ObserverImpl("ob1");
+$ob2 = new ObserverImpl("ob2");
+$ob3 = new ObserverImpl("ob3");
+
+$sub->attach($ob1);
+$sub->attach($ob1);
+$sub->attach($ob2);
+$sub->attach($ob3);
+
+$sub->notify();
+
+$sub->detach($ob3);
+
+$sub->notify();
+
+$sub->detach($ob2);
+$sub->detach($ob1);
+
+$sub->notify();
+
+$sub->attach($ob3);
+
+$sub->notify();
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_001.php.expectf b/hphp/test/zend/bad/ext-spl/observer_001.php.expectf
new file mode 100644
index 000000000..02e92419f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_001.php.expectf
@@ -0,0 +1,19 @@
+$sub->SubjectImpl::attach($ob1);
+$sub->SubjectImpl::attach($ob1);
+$sub->SubjectImpl::attach($ob2);
+$sub->SubjectImpl::attach($ob3);
+$sub->SubjectImpl::notify();
+$ob1->ObserverImpl::update($sub);
+$ob2->ObserverImpl::update($sub);
+$ob3->ObserverImpl::update($sub);
+$sub->SubjectImpl::detach($ob3);
+$sub->SubjectImpl::notify();
+$ob1->ObserverImpl::update($sub);
+$ob2->ObserverImpl::update($sub);
+$sub->SubjectImpl::detach($ob2);
+$sub->SubjectImpl::detach($ob1);
+$sub->SubjectImpl::notify();
+$sub->SubjectImpl::attach($ob3);
+$sub->SubjectImpl::notify();
+$ob3->ObserverImpl::update($sub);
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_002.php b/hphp/test/zend/bad/ext-spl/observer_002.php
new file mode 100644
index 000000000..55e0a207a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_002.php
@@ -0,0 +1,138 @@
+getName() . ")\n";
+ return parent::current();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "()\n";
+ parent::next();
+ }
+}
+
+class ObserverImpl implements SplObserver
+{
+ protected $name = '';
+
+ function __construct($name = 'obj')
+ {
+ $this->name = '$' . $name;
+ }
+
+ function update(SplSubject $subject)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
+}
+
+class SubjectImpl implements SplSubject
+{
+ protected $name = '';
+ protected $observers;
+
+ function __construct($name = 'sub')
+ {
+ $this->observers = new MyObjectStorage;
+ $this->name = '$' . $name;
+ }
+
+ function attach(SplObserver $observer)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ $this->observers->attach($observer);
+ }
+
+ function detach(SplObserver $observer)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ $this->observers->detach($observer);
+ }
+
+ function count()
+ {
+ return $this->observers->count();
+ }
+
+ function notify()
+ {
+ echo $this->name . '->' . __METHOD__ . "();\n";
+ foreach($this->observers as $key => $observer)
+ {
+ $observer->update($this);
+ }
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
+
+ function contains($obj)
+ {
+ return $this->observers->contains($obj);
+ }
+}
+
+$sub = new SubjectImpl;
+
+$ob1 = new ObserverImpl("ob1");
+$ob2 = new ObserverImpl("ob2");
+$ob3 = new ObserverImpl("ob3");
+
+var_dump($sub->contains($ob1));
+$sub->attach($ob1);
+var_dump($sub->contains($ob1));
+$sub->attach($ob1);
+$sub->attach($ob2);
+$sub->attach($ob3);
+var_dump($sub->count());
+
+$sub->notify();
+
+$sub->detach($ob3);
+var_dump($sub->count());
+
+$sub->notify();
+
+$sub->detach($ob2);
+$sub->detach($ob1);
+var_dump($sub->count());
+
+$sub->notify();
+
+$sub->attach($ob3);
+var_dump($sub->count());
+
+$sub->notify();
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_002.php.expectf b/hphp/test/zend/bad/ext-spl/observer_002.php.expectf
new file mode 100644
index 000000000..893319bee
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_002.php.expectf
@@ -0,0 +1,57 @@
+bool(false)
+$sub->SubjectImpl::attach($ob1);
+bool(true)
+$sub->SubjectImpl::attach($ob1);
+$sub->SubjectImpl::attach($ob2);
+$sub->SubjectImpl::attach($ob3);
+int(3)
+$sub->SubjectImpl::notify();
+MyObjectStorage::rewind()
+MyObjectStorage::valid(1)
+MyObjectStorage::current($ob1)
+MyObjectStorage::key(0)
+$ob1->ObserverImpl::update($sub);
+MyObjectStorage::next()
+MyObjectStorage::valid(1)
+MyObjectStorage::current($ob2)
+MyObjectStorage::key(1)
+$ob2->ObserverImpl::update($sub);
+MyObjectStorage::next()
+MyObjectStorage::valid(1)
+MyObjectStorage::current($ob3)
+MyObjectStorage::key(2)
+$ob3->ObserverImpl::update($sub);
+MyObjectStorage::next()
+MyObjectStorage::valid(0)
+$sub->SubjectImpl::detach($ob3);
+int(2)
+$sub->SubjectImpl::notify();
+MyObjectStorage::rewind()
+MyObjectStorage::valid(1)
+MyObjectStorage::current($ob1)
+MyObjectStorage::key(0)
+$ob1->ObserverImpl::update($sub);
+MyObjectStorage::next()
+MyObjectStorage::valid(1)
+MyObjectStorage::current($ob2)
+MyObjectStorage::key(1)
+$ob2->ObserverImpl::update($sub);
+MyObjectStorage::next()
+MyObjectStorage::valid(0)
+$sub->SubjectImpl::detach($ob2);
+$sub->SubjectImpl::detach($ob1);
+int(0)
+$sub->SubjectImpl::notify();
+MyObjectStorage::rewind()
+MyObjectStorage::valid(0)
+$sub->SubjectImpl::attach($ob3);
+int(1)
+$sub->SubjectImpl::notify();
+MyObjectStorage::rewind()
+MyObjectStorage::valid(1)
+MyObjectStorage::current($ob3)
+MyObjectStorage::key(0)
+$ob3->ObserverImpl::update($sub);
+MyObjectStorage::next()
+MyObjectStorage::valid(0)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_007.php b/hphp/test/zend/bad/ext-spl/observer_007.php
new file mode 100644
index 000000000..acf334720
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_007.php
@@ -0,0 +1,13 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_007.php.expectf b/hphp/test/zend/bad/ext-spl/observer_007.php.expectf
new file mode 100644
index 000000000..c18d1f4b9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_007.php.expectf
@@ -0,0 +1,5 @@
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_008.php b/hphp/test/zend/bad/ext-spl/observer_008.php
new file mode 100644
index 000000000..412089841
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_008.php
@@ -0,0 +1,27 @@
+attach($o1);
+$a->attach($o2);
+
+$b = new SplObjectSTorage();
+$b->attach($o2);
+$b->attach($o3);
+
+$a->addAll($b);
+
+var_dump($a->count());
+
+$a->detach($o3);
+var_dump($a->count());
+
+$a->removeAll($b);
+var_dump($a->count());
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/observer_008.php.expectf b/hphp/test/zend/bad/ext-spl/observer_008.php.expectf
new file mode 100644
index 000000000..2a6bb7e99
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/observer_008.php.expectf
@@ -0,0 +1,4 @@
+int(3)
+int(2)
+int(1)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_001.php b/hphp/test/zend/bad/ext-spl/pqueue_001.php
new file mode 100644
index 000000000..f2c333d59
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_001.php
@@ -0,0 +1,60 @@
+extract();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+$pq->insert("a", 1);
+$pq->insert("b", 2);
+$pq->insert("c", 0);
+
+foreach ($pq as $k=>$v) {
+ echo "$k=>".print_r($v, 1)."\n";
+}
+
+echo "EXTR_BOTH\n";
+
+$pq1 = new SplPriorityQueue();
+$pq1->setExtractFlags(SplPriorityQueue::EXTR_BOTH);
+
+$pq1->insert("a", 1);
+$pq1->insert("b", 2);
+$pq1->insert("c", 0);
+
+foreach ($pq1 as $k=>$v) {
+ echo "$k=>".print_r($v, 1)."\n";
+}
+
+echo "EXTR_DATA\n";
+
+$pq2 = new SplPriorityQueue();
+$pq2->setExtractFlags(SplPriorityQueue::EXTR_DATA);
+
+$pq2->insert("a", 1);
+$pq2->insert("b", 2);
+$pq2->insert("c", 0);
+
+foreach ($pq2 as $k=>$v) {
+ echo "$k=>".print_r($v, 1)."\n";
+}
+
+echo "EXTR_PRIORITY\n";
+
+$pq3 = new SplPriorityQueue();
+$pq3->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
+
+$pq3->insert("a", 1);
+$pq3->insert("b", 2);
+$pq3->insert("c", 0);
+
+foreach ($pq3 as $k=>$v) {
+ echo "$k=>".print_r($v, 1)."\n";
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_001.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_001.php.expectf
new file mode 100644
index 000000000..9963c000d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_001.php.expectf
@@ -0,0 +1,32 @@
+Exception: Can't extract from an empty heap
+2=>b
+1=>a
+0=>c
+EXTR_BOTH
+2=>Array
+(
+ [data] => b
+ [priority] => 2
+)
+
+1=>Array
+(
+ [data] => a
+ [priority] => 1
+)
+
+0=>Array
+(
+ [data] => c
+ [priority] => 0
+)
+
+EXTR_DATA
+2=>b
+1=>a
+0=>c
+EXTR_PRIORITY
+2=>2
+1=>1
+0=>0
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_002.php b/hphp/test/zend/bad/ext-spl/pqueue_002.php
new file mode 100644
index 000000000..3e1ffdfbb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_002.php
@@ -0,0 +1,54 @@
+insert(1, 1);
+ echo "inserted 1\n";
+ $h->insert(2, 1);
+ echo "inserted 2\n";
+ $h->insert(3, 1);
+ echo "inserted 3\n";
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ $h->insert(4, 1);
+ echo "inserted 4\n";
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+
+echo "Recovering..\n";
+$h->recoverFromCorruption();
+
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+try {
+ var_dump($h->extract());
+} catch(Exception $e) {
+ echo "Exception: ".$e->getMessage()."\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_002.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_002.php.expectf
new file mode 100644
index 000000000..57b714bc4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_002.php.expectf
@@ -0,0 +1,9 @@
+inserted 1
+Exception: foo
+Exception: Heap is corrupted, heap properties are no longer ensured.
+Exception: Heap is corrupted, heap properties are no longer ensured.
+Exception: Heap is corrupted, heap properties are no longer ensured.
+Recovering..
+int(1)
+int(2)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_003.php b/hphp/test/zend/bad/ext-spl/pqueue_003.php
new file mode 100644
index 000000000..002744368
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_003.php
@@ -0,0 +1,20 @@
+insert(1, 1);
+$h->insert(5, 5);
+$h->insert(0, 0);
+$h->insert(4, 4);
+
+$h->rewind();
+echo "count(\$h) = ".count($h)."\n";
+echo "\$h->count() = ".$h->count()."\n";
+while ($h->valid()) {
+ $k = $h->key();
+ $v = $h->current();
+ echo "$k=>$v\n";
+ $h->next();
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_003.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_003.php.expectf
new file mode 100644
index 000000000..bcd87bc82
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_003.php.expectf
@@ -0,0 +1,7 @@
+count($h) = 4
+$h->count() = 4
+3=>5
+2=>4
+1=>1
+0=>0
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_004.php b/hphp/test/zend/bad/ext-spl/pqueue_004.php
new file mode 100644
index 000000000..150c9aaaf
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_004.php
@@ -0,0 +1,12 @@
+insert("a", 0);
+$pq->insert("b", 1);
+$pq->insert("c", 5);
+$pq->insert("d", -2);
+
+var_dump($pq);
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_004.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_004.php.expectf
new file mode 100644
index 000000000..cd5e1cbe7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_004.php.expectf
@@ -0,0 +1,38 @@
+object(SplPriorityQueue)#1 (3) {
+ ["flags":"SplPriorityQueue":private]=>
+ int(1)
+ ["isCorrupted":"SplPriorityQueue":private]=>
+ bool(false)
+ ["heap":"SplPriorityQueue":private]=>
+ array(4) {
+ [0]=>
+ array(2) {
+ ["data"]=>
+ string(1) "c"
+ ["priority"]=>
+ int(5)
+ }
+ [1]=>
+ array(2) {
+ ["data"]=>
+ string(1) "a"
+ ["priority"]=>
+ int(0)
+ }
+ [2]=>
+ array(2) {
+ ["data"]=>
+ string(1) "b"
+ ["priority"]=>
+ int(1)
+ }
+ [3]=>
+ array(2) {
+ ["data"]=>
+ string(1) "d"
+ ["priority"]=>
+ int(-2)
+ }
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_compare_basic.php b/hphp/test/zend/bad/ext-spl/pqueue_compare_basic.php
new file mode 100644
index 000000000..b0fc59528
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_compare_basic.php
@@ -0,0 +1,8 @@
+compare(4, 5) < 0);
+var_dump($h->compare(5, 5) == 0);
+var_dump($h->compare(5, 4) > 0);
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_compare_basic.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_compare_basic.php.expectf
new file mode 100644
index 000000000..563a8216b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_compare_basic.php.expectf
@@ -0,0 +1,4 @@
+bool(true)
+bool(true)
+bool(true)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_compare_error.php b/hphp/test/zend/bad/ext-spl/pqueue_compare_error.php
new file mode 100644
index 000000000..195f4686b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_compare_error.php
@@ -0,0 +1,6 @@
+compare();
+$h->compare(1);
+$h->compare(1, 2, 3);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_compare_error.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_compare_error.php.expectf
new file mode 100644
index 000000000..771ac268e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_compare_error.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+HipHop Warning: %a
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_current_error.php b/hphp/test/zend/bad/ext-spl/pqueue_current_error.php
new file mode 100644
index 000000000..58ae13ae5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_current_error.php
@@ -0,0 +1,4 @@
+current());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/pqueue_current_error.php.expectf b/hphp/test/zend/bad/ext-spl/pqueue_current_error.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/pqueue_current_error.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php
new file mode 100644
index 000000000..d7f79f6f4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php
@@ -0,0 +1,24 @@
+getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function beginchildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php.expectf
new file mode 100644
index 000000000..f76954af4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php.expectf
@@ -0,0 +1,7 @@
+NULL
+HipHop Fatal error: %a
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_beginchildren_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php
new file mode 100644
index 000000000..7dc05069c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php
@@ -0,0 +1,24 @@
+getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function callHasChildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt2->next());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php.expectf
new file mode 100644
index 000000000..08ad44e9e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php.expectf
@@ -0,0 +1,7 @@
+NULL
+HipHop Fatal error: %a
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_callHasChildren_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php
new file mode 100644
index 000000000..169901124
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php
@@ -0,0 +1,26 @@
+getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function endchildren() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+foreach ($recItIt as $val) echo "$val\n";
+
+$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+echo "===NEXT LOOP===\n";
+
+foreach ($recItIt2 as $val) echo "$val\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php.expectf
new file mode 100644
index 000000000..0727fc311
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php.expectf
@@ -0,0 +1,11 @@
+1
+2
+===NEXT LOOP===
+1
+2
+HipHop Fatal error: %a
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_endchildren_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php
new file mode 100644
index 000000000..29785ea13
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php
@@ -0,0 +1,24 @@
+getIterator());
+
+class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+ function nextelement() {
+ throw new Exception;
+ }
+}
+
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+var_dump($recItIt->next());
+
+$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
+
+var_dump($recItIt->next());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php.expectf
new file mode 100644
index 000000000..de2201d46
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php.expectf
@@ -0,0 +1,7 @@
+NULL
+HipHop Fatal error: %a
+Stack trace:
+#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
+#1 %s: RecursiveIteratorIterator->next()
+#2 {main}
+ thrown in hphp/test/zend/bad/ext-spl/recursiveIteratorIterator_nextelement_error.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursive_tree_iterator_setprefixpart.php b/hphp/test/zend/bad/ext-spl/recursive_tree_iterator_setprefixpart.php
new file mode 100644
index 000000000..1dbb5f1b2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursive_tree_iterator_setprefixpart.php
@@ -0,0 +1,19 @@
+ array("b")
+);
+
+$it = new RecursiveArrayIterator($arr);
+$it = new RecursiveTreeIterator($it);
+
+$it->setPrefixPart(1); // Should throw a warning as setPrefixPart expects 2 arguments
+
+$a = new stdClass();
+$it->setPrefixPart($a, 1); // Should throw a warning as setPrefixPart expects argument 1 to be long integer
+
+$it->setPrefixPart(1, $a); // Should throw a warning as setPrefixPart expects argument 2 to be a string
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursive_tree_iterator_setprefixpart.php.expectf b/hphp/test/zend/bad/ext-spl/recursive_tree_iterator_setprefixpart.php.expectf
new file mode 100644
index 000000000..5754ce0e1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursive_tree_iterator_setprefixpart.php.expectf
@@ -0,0 +1,4 @@
+HipHop Warning: %a
+HipHop Warning: %a
+HipHop Warning: %a
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_beginiteration_basic.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_beginiteration_basic.php
new file mode 100644
index 000000000..351fab692
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_beginiteration_basic.php
@@ -0,0 +1,20 @@
+next();
+ }
+}
+$iterator = new SkipsFirstElementRecursiveIteratorIterator($sub_iterator);
+foreach ($iterator as $element) {
+ var_dump($element);
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_beginiteration_basic.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_beginiteration_basic.php.expectf
new file mode 100644
index 000000000..5e0ad29a9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_beginiteration_basic.php.expectf
@@ -0,0 +1,4 @@
+int(1)
+int(2)
+::beginIteration() was invoked
+int(2)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_enditeration_basic.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_enditeration_basic.php
new file mode 100644
index 000000000..0b55f0656
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_enditeration_basic.php
@@ -0,0 +1,19 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_enditeration_basic.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_enditeration_basic.php.expectf
new file mode 100644
index 000000000..ece540c56
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_enditeration_basic.php.expectf
@@ -0,0 +1,5 @@
+int(1)
+int(2)
+int(1)
+int(2)
+::endIteration() was invoked
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_basic.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_basic.php
new file mode 100644
index 000000000..c13ac1fbc
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_basic.php
@@ -0,0 +1,10 @@
+getSubIterator() === $sub_iterator);
+var_dump($iterator->getSubIterator() === $not_sub_iterator);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_basic.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_basic.php.expectf
new file mode 100644
index 000000000..98b68cefa
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_basic.php.expectf
@@ -0,0 +1,2 @@
+bool(true)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_error.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_error.php
new file mode 100644
index 000000000..96ae30dfe
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_error.php
@@ -0,0 +1,6 @@
+getSubIterator();
+$iterator->getSubIterator(0);
+$iterator->getSubIterator(0, 0);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_error.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_error.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_error.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation.php
new file mode 100644
index 000000000..958a75ee4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation.php
@@ -0,0 +1,13 @@
+next();
+$iterator->next();
+var_dump(get_class($iterator->getSubIterator()));
+var_dump($iterator->getSubIterator()->getArrayCopy());
+$iterator->next();
+var_dump(get_class($iterator->getSubIterator()));
+var_dump($iterator->getSubIterator()->getArrayCopy());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation.php.expectf
new file mode 100644
index 000000000..1a8a57612
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation.php.expectf
@@ -0,0 +1,21 @@
+%unicode|string%(22) "RecursiveArrayIterator"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ }
+}
+%unicode|string%(22) "RecursiveArrayIterator"
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_002.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_002.php
new file mode 100644
index 000000000..260713fa2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_002.php
@@ -0,0 +1,10 @@
+next();
+var_dump(is_null($iterator->getSubIterator()));
+$iterator->next();
+var_dump(is_null($iterator->getSubIterator()));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_002.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_002.php.expectf
new file mode 100644
index 000000000..1f7ce4c1e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_002.php.expectf
@@ -0,0 +1,2 @@
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_003.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_003.php
new file mode 100644
index 000000000..2403a7c10
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_003.php
@@ -0,0 +1,13 @@
+next();
+$iterator->next();
+$iterator->next();
+var_dump($iterator->getSubIterator(-1));
+var_dump($iterator->getSubIterator(0)->getArrayCopy());
+var_dump($iterator->getSubIterator(1)->getArrayCopy());
+var_dump($iterator->getSubIterator(2));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_003.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_003.php.expectf
new file mode 100644
index 000000000..88cce624c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_getsubiterator_variation_003.php.expectf
@@ -0,0 +1,21 @@
+NULL
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ }
+}
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_nextelement_basic.php b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_nextelement_basic.php
new file mode 100644
index 000000000..bf0862bf0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_nextelement_basic.php
@@ -0,0 +1,19 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_nextelement_basic.php.expectf b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_nextelement_basic.php.expectf
new file mode 100644
index 000000000..f5b187bda
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/recursiveiteratoriterator_nextelement_basic.php.expectf
@@ -0,0 +1,12 @@
+int(1)
+int(2)
+int(3)
+int(4)
+::nextElement() was invoked
+int(1)
+::nextElement() was invoked
+int(2)
+::nextElement() was invoked
+int(3)
+::nextElement() was invoked
+int(4)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexIterator_flags_basic.php b/hphp/test/zend/bad/ext-spl/regexIterator_flags_basic.php
new file mode 100644
index 000000000..bb0d393ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexIterator_flags_basic.php
@@ -0,0 +1,15 @@
+getFlags() === RegexIterator::USE_KEY);
+
+// Test a change in flags, there's only one class constant so it has to be another int value
+$regexIterator->setFlags(3);
+var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);
+$regexIterator->setFlags(RegexIterator::USE_KEY);
+var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexIterator_flags_basic.php.expectf b/hphp/test/zend/bad/ext-spl/regexIterator_flags_basic.php.expectf
new file mode 100644
index 000000000..a03cfe2b2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexIterator_flags_basic.php.expectf
@@ -0,0 +1,3 @@
+bool(true)
+bool(false)
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexIterator_mode_basic.php b/hphp/test/zend/bad/ext-spl/regexIterator_mode_basic.php
new file mode 100644
index 000000000..bc1ecb180
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexIterator_mode_basic.php
@@ -0,0 +1,21 @@
+getMode() === RegexIterator::MATCH);
+
+$regexIterator->setMode(RegexIterator::MATCH);
+var_dump($regexIterator->getMode() === RegexIterator::MATCH);
+
+$regexIterator->setMode(RegexIterator::GET_MATCH);
+var_dump($regexIterator->getMode() === RegexIterator::GET_MATCH);
+
+$regexIterator->setMode(RegexIterator::ALL_MATCHES);
+var_dump($regexIterator->getMode() === RegexIterator::ALL_MATCHES);
+
+$regexIterator->setMode(RegexIterator::SPLIT);
+var_dump($regexIterator->getMode() === RegexIterator::SPLIT);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexIterator_mode_basic.php.expectf b/hphp/test/zend/bad/ext-spl/regexIterator_mode_basic.php.expectf
new file mode 100644
index 000000000..762719103
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexIterator_mode_basic.php.expectf
@@ -0,0 +1,5 @@
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexIterator_setMode_error.php b/hphp/test/zend/bad/ext-spl/regexIterator_setMode_error.php
new file mode 100644
index 000000000..41a5278c0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexIterator_setMode_error.php
@@ -0,0 +1,17 @@
+getMode());
+
+try {
+ $regexIterator->setMode(7);
+} catch (InvalidArgumentException $e) {
+ var_dump($e->getMessage());
+ var_dump($e->getCode());
+}
+
+$regexIterator->setMode('foo');
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexIterator_setMode_error.php.expectf b/hphp/test/zend/bad/ext-spl/regexIterator_setMode_error.php.expectf
new file mode 100644
index 000000000..4d2e27f23
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexIterator_setMode_error.php.expectf
@@ -0,0 +1,4 @@
+int(0)
+string(14) "Illegal mode 7"
+int(0)
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_getpregflags.php b/hphp/test/zend/bad/ext-spl/regexiterator_getpregflags.php
new file mode 100644
index 000000000..84ffbf5e0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_getpregflags.php
@@ -0,0 +1,25 @@
+setPregFlags(PREG_OFFSET_CAPTURE);
+
+echo is_long($r->getPregFlags());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_getpregflags.php.expectf b/hphp/test/zend/bad/ext-spl/regexiterator_getpregflags.php.expectf
new file mode 100644
index 000000000..56a6051ca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_getpregflags.php.expectf
@@ -0,0 +1 @@
+1
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_getregex.php b/hphp/test/zend/bad/ext-spl/regexiterator_getregex.php
new file mode 100644
index 000000000..1ceeb554e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_getregex.php
@@ -0,0 +1,20 @@
+getRegex());
+
+# Empty regular expression
+$regexIterator = new RegexIterator($iterator, '//');
+var_dump($regexIterator->getRegex());
+
+# "Complex" email regular expression
+$regexIterator = new RegexIterator($iterator, '|\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|');
+var_dump($regexIterator->getRegex());
+
+
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_getregex.php.expectf b/hphp/test/zend/bad/ext-spl/regexiterator_getregex.php.expectf
new file mode 100644
index 000000000..d1759c52f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_getregex.php.expectf
@@ -0,0 +1,3 @@
+string(5) "/.at/"
+string(2) "//"
+string(43) "|\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_setflags_exception.php b/hphp/test/zend/bad/ext-spl/regexiterator_setflags_exception.php
new file mode 100644
index 000000000..5655b9a7d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_setflags_exception.php
@@ -0,0 +1,27 @@
+setFlags();
+}catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_setflags_exception.php.expectf b/hphp/test/zend/bad/ext-spl/regexiterator_setflags_exception.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_setflags_exception.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags.php b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags.php
new file mode 100644
index 000000000..55a11290d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags.php
@@ -0,0 +1,26 @@
+setPregFlags(PREG_OFFSET_CAPTURE);
+
+echo $r->getPregFlags();
+
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags.php.expectf b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags.php.expectf
new file mode 100644
index 000000000..ae4d10b42
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags.php.expectf
@@ -0,0 +1 @@
+256
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags_exception.php b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags_exception.php
new file mode 100644
index 000000000..73b46d3a2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags_exception.php
@@ -0,0 +1,28 @@
+setPregFlags();
+}catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags_exception.php.expectf b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags_exception.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/regexiterator_setpregflags_exception.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splDoublyLinkedList_shift_noParams.php b/hphp/test/zend/bad/ext-spl/splDoublyLinkedList_shift_noParams.php
new file mode 100644
index 000000000..2f4cb009a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splDoublyLinkedList_shift_noParams.php
@@ -0,0 +1,7 @@
+push(1);
+$ll->push(2);
+
+var_dump($ll->shift(1));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splDoublyLinkedList_shift_noParams.php.expectf b/hphp/test/zend/bad/ext-spl/splDoublyLinkedList_shift_noParams.php.expectf
new file mode 100644
index 000000000..e0d8c719d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splDoublyLinkedList_shift_noParams.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %a
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_001.php b/hphp/test/zend/bad/ext-spl/spl_001.php
new file mode 100644
index 000000000..32ecb2c8b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_001.php
@@ -0,0 +1,17 @@
+1, 1=>2, 3=>3, 4, "1"=>5));
+
+$ar = iterator_to_array($it);
+
+var_dump(iterator_count($it));
+
+print_r($ar);
+
+foreach($ar as $v)
+{
+ var_dump($v);
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_001.php.expectf b/hphp/test/zend/bad/ext-spl/spl_001.php.expectf
new file mode 100644
index 000000000..e1f4860ca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_001.php.expectf
@@ -0,0 +1,13 @@
+int(4)
+Array
+(
+ [x] => 1
+ [1] => 5
+ [3] => 3
+ [4] => 4
+)
+int(1)
+int(5)
+int(3)
+int(4)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_003.php b/hphp/test/zend/bad/ext-spl/spl_003.php
new file mode 100644
index 000000000..6599452dd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_003.php
@@ -0,0 +1,30 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_003.php.expectf b/hphp/test/zend/bad/ext-spl/spl_003.php.expectf
new file mode 100644
index 000000000..7dd89f23d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_003.php.expectf
@@ -0,0 +1,37 @@
+HipHop Warning: %a
+string(3) "foo"
+HipHop Warning: %a
+array(2) {
+ ["b"]=>
+ string(1) "b"
+ ["a"]=>
+ string(1) "a"
+}
+array(2) {
+ ["b"]=>
+ string(1) "b"
+ ["a"]=>
+ string(1) "a"
+}
+array(1) {
+ ["a"]=>
+ string(1) "a"
+}
+array(1) {
+ ["a"]=>
+ string(1) "a"
+}
+array(0) {
+}
+bool(false)
+bool(false)
+string(3) "aaa"
+HipHop Warning: %a
+HipHop Warning: %a
+array(0) {
+}
+array(0) {
+}
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_004.php b/hphp/test/zend/bad/ext-spl/spl_004.php
new file mode 100644
index 000000000..040b5f610
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_004.php
@@ -0,0 +1,48 @@
+key());
+ var_dump($arg->current());
+ }
+ else
+ {
+ var_dump($arg);
+ }
+ return true;
+}
+
+function test()
+{
+ static $arg = 0;
+ var_dump($arg++);
+ return true;
+}
+
+$it = new RecursiveArrayIterator(array(1, array(21, 22), 3));
+
+var_dump(iterator_apply($it, 'test', NULL));
+
+echo "===ARGS===\n";
+var_dump(iterator_apply($it, 'test_arg', array($it)));
+
+echo "===RECURSIVE===\n";
+$it = new RecursiveIteratorIterator($it);
+var_dump(iterator_apply($it, 'test'));
+
+echo "===ERRORS===\n";
+var_dump(iterator_apply($it, 'test', 1));
+var_dump(iterator_apply($it, 'non_existing_functon'));
+var_dump(iterator_apply($it, 'non_existing_functon', NULL, 2));
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_004.php.expectf b/hphp/test/zend/bad/ext-spl/spl_004.php.expectf
new file mode 100644
index 000000000..4f289fec1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_004.php.expectf
@@ -0,0 +1,32 @@
+int(0)
+int(1)
+int(2)
+int(3)
+===ARGS===
+int(0)
+int(1)
+int(1)
+array(2) {
+ [0]=>
+ int(21)
+ [1]=>
+ int(22)
+}
+int(2)
+int(3)
+int(3)
+===RECURSIVE===
+int(3)
+int(4)
+int(5)
+int(6)
+int(4)
+===ERRORS===
+Error: Argument 3 passed to iterator_apply() must be of the type array, integer given
+Error: iterator_apply() expects parameter 3 to be array, integer given
+NULL
+Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_functon' not found or invalid function name
+NULL
+Error: iterator_apply() expects at most 3 parameters, 4 given
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_005.php b/hphp/test/zend/bad/ext-spl/spl_005.php
new file mode 100644
index 000000000..4fc35e9a1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_005.php
@@ -0,0 +1,9 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_005.php.expectf b/hphp/test/zend/bad/ext-spl/spl_005.php.expectf
new file mode 100644
index 000000000..2ac43e9b0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_005.php.expectf
@@ -0,0 +1,6 @@
+string(32) "%s"
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_007.php b/hphp/test/zend/bad/ext-spl/spl_007.php
new file mode 100644
index 000000000..c520e70f3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_007.php
@@ -0,0 +1,16 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_007.php.expectf b/hphp/test/zend/bad/ext-spl/spl_007.php.expectf
new file mode 100644
index 000000000..865eb3d99
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_007.php.expectf
@@ -0,0 +1,4 @@
+Called foobar.
+Called foobar.
+Called foobar.
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_002.php b/hphp/test/zend/bad/ext-spl/spl_autoload_002.php
new file mode 100644
index 000000000..d0f08989a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_002.php
@@ -0,0 +1,36 @@
+
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_002.php.expectf b/hphp/test/zend/bad/ext-spl/spl_autoload_002.php.expectf
new file mode 100644
index 000000000..c7ebd3fbb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_002.php.expectf
@@ -0,0 +1,26 @@
+bool(false)
+array(1) {
+ [0]=>
+ string(12) "spl_autoload"
+}
+array(3) {
+ [0]=>
+ string(12) "spl_autoload"
+ [1]=>
+ string(16) "SplAutoloadTest1"
+ [2]=>
+ string(16) "SplAutoloadTest2"
+}
+array(2) {
+ [0]=>
+ string(12) "spl_autoload"
+ [1]=>
+ string(16) "SplAutoloadTest2"
+}
+bool(false)
+array(1) {
+ [0]=>
+ string(12) "spl_autoload"
+}
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_012.php b/hphp/test/zend/bad/ext-spl/spl_autoload_012.php
new file mode 100644
index 000000000..2bffb05c8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_012.php
@@ -0,0 +1,36 @@
+getMessage()."\n";
+ } while($e = $e->getPrevious());
+}
+
+try {
+ new ThisClassDoesNotExist;
+} catch(Exception $e) {
+ do {
+ echo $e->getMessage()."\n";
+ } while($e = $e->getPrevious());
+}
+
+class_exists('ThisClassDoesNotExist');
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_012.php.expectf b/hphp/test/zend/bad/ext-spl/spl_autoload_012.php.expectf
new file mode 100644
index 000000000..bfa95c467
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_012.php.expectf
@@ -0,0 +1,24 @@
+autoload_first
+autoload_second
+second
+first
+autoload_first
+autoload_second
+second
+first
+autoload_first
+autoload_second
+HipHop Fatal error: %a
+Stack trace:
+#0 [internal function]: autoload_first('ThisClassDoesNo...')
+#1 [internal function]: spl_autoload_call('ThisClassDoesNo...')
+#2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...')
+#3 {main}
+
+Next exception 'Exception' with message 'second' in %sspl_autoload_012.php:%d
+Stack trace:
+#0 [internal function]: autoload_second('ThisClassDoesNo...')
+#1 [internal function]: spl_autoload_call('ThisClassDoesNo...')
+#2 %sspl_autoload_012.php(%d): class_exists('ThisClassDoesNo...')
+#3 {main}
+ thrown in %sspl_autoload_012.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_013.php b/hphp/test/zend/bad/ext-spl/spl_autoload_013.php
new file mode 100644
index 000000000..42a13f019
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_013.php
@@ -0,0 +1,26 @@
+dir = $dir;
+ }
+ public function __invoke($class) {
+ var_dump("{$this->dir}/$class.php");
+ }
+}
+
+$al1 = new Autoloader('d1');
+$al2 = new Autoloader('d2');
+
+spl_autoload_register($closure);
+spl_autoload_register($al1);
+spl_autoload_register($al2);
+
+var_dump(spl_autoload_functions());
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_013.php.expectf b/hphp/test/zend/bad/ext-spl/spl_autoload_013.php.expectf
new file mode 100644
index 000000000..2a9af23c0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_013.php.expectf
@@ -0,0 +1,21 @@
+array(3) {
+ [0]=>
+ object(Closure)#%d (1) {
+ ["parameter"]=>
+ array(1) {
+ ["$class"]=>
+ string(10) ""
+ }
+ }
+ [1]=>
+ object(Autoloader)#%d (1) {
+ ["dir":"Autoloader":private]=>
+ string(2) "d1"
+ }
+ [2]=>
+ object(Autoloader)#%d (1) {
+ ["dir":"Autoloader":private]=>
+ string(2) "d2"
+ }
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_bug48541.php b/hphp/test/zend/bad/ext-spl/spl_autoload_bug48541.php
new file mode 100644
index 000000000..be7f97246
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_bug48541.php
@@ -0,0 +1,30 @@
+getClosure();
+$b = function ($class) {
+ eval('class ' . $class . '{function __construct(){echo "foo\n";}}');
+ echo "b called\n";
+};
+spl_autoload_register($a);
+spl_autoload_register($a2);
+spl_autoload_register($b);
+
+$c = $a;
+$c2 = $a2;
+spl_autoload_register($c);
+spl_autoload_register($c2);
+$c = new foo;
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_autoload_bug48541.php.expectf b/hphp/test/zend/bad/ext-spl/spl_autoload_bug48541.php.expectf
new file mode 100644
index 000000000..9cfb99814
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_autoload_bug48541.php.expectf
@@ -0,0 +1,5 @@
+a called
+a2 called
+b called
+foo
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_caching_iterator_constructor_flags.php b/hphp/test/zend/bad/ext-spl/spl_caching_iterator_constructor_flags.php
new file mode 100644
index 000000000..f78e3614b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_caching_iterator_constructor_flags.php
@@ -0,0 +1,16 @@
+getMessage() . "\n";
+}
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_caching_iterator_constructor_flags.php.expectf b/hphp/test/zend/bad/ext-spl/spl_caching_iterator_constructor_flags.php.expectf
new file mode 100644
index 000000000..e3a7a23be
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_caching_iterator_constructor_flags.php.expectf
@@ -0,0 +1,2 @@
+Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_CURRENT
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_cachingiterator___toString_basic.php b/hphp/test/zend/bad/ext-spl/spl_cachingiterator___toString_basic.php
new file mode 100644
index 000000000..28a863921
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_cachingiterator___toString_basic.php
@@ -0,0 +1,8 @@
+__toString() // if conversion to string is done by echo, for example, an exeption is thrown. Invoking __toString explicitly covers different code.
+);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_cachingiterator___toString_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_cachingiterator___toString_basic.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_cachingiterator___toString_basic.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_cachingiterator_setFlags_basic.php b/hphp/test/zend/bad/ext-spl/spl_cachingiterator_setFlags_basic.php
new file mode 100644
index 000000000..f8ff0f52b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_cachingiterator_setFlags_basic.php
@@ -0,0 +1,8 @@
+setFlags(); //expects arg
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_cachingiterator_setFlags_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_cachingiterator_setFlags_basic.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_cachingiterator_setFlags_basic.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php b/hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php
new file mode 100644
index 000000000..15dc13c57
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php
@@ -0,0 +1,22 @@
+insert(1);
+count($heap);// refers to MyHeap->count() method
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php.expectf
new file mode 100644
index 000000000..2026bef4f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php.expectf
@@ -0,0 +1,6 @@
+HipHop Fatal error: %a
+Stack trace:
+#0 [internal function]: MyHeap->count()
+#1 %s count(Object(MyHeap))
+#2 {main}
+ thrown in hphp/test/zend/bad/ext-spl/spl_heap_count_basic.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_count_error.php b/hphp/test/zend/bad/ext-spl/spl_heap_count_error.php
new file mode 100644
index 000000000..43a193bcb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_count_error.php
@@ -0,0 +1,4 @@
+count(1);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_count_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_count_error.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_count_error.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_extract_parameter_error.php b/hphp/test/zend/bad/ext-spl/spl_heap_extract_parameter_error.php
new file mode 100644
index 000000000..b7e044725
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_extract_parameter_error.php
@@ -0,0 +1,17 @@
+extract('test'));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_extract_parameter_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_extract_parameter_error.php.expectf
new file mode 100644
index 000000000..f9787e34f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_extract_parameter_error.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_insert_basic.php b/hphp/test/zend/bad/ext-spl/spl_heap_insert_basic.php
new file mode 100644
index 000000000..99b21b36f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_insert_basic.php
@@ -0,0 +1,12 @@
+insert(1,2);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_insert_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_insert_basic.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_insert_basic.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_is_empty_basic.php b/hphp/test/zend/bad/ext-spl/spl_heap_is_empty_basic.php
new file mode 100644
index 000000000..6c3fcc810
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_is_empty_basic.php
@@ -0,0 +1,19 @@
+isEmpty());
+$heap->insert(1);
+var_dump($heap->isEmpty());
+$heap->extract();
+var_dump($heap->isEmpty());
+$heap->isEmpty('var');
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_is_empty_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_is_empty_basic.php.expectf
new file mode 100644
index 000000000..9c71268ae
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_is_empty_basic.php.expectf
@@ -0,0 +1,4 @@
+bool(true)
+bool(false)
+bool(true)
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_isempty.php b/hphp/test/zend/bad/ext-spl/spl_heap_isempty.php
new file mode 100644
index 000000000..5d335df6f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_isempty.php
@@ -0,0 +1,11 @@
+isEmpty())."\n";
+ $h->insert(2);
+ echo "Checking after insert: ";
+ var_dump($h->isEmpty())."\n";
+ $h->extract();
+ echo "Checking after extract: ";
+ var_dump($h->isEmpty())."\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_isempty.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_isempty.php.expectf
new file mode 100644
index 000000000..256316a73
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_isempty.php.expectf
@@ -0,0 +1,3 @@
+Checking a new heap is empty: bool(true)
+Checking after insert: bool(false)
+Checking after extract: bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_iteration_error.php b/hphp/test/zend/bad/ext-spl/spl_heap_iteration_error.php
new file mode 100644
index 000000000..0619944a5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_iteration_error.php
@@ -0,0 +1,25 @@
+fail)
+ throw new Exception('Corrupting heap',99);
+ return 0;
+ }
+}
+
+$h = new ext_heap();
+$h->insert(array('foobar'));
+$h->insert(array('foobar1'));
+$h->insert(array('foobar2'));
+
+try {
+ $h->fail=true;
+ foreach ($h as $value) {};
+ echo "I should have raised an exception here";
+} catch (Exception $e) {
+ if ($e->getCode()!=99) echo "Unexpected exception";
+}
+
+var_dump($h);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_iteration_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_iteration_error.php.expectf
new file mode 100644
index 000000000..b37d409c6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_iteration_error.php.expectf
@@ -0,0 +1,21 @@
+object(ext_heap)#%d (4) {
+ [%u|b%"fail"]=>
+ bool(true)
+ [%u|b%"flags":%u|b%"SplHeap":private]=>
+ int(0)
+ [%u|b%"isCorrupted":%u|b%"SplHeap":private]=>
+ bool(true)
+ [%u|b%"heap":%u|b%"SplHeap":private]=>
+ array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ %unicode|string%(7) "foobar2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ %unicode|string%(7) "foobar1"
+ }
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_recoverfromcorruption_arguments.php b/hphp/test/zend/bad/ext-spl/spl_heap_recoverfromcorruption_arguments.php
new file mode 100644
index 000000000..2d8fc9a51
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_recoverfromcorruption_arguments.php
@@ -0,0 +1,5 @@
+recoverFromCorruption("no args");
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_heap_recoverfromcorruption_arguments.php.expectf b/hphp/test/zend/bad/ext-spl/spl_heap_recoverfromcorruption_arguments.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_heap_recoverfromcorruption_arguments.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_apply_error_001.php b/hphp/test/zend/bad/ext-spl/spl_iterator_apply_error_001.php
new file mode 100644
index 000000000..db712d6b5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_apply_error_001.php
@@ -0,0 +1,15 @@
+getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_apply_error_001.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_apply_error_001.php.expectf
new file mode 100644
index 000000000..1741023c9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_apply_error_001.php.expectf
@@ -0,0 +1 @@
+Broken callback
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_basic.php b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_basic.php
new file mode 100644
index 000000000..1a27219a5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_basic.php
@@ -0,0 +1,8 @@
+count()."\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_basic.php.expectf
new file mode 100644
index 000000000..87f99695c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_basic.php.expectf
@@ -0,0 +1,6 @@
+1
+2
+3
+4
+5
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_error.php b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_error.php
new file mode 100644
index 000000000..d299cc971
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_error.php
@@ -0,0 +1,12 @@
+count();
+ echo "Should have caused an exception";
+} catch (BadMethodCallException $e) {
+ echo "Exception raised\n";
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_error.php.expectf
new file mode 100644
index 000000000..8b67b1aa1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_count_error.php.expectf
@@ -0,0 +1,2 @@
+Exception raised
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_caching_getcache_error.php b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_getcache_error.php
new file mode 100644
index 000000000..6ed785762
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_getcache_error.php
@@ -0,0 +1,12 @@
+getCache();
+ echo "Should have caused an exception";
+} catch (BadMethodCallException $e) {
+ echo "Exception raised\n";
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_caching_getcache_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_getcache_error.php.expectf
new file mode 100644
index 000000000..8b67b1aa1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_caching_getcache_error.php.expectf
@@ -0,0 +1,2 @@
+Exception raised
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_getcallchildren.php b/hphp/test/zend/bad/ext-spl/spl_iterator_getcallchildren.php
new file mode 100644
index 000000000..a975bd771
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_getcallchildren.php
@@ -0,0 +1,20 @@
+current());
+$test->next();
+var_dump($test->current());
+try {
+ $output = $test->callGetChildren();
+} catch (InvalidArgumentException $ilae){
+ $output = null;
+ print "invalid argument exception\n";
+}
+var_dump($output);
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_getcallchildren.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_getcallchildren.php.expectf
new file mode 100644
index 000000000..200e7173d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_getcallchildren.php.expectf
@@ -0,0 +1,12 @@
+array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+}
+int(7)
+invalid argument exception
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_iterator_constructor.php b/hphp/test/zend/bad/ext-spl/spl_iterator_iterator_constructor.php
new file mode 100644
index 000000000..d757f65b6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_iterator_constructor.php
@@ -0,0 +1,21 @@
+getMessage() . "\n";
+}
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_iterator_constructor.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_iterator_constructor.php.expectf
new file mode 100644
index 000000000..04a0fa765
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_iterator_constructor.php.expectf
@@ -0,0 +1,2 @@
+IteratorIterator::__construct() expects at most 2 parameters, 3 given
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_to_array_error.php b/hphp/test/zend/bad/ext-spl/spl_iterator_to_array_error.php
new file mode 100644
index 000000000..bc8c09b69
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_to_array_error.php
@@ -0,0 +1,27 @@
+getMessage() . PHP_EOL;
+}
+
+try {
+ // get values
+ $ar = iterator_to_array($it, false);
+} catch (Exception $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_iterator_to_array_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_iterator_to_array_error.php.expectf
new file mode 100644
index 000000000..079a96f03
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_iterator_to_array_error.php.expectf
@@ -0,0 +1,2 @@
+Make the iterator break
+Make the iterator break
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_limit_iterator_check_limits.php b/hphp/test/zend/bad/ext-spl/spl_limit_iterator_check_limits.php
new file mode 100644
index 000000000..c89300abd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_limit_iterator_check_limits.php
@@ -0,0 +1,27 @@
+getMessage(). "\n";
+}
+
+
+try {
+ $limitIterator = new LimitIterator($arrayIterator, 0, -2);
+} catch (OutOfRangeException $e){
+ print $e->getMessage() . "\n";
+}
+
+try {
+ $limitIterator = new LimitIterator($arrayIterator, 0, -1);
+} catch (OutOfRangeException $e){
+ print $e->getMessage() . "\n";
+}
+
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_limit_iterator_check_limits.php.expectf b/hphp/test/zend/bad/ext-spl/spl_limit_iterator_check_limits.php.expectf
new file mode 100644
index 000000000..726265701
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_limit_iterator_check_limits.php.expectf
@@ -0,0 +1,3 @@
+Parameter offset must be >= 0
+Parameter count must either be -1 or a value greater than or equal 0
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_maxheap_compare_basic.php b/hphp/test/zend/bad/ext-spl/spl_maxheap_compare_basic.php
new file mode 100644
index 000000000..2979f8fc7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_maxheap_compare_basic.php
@@ -0,0 +1,14 @@
+testCompare();
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_maxheap_compare_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_maxheap_compare_basic.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_maxheap_compare_basic.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_minheap_compare_error.php b/hphp/test/zend/bad/ext-spl/spl_minheap_compare_error.php
new file mode 100644
index 000000000..a13cdba46
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_minheap_compare_error.php
@@ -0,0 +1,18 @@
+testCompare1();
+$h->testCompare2();
+$h->testCompare3();
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_minheap_compare_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_minheap_compare_error.php.expectf
new file mode 100644
index 000000000..771ac268e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_minheap_compare_error.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+HipHop Warning: %a
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_basic.php b/hphp/test/zend/bad/ext-spl/spl_pq_top_basic.php
new file mode 100644
index 000000000..5223c7162
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_basic.php
@@ -0,0 +1,23 @@
+insert("a", 1);
+$priorityQueue->insert("b", 2);
+$priorityQueue->insert("c", 0);
+
+echo "EXTR DEFAULT",PHP_EOL;
+echo "value: ",$priorityQueue->top(),PHP_EOL;
+
+$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
+echo "EXTR_PRIORITY",PHP_EOL;
+echo "priority: ",$priorityQueue->top(),PHP_EOL;
+
+$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH);
+echo "EXTR_BOTH",PHP_EOL;
+print_r($priorityQueue->top());
+
+echo "EXTR_DATA",PHP_EOL;
+$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_DATA);
+echo "value: ",$priorityQueue->top(),PHP_EOL;
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_basic.php.expectf b/hphp/test/zend/bad/ext-spl/spl_pq_top_basic.php.expectf
new file mode 100644
index 000000000..6c43ee844
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_basic.php.expectf
@@ -0,0 +1,12 @@
+EXTR DEFAULT
+value: b
+EXTR_PRIORITY
+priority: 2
+EXTR_BOTH
+Array
+(
+ [data] => b
+ [priority] => 2
+)
+EXTR_DATA
+value: b
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_error_args.php b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_args.php
new file mode 100644
index 000000000..b5cca9773
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_args.php
@@ -0,0 +1,4 @@
+top('var');
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_error_args.php.expectf b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_args.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_args.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_error_corrupt.php b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_corrupt.php
new file mode 100644
index 000000000..3e0331e74
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_corrupt.php
@@ -0,0 +1,30 @@
+insert("a", 1);
+
+try {
+ //corrupt heap
+ $priorityQueue->insert("b", 2);
+ // ignore exception tested elsewhere
+} catch (Exception $e) {
+}
+
+try {
+ $priorityQueue->top();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage().PHP_EOL;
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_error_corrupt.php.expectf b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_corrupt.php.expectf
new file mode 100644
index 000000000..d5d5cb85b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_corrupt.php.expectf
@@ -0,0 +1 @@
+Exception: Heap is corrupted, heap properties are no longer ensured.
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_error_empty.php b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_empty.php
new file mode 100644
index 000000000..8f6c80a1c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_empty.php
@@ -0,0 +1,11 @@
+top();
+} catch (RuntimeException $e) {
+ echo "Exception: ".$e->getMessage().PHP_EOL;
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_pq_top_error_empty.php.expectf b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_empty.php.expectf
new file mode 100644
index 000000000..6cb98c2e0
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_pq_top_error_empty.php.expectf
@@ -0,0 +1 @@
+Exception: Can't peek at an empty heap
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_priorityqeue_insert_two_params_error.php b/hphp/test/zend/bad/ext-spl/spl_priorityqeue_insert_two_params_error.php
new file mode 100644
index 000000000..3e1388c32
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_priorityqeue_insert_two_params_error.php
@@ -0,0 +1,14 @@
+insert());
+var_dump($testHeap->insert('test'));
+var_dump($testHeap->insert('test', 'test'));
+var_dump($testHeap->insert('test', 'test', 'test'));
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_priorityqeue_insert_two_params_error.php.expectf b/hphp/test/zend/bad/ext-spl/spl_priorityqeue_insert_two_params_error.php.expectf
new file mode 100644
index 000000000..41ef48819
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_priorityqeue_insert_two_params_error.php.expectf
@@ -0,0 +1,8 @@
+HipHop Warning: %a
+NULL
+HipHop Warning: %a
+NULL
+bool(true)
+HipHop Warning: %a
+NULL
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_recursiveIteratorIterator_setMaxDepth_parameter_count.php b/hphp/test/zend/bad/ext-spl/spl_recursiveIteratorIterator_setMaxDepth_parameter_count.php
new file mode 100644
index 000000000..d7340f06f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_recursiveIteratorIterator_setMaxDepth_parameter_count.php
@@ -0,0 +1,17 @@
+current());
+$test->setMaxDepth();
+$test->setMaxDepth(1);
+$test->setMaxDepth(1,2);
+$test->setMaxDepth(1,2,3);
+
+//var_dump($test->current());
+
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_recursiveIteratorIterator_setMaxDepth_parameter_count.php.expectf b/hphp/test/zend/bad/ext-spl/spl_recursiveIteratorIterator_setMaxDepth_parameter_count.php.expectf
new file mode 100644
index 000000000..3cbce755b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_recursiveIteratorIterator_setMaxDepth_parameter_count.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %a
+HipHop Warning: %a
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_recursive_iterator_iterator_key_case.php b/hphp/test/zend/bad/ext-spl/spl_recursive_iterator_iterator_key_case.php
new file mode 100644
index 000000000..bac288ac9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_recursive_iterator_iterator_key_case.php
@@ -0,0 +1,10 @@
+1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, NULL => "null");
+ $it = new RecursiveArrayIterator($ar);
+ $it = new RecursiveIteratorIterator($it);
+ foreach($it as $k=>$v)
+ {
+ echo "$k=>$v\n";
+ var_dump($k);
+ }
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/spl_recursive_iterator_iterator_key_case.php.expectf b/hphp/test/zend/bad/ext-spl/spl_recursive_iterator_iterator_key_case.php.expectf
new file mode 100644
index 000000000..81f52a238
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/spl_recursive_iterator_iterator_key_case.php.expectf
@@ -0,0 +1,16 @@
+one=>1
+%unicode|string%(3) "one"
+two=>2
+%unicode|string%(3) "two"
+four=>4
+%unicode|string%(4) "four"
+five=>5
+%unicode|string%(4) "five"
+seven=>7
+%unicode|string%(5) "seven"
+eight=>8
+%unicode|string%(5) "eight"
+-100=>10
+int(-100)
+=>null
+%unicode|string%(0) ""
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splfixedarray_offsetExists_larger.php b/hphp/test/zend/bad/ext-spl/splfixedarray_offsetExists_larger.php
new file mode 100644
index 000000000..f5d011040
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splfixedarray_offsetExists_larger.php
@@ -0,0 +1,8 @@
+offsetExists(4));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splfixedarray_offsetExists_larger.php.expectf b/hphp/test/zend/bad/ext-spl/splfixedarray_offsetExists_larger.php.expectf
new file mode 100644
index 000000000..eb28e0c67
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splfixedarray_offsetExists_larger.php.expectf
@@ -0,0 +1 @@
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splpriorityqueue_extract.php b/hphp/test/zend/bad/ext-spl/splpriorityqueue_extract.php
new file mode 100644
index 000000000..187c7dc5b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splpriorityqueue_extract.php
@@ -0,0 +1,9 @@
+insert("1",1);
+
+$sp->extract(1); // Should throw a warning as extract expects NO arguments
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splpriorityqueue_extract.php.expectf b/hphp/test/zend/bad/ext-spl/splpriorityqueue_extract.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splpriorityqueue_extract.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splpriorityqueue_setextractflags.php b/hphp/test/zend/bad/ext-spl/splpriorityqueue_setextractflags.php
new file mode 100644
index 000000000..9cd3f7c01
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splpriorityqueue_setextractflags.php
@@ -0,0 +1,7 @@
+setExtractFlags(1,1); // Should throw a warning as setExtractFlags expects only 1 argument
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-spl/splpriorityqueue_setextractflags.php.expectf b/hphp/test/zend/bad/ext-spl/splpriorityqueue_setextractflags.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/bad/ext-spl/splpriorityqueue_setextractflags.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-posix/posix_ttyname.php.expectf~HEAD b/hphp/test/zend/good/ext-posix/posix_ttyname.php.expectf~HEAD
new file mode 100644
index 000000000..fac42add0
--- /dev/null
+++ b/hphp/test/zend/good/ext-posix/posix_ttyname.php.expectf~HEAD
@@ -0,0 +1,4 @@
+bool(false)
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-posix/posix_ttyname.php.expectf~fully quality paths b/hphp/test/zend/good/ext-posix/posix_ttyname.php.expectf~fully quality paths
new file mode 100644
index 000000000..fac42add0
--- /dev/null
+++ b/hphp/test/zend/good/ext-posix/posix_ttyname.php.expectf~fully quality paths
@@ -0,0 +1,4 @@
+bool(false)
+bool(false)
+bool(false)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-posix/posix_ttyname_variation2.php.expectf~HEAD b/hphp/test/zend/good/ext-posix/posix_ttyname_variation2.php.expectf~HEAD
new file mode 100644
index 000000000..6770ec6eb
--- /dev/null
+++ b/hphp/test/zend/good/ext-posix/posix_ttyname_variation2.php.expectf~HEAD
@@ -0,0 +1,5 @@
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-posix/posix_ttyname_variation2.php.expectf~fully quality paths b/hphp/test/zend/good/ext-posix/posix_ttyname_variation2.php.expectf~fully quality paths
new file mode 100644
index 000000000..6770ec6eb
--- /dev/null
+++ b/hphp/test/zend/good/ext-posix/posix_ttyname_variation2.php.expectf~fully quality paths
@@ -0,0 +1,5 @@
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-posix/posix_ttyname_variation4.php.expectf~HEAD b/hphp/test/zend/good/ext-posix/posix_ttyname_variation4.php.expectf~HEAD
new file mode 100644
index 000000000..f7ad82546
--- /dev/null
+++ b/hphp/test/zend/good/ext-posix/posix_ttyname_variation4.php.expectf~HEAD
@@ -0,0 +1,6 @@
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-posix/posix_ttyname_variation4.php.expectf~fully quality paths b/hphp/test/zend/good/ext-posix/posix_ttyname_variation4.php.expectf~fully quality paths
new file mode 100644
index 000000000..f7ad82546
--- /dev/null
+++ b/hphp/test/zend/good/ext-posix/posix_ttyname_variation4.php.expectf~fully quality paths
@@ -0,0 +1,6 @@
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_by_reference.php b/hphp/test/zend/good/ext-spl/DirectoryIterator_by_reference.php
new file mode 100644
index 000000000..734aea60a
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_by_reference.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_by_reference.php.expectf b/hphp/test/zend/good/ext-spl/DirectoryIterator_by_reference.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_by_reference.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getBasename_basic_test.php b/hphp/test/zend/good/ext-spl/DirectoryIterator_getBasename_basic_test.php
new file mode 100644
index 000000000..177133551
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getBasename_basic_test.php
@@ -0,0 +1,14 @@
+isFile()) {
+ $dir->next();
+ }
+ echo $dir->getBasename('.txt');
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getBasename_basic_test.php.expectf b/hphp/test/zend/good/ext-spl/DirectoryIterator_getBasename_basic_test.php.expectf
new file mode 100644
index 000000000..c189ac065
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getBasename_basic_test.php.expectf
@@ -0,0 +1 @@
+getBasename_test
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getGroup_basic.php b/hphp/test/zend/good/ext-spl/DirectoryIterator_getGroup_basic.php
new file mode 100644
index 000000000..601bfd721
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getGroup_basic.php
@@ -0,0 +1,11 @@
+getGroup();
+var_dump($expected == $actual);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getGroup_basic.php.expectf b/hphp/test/zend/good/ext-spl/DirectoryIterator_getGroup_basic.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getGroup_basic.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getInode_basic.php b/hphp/test/zend/good/ext-spl/DirectoryIterator_getInode_basic.php
new file mode 100644
index 000000000..e6624d59b
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getInode_basic.php
@@ -0,0 +1,10 @@
+getInode()));
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getInode_basic.php.expectf b/hphp/test/zend/good/ext-spl/DirectoryIterator_getInode_basic.php.expectf
new file mode 100644
index 000000000..1a43204d7
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getInode_basic.php.expectf
@@ -0,0 +1 @@
+string(%d) "%d"
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getOwner_basic.php b/hphp/test/zend/good/ext-spl/DirectoryIterator_getOwner_basic.php
new file mode 100644
index 000000000..269e2ff84
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getOwner_basic.php
@@ -0,0 +1,11 @@
+getOwner();
+var_dump($expected == $actual);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/DirectoryIterator_getOwner_basic.php.expectf b/hphp/test/zend/good/ext-spl/DirectoryIterator_getOwner_basic.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/DirectoryIterator_getOwner_basic.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_001.php b/hphp/test/zend/good/ext-spl/SplFileInfo_001.php
new file mode 100644
index 000000000..6eb492d39
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_001.php
@@ -0,0 +1,6 @@
+__construct(1);
+
+echo "done!\n";
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_001.php.expectf b/hphp/test/zend/good/ext-spl/SplFileInfo_001.php.expectf
new file mode 100644
index 000000000..dd55c26f1
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_001.php.expectf
@@ -0,0 +1 @@
+done!
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getGroup_basic.php b/hphp/test/zend/good/ext-spl/SplFileInfo_getGroup_basic.php
new file mode 100644
index 000000000..1b62328ba
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getGroup_basic.php
@@ -0,0 +1,11 @@
+getGroup();
+var_dump($expected == $actual);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getGroup_basic.php.expectf b/hphp/test/zend/good/ext-spl/SplFileInfo_getGroup_basic.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getGroup_basic.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getInode_basic.php b/hphp/test/zend/good/ext-spl/SplFileInfo_getInode_basic.php
new file mode 100644
index 000000000..cb148a318
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getInode_basic.php
@@ -0,0 +1,11 @@
+getInode() == $result);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getInode_basic.php.expectf b/hphp/test/zend/good/ext-spl/SplFileInfo_getInode_basic.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getInode_basic.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getOwner_basic.php b/hphp/test/zend/good/ext-spl/SplFileInfo_getOwner_basic.php
new file mode 100644
index 000000000..9213d00ec
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getOwner_basic.php
@@ -0,0 +1,11 @@
+getOwner();
+var_dump($expected == $actual);
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getOwner_basic.php.expectf b/hphp/test/zend/good/ext-spl/SplFileInfo_getOwner_basic.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getOwner_basic.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getPerms_basic.php b/hphp/test/zend/good/ext-spl/SplFileInfo_getPerms_basic.php
new file mode 100644
index 000000000..520b5f92a
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getPerms_basic.php
@@ -0,0 +1,11 @@
+getPerms() == 0100557);
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileInfo_getPerms_basic.php.expectf b/hphp/test/zend/good/ext-spl/SplFileInfo_getPerms_basic.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileInfo_getPerms_basic.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_001.php b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_001.php
new file mode 100644
index 000000000..91d338c30
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_001.php
@@ -0,0 +1,14 @@
+fwrite('test_write',4);
+var_dump(file_get_contents($file));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_001.php.expectf b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_001.php.expectf
new file mode 100644
index 000000000..bdc3bff56
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_001.php.expectf
@@ -0,0 +1 @@
+string(4) "test"
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_002.php b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_002.php
new file mode 100644
index 000000000..ac8779d1b
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_002.php
@@ -0,0 +1,14 @@
+fwrite('test_write',12);
+var_dump(file_get_contents($file));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_002.php.expectf b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_002.php.expectf
new file mode 100644
index 000000000..c14d69bea
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_fwrite_variation_002.php.expectf
@@ -0,0 +1 @@
+string(10) "test_write"
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_getchildren_basic.php b/hphp/test/zend/good/ext-spl/SplFileObject_getchildren_basic.php
new file mode 100644
index 000000000..e8c0cc7dd
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_getchildren_basic.php
@@ -0,0 +1,5 @@
+getChildren());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_getchildren_basic.php.expectf b/hphp/test/zend/good/ext-spl/SplFileObject_getchildren_basic.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_getchildren_basic.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_haschildren_basic.php b/hphp/test/zend/good/ext-spl/SplFileObject_haschildren_basic.php
new file mode 100644
index 000000000..adab792c8
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_haschildren_basic.php
@@ -0,0 +1,5 @@
+hasChildren());
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/SplFileObject_haschildren_basic.php.expectf b/hphp/test/zend/good/ext-spl/SplFileObject_haschildren_basic.php.expectf
new file mode 100644
index 000000000..eb28e0c67
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/SplFileObject_haschildren_basic.php.expectf
@@ -0,0 +1 @@
+bool(false)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/array_020.php b/hphp/test/zend/good/ext-spl/array_020.php
new file mode 100644
index 000000000..4e8f437dc
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/array_020.php
@@ -0,0 +1,45 @@
+ $v)
+{
+ var_dump($k);
+ var_dump($v);
+}
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/array_020.php.expectf b/hphp/test/zend/good/ext-spl/array_020.php.expectf
new file mode 100644
index 000000000..7c6b0a322
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/array_020.php.expectf
@@ -0,0 +1,15 @@
+ArrayIteratorEx::rewind
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(0)
+int(1)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+ArrayIteratorEx::current
+ArrayIteratorEx::key
+int(1)
+int(2)
+ArrayIteratorEx::next
+ArrayIteratorEx::valid
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug31185.php b/hphp/test/zend/good/ext-spl/bug31185.php
new file mode 100644
index 000000000..a4e46a356
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug31185.php
@@ -0,0 +1,42 @@
+array[$index]);
+ }
+
+ public function offsetGet($index) {
+ return $this->array[$index];
+ }
+
+ public function offsetSet($index, $value) {
+ echo __METHOD__ . "($index, $value)\n";
+ $this->array[$index] = $value;
+ }
+
+ public function offsetUnset($index) {
+ throw new Exception('FAIL');
+ unset($this->array[$index]);
+ }
+
+}
+
+$i = 0; $j = 0;
+$foo = new FooBar();
+$foo[$j++] = $i++;
+$foo[$j++] = $i++;
+$foo[$j++] = $i++;
+try
+{
+ unset($foo[1]);
+}
+catch (Exception $e)
+{
+ echo "CAUGHT: " . $e->getMessage() . "\n";
+}
+
+print_R($foo);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug31185.php.expectf b/hphp/test/zend/good/ext-spl/bug31185.php.expectf
new file mode 100644
index 000000000..b5a47daaf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug31185.php.expectf
@@ -0,0 +1,15 @@
+FooBar::offsetSet(0, 0)
+FooBar::offsetSet(1, 1)
+FooBar::offsetSet(2, 2)
+CAUGHT: FAIL
+FooBar Object
+(
+ [array:FooBar:private] => Array
+ (
+ [0] => 0
+ [1] => 1
+ [2] => 2
+ )
+
+)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug32134.php b/hphp/test/zend/good/ext-spl/bug32134.php
new file mode 100644
index 000000000..74288747a
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug32134.php
@@ -0,0 +1,37 @@
+ 3) exit(1);
+ return parent::offsetGet($index);
+ }
+
+ public function offsetSet($index, $newval)
+ {
+ echo __METHOD__ . "($index,$newval)\n";
+ return parent::offsetSet($index, $newval);
+ }
+
+}
+
+$myArray = new myArray();
+
+$myArray->offsetSet('one', 'one');
+var_dump($myArray->offsetGet('one'));
+
+$myArray['two'] = 'two';
+var_dump($myArray['two']);
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug32134.php.expectf b/hphp/test/zend/good/ext-spl/bug32134.php.expectf
new file mode 100644
index 000000000..70790becc
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug32134.php.expectf
@@ -0,0 +1,7 @@
+myArray::offsetSet(one,one)
+myArray::offsetGet(one)
+string(3) "one"
+myArray::offsetSet(two,two)
+myArray::offsetGet(two)
+string(3) "two"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug36258.php b/hphp/test/zend/good/ext-spl/bug36258.php
new file mode 100644
index 000000000..8f5c9efc7
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug36258.php
@@ -0,0 +1,12 @@
+ $file) {
+ var_dump($file->getFilename());
+ var_dump($file->getPath());
+ break;
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug36258.php.expectf b/hphp/test/zend/good/ext-spl/bug36258.php.expectf
new file mode 100644
index 000000000..eabd8be70
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug36258.php.expectf
@@ -0,0 +1,3 @@
+string(%d) "%s"
+string(%d) "%s"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug36287.php b/hphp/test/zend/good/ext-spl/bug36287.php
new file mode 100644
index 000000000..0f1b30fc3
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug36287.php
@@ -0,0 +1,19 @@
+getFilename());
+ echo "Second\n";
+ var_dump($file->getFilename());
+ if (++$idx > 1)
+ {
+ break;
+ }
+}
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug36287.php.expectf b/hphp/test/zend/good/ext-spl/bug36287.php.expectf
new file mode 100644
index 000000000..c3ae34edd
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug36287.php.expectf
@@ -0,0 +1,9 @@
+First
+string(%d) "%s"
+Second
+string(%d) "%s"
+First
+string(%d) "%s"
+Second
+string(%d) "%s"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug38325.php b/hphp/test/zend/good/ext-spl/bug38325.php
new file mode 100644
index 000000000..74c4460bd
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug38325.php
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug38325.php.expectf b/hphp/test/zend/good/ext-spl/bug38325.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug38325.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug40091.php b/hphp/test/zend/good/ext-spl/bug40091.php
new file mode 100644
index 000000000..f275b0df1
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug40091.php
@@ -0,0 +1,17 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug40091.php.expectf b/hphp/test/zend/good/ext-spl/bug40091.php.expectf
new file mode 100644
index 000000000..cf14ac188
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug40091.php.expectf
@@ -0,0 +1,22 @@
+Array
+(
+ [0] => Array
+ (
+ [0] => MyAutoloader Object
+ (
+ )
+
+ [1] => autoload
+ )
+
+ [1] => Array
+ (
+ [0] => MyAutoloader Object
+ (
+ )
+
+ [1] => autoload
+ )
+
+)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug42364.php b/hphp/test/zend/good/ext-spl/bug42364.php
new file mode 100644
index 000000000..d2ef582b9
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug42364.php
@@ -0,0 +1,18 @@
+getRealPath());
+ if ($type != "string" && $type != "unicode") {
+ echo $e->getFilename(), " is a ", gettype($e->getRealPath()), "\n";
+ }
+}
+
+if ($count > 0) {
+ echo "Found $count entries!\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug42364.php.expectf b/hphp/test/zend/good/ext-spl/bug42364.php.expectf
new file mode 100644
index 000000000..7ff9fb910
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug42364.php.expectf
@@ -0,0 +1,2 @@
+Found %i entries!
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug44144.php b/hphp/test/zend/good/ext-spl/bug44144.php
new file mode 100644
index 000000000..4444476c0
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug44144.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug44144.php.expectf b/hphp/test/zend/good/ext-spl/bug44144.php.expectf
new file mode 100644
index 000000000..b6b80f8e9
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug44144.php.expectf
@@ -0,0 +1,10 @@
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ object(Foo)#%d (0) {
+ }
+ [1]=>
+ string(15) "nonstaticMethod"
+ }
+}
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug46031.php b/hphp/test/zend/good/ext-spl/bug46031.php
new file mode 100644
index 000000000..7ed647f4e
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug46031.php
@@ -0,0 +1,4 @@
+next());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug46031.php.expectf b/hphp/test/zend/good/ext-spl/bug46031.php.expectf
new file mode 100644
index 000000000..fe3a0735d
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug46031.php.expectf
@@ -0,0 +1 @@
+NULL
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug48023.php b/hphp/test/zend/good/ext-spl/bug48023.php
new file mode 100644
index 000000000..82deeee00
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug48023.php
@@ -0,0 +1,7 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug48023.php.expectf b/hphp/test/zend/good/ext-spl/bug48023.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug48023.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug48493.php b/hphp/test/zend/good/ext-spl/bug48493.php
new file mode 100644
index 000000000..39a360f68
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug48493.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug48493.php.expectf b/hphp/test/zend/good/ext-spl/bug48493.php.expectf
new file mode 100644
index 000000000..68d8a9aa3
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug48493.php.expectf
@@ -0,0 +1,10 @@
+array(2) {
+ [0]=>
+ string(9) "autoload1"
+ [1]=>
+ string(9) "autoload2"
+}
+array(1) {
+ [0]=>
+ string(9) "autoload1"
+}
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug51532.php b/hphp/test/zend/good/ext-spl/bug51532.php
new file mode 100644
index 000000000..39db7a81c
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug51532.php
@@ -0,0 +1,9 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug51532.php.expectf b/hphp/test/zend/good/ext-spl/bug51532.php.expectf
new file mode 100644
index 000000000..922a780ce
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug51532.php.expectf
@@ -0,0 +1 @@
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug54281.php b/hphp/test/zend/good/ext-spl/bug54281.php
new file mode 100644
index 000000000..c3733fe8f
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug54281.php
@@ -0,0 +1,10 @@
+$v) { }
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug54281.php.expectf b/hphp/test/zend/good/ext-spl/bug54281.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug54281.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug62328.php b/hphp/test/zend/good/ext-spl/bug62328.php
new file mode 100644
index 000000000..511a8cea0
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug62328.php
@@ -0,0 +1,16 @@
+__toString() . PHP_EOL;
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug62328.php.expectf b/hphp/test/zend/good/ext-spl/bug62328.php.expectf
new file mode 100644
index 000000000..d928e2d7e
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug62328.php.expectf
@@ -0,0 +1,2 @@
+__toString
+__toString
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug62616.php b/hphp/test/zend/good/ext-spl/bug62616.php
new file mode 100644
index 000000000..a98271e10
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug62616.php
@@ -0,0 +1,9 @@
+count());
+
+$ii = new IteratorIterator($ai);
+
+var_dump($ii->count());
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/bug62616.php.expectf b/hphp/test/zend/good/ext-spl/bug62616.php.expectf
new file mode 100644
index 000000000..aabd8b390
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/bug62616.php.expectf
@@ -0,0 +1,2 @@
+int(2)
+int(2)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_implements_basic.php b/hphp/test/zend/good/ext-spl/class_implements_basic.php
new file mode 100644
index 000000000..561629011
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_implements_basic.php
@@ -0,0 +1,19 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_implements_basic.php.expectf b/hphp/test/zend/good/ext-spl/class_implements_basic.php.expectf
new file mode 100644
index 000000000..2b2341bfe
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_implements_basic.php.expectf
@@ -0,0 +1,10 @@
+*** Testing class_implements() : basic ***
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_implements_basic2.php b/hphp/test/zend/good/ext-spl/class_implements_basic2.php
new file mode 100644
index 000000000..6959e1510
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_implements_basic2.php
@@ -0,0 +1,36 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_implements_basic2.php.expectf b/hphp/test/zend/good/ext-spl/class_implements_basic2.php.expectf
new file mode 100644
index 000000000..67ffc340e
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_implements_basic2.php.expectf
@@ -0,0 +1,34 @@
+*** Testing class_implements() : basic ***
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_uses_basic.php b/hphp/test/zend/good/ext-spl/class_uses_basic.php
new file mode 100644
index 000000000..ed6655f8c
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_uses_basic.php
@@ -0,0 +1,19 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_uses_basic.php.expectf b/hphp/test/zend/good/ext-spl/class_uses_basic.php.expectf
new file mode 100644
index 000000000..efb2a5927
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_uses_basic.php.expectf
@@ -0,0 +1,10 @@
+*** Testing class_uses() : basic ***
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_uses_basic2.php b/hphp/test/zend/good/ext-spl/class_uses_basic2.php
new file mode 100644
index 000000000..cac749078
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_uses_basic2.php
@@ -0,0 +1,39 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/class_uses_basic2.php.expectf b/hphp/test/zend/good/ext-spl/class_uses_basic2.php.expectf
new file mode 100644
index 000000000..eea04594b
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/class_uses_basic2.php.expectf
@@ -0,0 +1,26 @@
+*** Testing class_uses() : basic ***
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+array(1) {
+ ["foo"]=>
+ string(3) "foo"
+}
+array(0) {
+}
+array(0) {
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/countable_count_variation1.php b/hphp/test/zend/good/ext-spl/countable_count_variation1.php
new file mode 100644
index 000000000..86a647e8b
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/countable_count_variation1.php
@@ -0,0 +1,52 @@
+getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/countable_count_variation1.php.expectf b/hphp/test/zend/good/ext-spl/countable_count_variation1.php.expectf
new file mode 100644
index 000000000..1f78505bd
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/countable_count_variation1.php.expectf
@@ -0,0 +1,11 @@
+Count returns null:
+int(0)
+Count returns a string:
+int(0)
+Count returns an object:
+HipHop Notice: %a
+int(1)
+Count returns an array:
+int(1)
+Count throws an exception:
+Thrown from count
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/dit_004.php b/hphp/test/zend/good/ext-spl/dit_004.php
new file mode 100644
index 000000000..b99593c31
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/dit_004.php
@@ -0,0 +1,13 @@
+key(), $b->key());
+$a->next();
+$a->next();
+$a->next();
+$c = clone $a;
+var_dump((string)$c == (string)$a);
+var_dump($a->key(), $c->key());
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/dit_004.php.expectf b/hphp/test/zend/good/ext-spl/dit_004.php.expectf
new file mode 100644
index 000000000..dca5c280a
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/dit_004.php.expectf
@@ -0,0 +1,7 @@
+bool(true)
+int(0)
+int(0)
+bool(true)
+int(3)
+int(3)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_006.php b/hphp/test/zend/good/ext-spl/iterator_006.php
new file mode 100644
index 000000000..2fe9c2dab
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_006.php
@@ -0,0 +1,15 @@
+
+
+ Hello
+ World
+
+');
+
+foreach (new IteratorIterator($root->child) as $child) {
+ echo $child."\n";
+}
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_006.php.expectf b/hphp/test/zend/good/ext-spl/iterator_006.php.expectf
new file mode 100644
index 000000000..002685792
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_006.php.expectf
@@ -0,0 +1,3 @@
+Hello
+World
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_036.php b/hphp/test/zend/good/ext-spl/iterator_036.php
new file mode 100644
index 000000000..ea96172e3
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_036.php
@@ -0,0 +1,16 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_036.php.expectf b/hphp/test/zend/good/ext-spl/iterator_036.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_036.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_041.php b/hphp/test/zend/good/ext-spl/iterator_041.php
new file mode 100644
index 000000000..087b922c7
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_041.php
@@ -0,0 +1,91 @@
+state = MyArrayIterator::$fail;
+ self::fail(0, __FUNCTION__);
+ parent::__construct(array(1, 2));
+ self::fail(1, __FUNCTION__);
+ }
+
+ function rewind()
+ {
+ self::fail(2, __FUNCTION__);
+ return parent::rewind();
+ }
+
+ function valid()
+ {
+ self::fail(3, __FUNCTION__);
+ return parent::valid();
+ }
+
+ function current()
+ {
+ self::fail(4, __FUNCTION__);
+ return parent::current();
+ }
+
+ function key()
+ {
+ self::fail(5, __FUNCTION__);
+ return parent::key();
+ }
+
+ function next()
+ {
+ self::fail(6, __FUNCTION__);
+ return parent::next();
+ }
+
+ function __destruct()
+ {
+// self::fail(7, __FUNCTION__);
+ }
+
+ static function test($func, $skip = null)
+ {
+ echo "===$func===\n";
+ self::$fail = 0;
+ while(self::$fail < 10)
+ {
+ try
+ {
+ var_dump($func(new MyArrayIterator()));
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ if (isset($skip[self::$fail]))
+ {
+ self::$fail = $skip[self::$fail];
+ }
+ else
+ {
+ self::$fail++;
+ }
+ }
+ }
+}
+
+MyArrayIterator::test('iterator_to_array');
+MyArrayIterator::test('iterator_count', array(3 => 6));
+
+?>
+===DONE===
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_041.php.expectf b/hphp/test/zend/good/ext-spl/iterator_041.php.expectf
new file mode 100644
index 000000000..5521c91f3
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_041.php.expectf
@@ -0,0 +1,22 @@
+===iterator_to_array===
+State 0: __construct()
+State 1: __construct()
+State 2: rewind()
+State 3: valid()
+State 4: current()
+State 5: key()
+State 6: next()
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+===iterator_count===
+State 0: __construct()
+State 1: __construct()
+State 2: rewind()
+State 3: valid()
+State 6: next()
+int(2)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_058.php b/hphp/test/zend/good/ext-spl/iterator_058.php
new file mode 100644
index 000000000..92df77fc2
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_058.php
@@ -0,0 +1,17 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_058.php.expectf b/hphp/test/zend/good/ext-spl/iterator_058.php.expectf
new file mode 100644
index 000000000..c2317d63a
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_058.php.expectf
@@ -0,0 +1 @@
+no Exception thrown
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_067.php b/hphp/test/zend/good/ext-spl/iterator_067.php
new file mode 100644
index 000000000..5077c13eb
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_067.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_067.php.expectf b/hphp/test/zend/good/ext-spl/iterator_067.php.expectf
new file mode 100644
index 000000000..652f3865d
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_067.php.expectf
@@ -0,0 +1 @@
+no exception
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_068.php b/hphp/test/zend/good/ext-spl/iterator_068.php
new file mode 100644
index 000000000..86196888b
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_068.php
@@ -0,0 +1,26 @@
+foo();
+ }
+}
+
+$obj = new TestIteratorIterator(new Test);
+$obj->foo();
+unset($obj);
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_068.php.expectf b/hphp/test/zend/good/ext-spl/iterator_068.php.expectf
new file mode 100644
index 000000000..a811765ff
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_068.php.expectf
@@ -0,0 +1,4 @@
+Test::foo()
+TestIteratorIterator::__destruct()
+Test::foo()
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_069.php b/hphp/test/zend/good/ext-spl/iterator_069.php
new file mode 100644
index 000000000..99d6651b7
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_069.php
@@ -0,0 +1,12 @@
+getIterator());
+
+$recItIt = new RecursiveIteratorIterator($recArrIt);
+
+foreach ($recItIt as &$val) echo "$val\n";
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/iterator_069.php.expectf b/hphp/test/zend/good/ext-spl/iterator_069.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/iterator_069.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_002.php b/hphp/test/zend/good/ext-spl/spl_002.php
new file mode 100644
index 000000000..555471681
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_002.php
@@ -0,0 +1,16 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_002.php.expectf b/hphp/test/zend/good/ext-spl/spl_002.php.expectf
new file mode 100644
index 000000000..4ffd47783
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_002.php.expectf
@@ -0,0 +1,2 @@
+int(4)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_006.php b/hphp/test/zend/good/ext-spl/spl_006.php
new file mode 100644
index 000000000..271b8e659
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_006.php
@@ -0,0 +1,12 @@
+append(new ArrayIterator(array(1,2)));
+$it->append(new ArrayIterator(array(2,3)));
+
+var_dump(iterator_to_array($it));
+var_dump(iterator_to_array($it, false));
+var_dump(iterator_to_array($it, true));
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_006.php.expectf b/hphp/test/zend/good/ext-spl/spl_006.php.expectf
new file mode 100644
index 000000000..c09199a1a
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_006.php.expectf
@@ -0,0 +1,23 @@
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_autoload_014.php b/hphp/test/zend/good/ext-spl/spl_autoload_014.php
new file mode 100644
index 000000000..3eadafcdd
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_autoload_014.php
@@ -0,0 +1,38 @@
+dir = $dir;
+ }
+ public function __invoke($class) {
+ echo ("Autoloader('{$this->dir}') called with $class\n");
+ }
+}
+
+class WorkingAutoloader {
+ public function __invoke($class) {
+ echo ("WorkingAutoloader() called with $class\n");
+ eval("class $class { }");
+ }
+}
+
+$al1 = new Autoloader('d1');
+$al2 = new WorkingAutoloader('d2');
+
+spl_autoload_register($closure);
+spl_autoload_register($al1);
+spl_autoload_register($al2);
+
+$x = new TestX;
+
+spl_autoload_unregister($closure);
+spl_autoload_unregister($al1);
+
+$y = new TestY;
+
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_autoload_014.php.expectf b/hphp/test/zend/good/ext-spl/spl_autoload_014.php.expectf
new file mode 100644
index 000000000..9657363bf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_autoload_014.php.expectf
@@ -0,0 +1,5 @@
+closure called with class TestX
+Autoloader('d1') called with TestX
+WorkingAutoloader() called with TestX
+WorkingAutoloader() called with TestY
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_autoload_call_basic.php b/hphp/test/zend/good/ext-spl/spl_autoload_call_basic.php
new file mode 100644
index 000000000..b2bef326f
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_autoload_call_basic.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_autoload_call_basic.php.expectf b/hphp/test/zend/good/ext-spl/spl_autoload_call_basic.php.expectf
new file mode 100644
index 000000000..0ceae2e30
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_autoload_call_basic.php.expectf
@@ -0,0 +1,2 @@
+%stestclass.class.inc
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_classes.php b/hphp/test/zend/good/ext-spl/spl_classes.php
new file mode 100644
index 000000000..a146025c1
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_classes.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_classes.php.expectf b/hphp/test/zend/good/ext-spl/spl_classes.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_classes.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_fileinfo_getlinktarget_basic.php b/hphp/test/zend/good/ext-spl/spl_fileinfo_getlinktarget_basic.php
new file mode 100644
index 000000000..9ed482bfd
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_fileinfo_getlinktarget_basic.php
@@ -0,0 +1,10 @@
+isLink()) {
+ echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL;
+}
+var_dump(unlink($link));
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_fileinfo_getlinktarget_basic.php.expectf b/hphp/test/zend/good/ext-spl/spl_fileinfo_getlinktarget_basic.php.expectf
new file mode 100644
index 000000000..a84e07ff0
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_fileinfo_getlinktarget_basic.php.expectf
@@ -0,0 +1,2 @@
+same
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_iterator_apply_error.php b/hphp/test/zend/good/ext-spl/spl_iterator_apply_error.php
new file mode 100644
index 000000000..3a0b73117
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_iterator_apply_error.php
@@ -0,0 +1,21 @@
+getMessage();
+}
+
+?>
+
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_iterator_apply_error.php.expectf b/hphp/test/zend/good/ext-spl/spl_iterator_apply_error.php.expectf
new file mode 100644
index 000000000..2cc0a11a1
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_iterator_apply_error.php.expectf
@@ -0,0 +1 @@
+Make the iterator break
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_iterator_recursive_getiterator_error.php b/hphp/test/zend/good/ext-spl/spl_iterator_recursive_getiterator_error.php
new file mode 100644
index 000000000..74a686441
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_iterator_recursive_getiterator_error.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_iterator_recursive_getiterator_error.php.expectf b/hphp/test/zend/good/ext-spl/spl_iterator_recursive_getiterator_error.php.expectf
new file mode 100644
index 000000000..3dad4aedf
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_iterator_recursive_getiterator_error.php.expectf
@@ -0,0 +1 @@
+HipHop Fatal error: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_iterator_to_array_basic.php b/hphp/test/zend/good/ext-spl/spl_iterator_to_array_basic.php
new file mode 100644
index 000000000..5b9e194ad
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_iterator_to_array_basic.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/spl_iterator_to_array_basic.php.expectf b/hphp/test/zend/good/ext-spl/spl_iterator_to_array_basic.php.expectf
new file mode 100644
index 000000000..cfb6a8593
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/spl_iterator_to_array_basic.php.expectf
@@ -0,0 +1 @@
+HipHop Warning: %a
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-spl/testclass.class.inc b/hphp/test/zend/good/ext-spl/testclass.class.inc
new file mode 100644
index 000000000..f5fe7411f
--- /dev/null
+++ b/hphp/test/zend/good/ext-spl/testclass.class.inc
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/good/zend/bug43703.php.expectf~HEAD b/hphp/test/zend/good/zend/bug43703.php.expectf~HEAD
new file mode 100644
index 000000000..096264973
--- /dev/null
+++ b/hphp/test/zend/good/zend/bug43703.php.expectf~HEAD
@@ -0,0 +1 @@
+DONE
\ No newline at end of file
diff --git a/hphp/test/zend/good/zend/bug43703.php.expectf~fully quality paths b/hphp/test/zend/good/zend/bug43703.php.expectf~fully quality paths
new file mode 100644
index 000000000..096264973
--- /dev/null
+++ b/hphp/test/zend/good/zend/bug43703.php.expectf~fully quality paths
@@ -0,0 +1 @@
+DONE
\ No newline at end of file
diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py
index 3ff1bb2e1..7e00ef362 100755
--- a/hphp/tools/import_zend_test.py
+++ b/hphp/tools/import_zend_test.py
@@ -65,6 +65,23 @@ no_import = (
'/Zend/tests/003.phpt',
# spews files until they work
+ '/ext/spl/tests/SplFileInfo_getExtension_basic.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt',
+ '/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt',
+ '/ext/spl/tests/SplFileObject_getflags_basic.phpt',
+ '/ext/spl/tests/SplFileObject_getflags_error001.phpt',
+ '/ext/spl/tests/SplFileObject_getflags_error002.phpt',
+ '/ext/spl/tests/SplFileObject_rewind_error001.phpt',
+ '/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt',
+ '/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt',
+ '/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt',
+ '/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt',
'/ext/xmlwriter/tests/001.phpt',
'/ext/xmlwriter/tests/004.phpt',
'/ext/xmlwriter/tests/005.phpt',
@@ -78,7 +95,6 @@ no_import = (
'/ext/xmlwriter/examples/',
# not imported yet, but will be
- '/ext/spl',
'/ext/standard',
# not implemented extensions
@@ -222,6 +238,7 @@ other_files = (
'/ext-soap-schema/test_schema.inc',
'/ext-soap-soap12/soap12-test.inc',
'/ext-soap-soap12/soap12-test.wsdl',
+ '/ext-spl/testclass.class.inc',
'/ext-sqlite3/new_db.inc',
'/ext-sqlite3/stream_test.inc',
'/ext-xml/xmltest.xml',