diff --git a/hphp/test/zend/bad/ext-phar-tar/badalias.php b/hphp/test/zend/bad/ext-phar-tar/badalias.php
new file mode 100644
index 000000000..215ba8f2a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/badalias.php
@@ -0,0 +1,11 @@
+getMessage(), "\n";
+}
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/badalias.php.expectf b/hphp/test/zend/bad/ext-phar-tar/badalias.php.expectf
new file mode 100644
index 000000000..add7e2315
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/badalias.php.expectf
@@ -0,0 +1,6 @@
+phar error: invalid alias "hi/thereaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..." in tar-based phar "%sbadalias1.phar.tar"
+phar error: invalid alias "hi\there" in tar-based phar "%sbadalias2.phar.tar"
+phar error: invalid alias "hi;there" in tar-based phar "%sbadalias3.phar.tar"
+phar error: invalid alias "hi:there" in tar-based phar "%sbadalias4.phar.tar"
+phar error: tar-based phar "%sbadalias5.phar.tar" has alias that is larger than 511 bytes, cannot process
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/badchecksum.php b/hphp/test/zend/bad/ext-phar-tar/badchecksum.php
new file mode 100644
index 000000000..08981a2ca
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/badchecksum.php
@@ -0,0 +1,21 @@
+init();
+$a->addFile('hithere', 'contents', null, 'checksum');
+$a->close();
+
+try {
+ $p = new PharData($fname);
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+?>
+===DONE===?>
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/badchecksum.php.expectf b/hphp/test/zend/bad/ext-phar-tar/badchecksum.php.expectf
new file mode 100644
index 000000000..058b54ea4
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/badchecksum.php.expectf
@@ -0,0 +1,2 @@
+phar error: "%sbadchecksum.tar" is a corrupted tar file (checksum mismatch of file "hithere")
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/bug49910.php b/hphp/test/zend/bad/ext-phar-tar/bug49910.php
new file mode 100644
index 000000000..9dd04ae9f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/bug49910.php
@@ -0,0 +1,10 @@
+getPathName());
+}
+print_r($files);
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/bug49910.php.expectf b/hphp/test/zend/bad/ext-phar-tar/bug49910.php.expectf
new file mode 100644
index 000000000..a64304e23
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/bug49910.php.expectf
@@ -0,0 +1,33 @@
+Array
+(
+ [0] => phar://*/Structures_Graph-1.0.3/LICENSE
+ [1] => phar://*/Structures_Graph-1.0.3/Structures/Graph/Manipulator/AcyclicTest.php
+ [2] => phar://*/Structures_Graph-1.0.3/Structures/Graph/Manipulator/TopologicalSorter.php
+ [3] => phar://*/Structures_Graph-1.0.3/Structures/Graph/Node.php
+ [4] => phar://*/Structures_Graph-1.0.3/Structures/Graph.php
+ [5] => phar://*/Structures_Graph-1.0.3/docs/generate.sh
+ [6] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph.html
+ [7] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html
+ [8] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html
+ [9] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/Structures_Graph_Node.html
+ [10] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html
+ [11] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html
+ [12] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_Node_php.html
+ [13] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/_Structures_Graph_php.html
+ [14] => phar://*/Structures_Graph-1.0.3/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html
+ [15] => phar://*/Structures_Graph-1.0.3/docs/html/classtrees_Structures_Graph.html
+ [16] => phar://*/Structures_Graph-1.0.3/docs/html/elementindex.html
+ [17] => phar://*/Structures_Graph-1.0.3/docs/html/elementindex_Structures_Graph.html
+ [18] => phar://*/Structures_Graph-1.0.3/docs/html/errors.html
+ [19] => phar://*/Structures_Graph-1.0.3/docs/html/index.html
+ [20] => phar://*/Structures_Graph-1.0.3/docs/html/li_Structures_Graph.html
+ [21] => phar://*/Structures_Graph-1.0.3/docs/html/media/banner.css
+ [22] => phar://*/Structures_Graph-1.0.3/docs/html/media/stylesheet.css
+ [23] => phar://*/Structures_Graph-1.0.3/docs/html/packages.html
+ [24] => phar://*/Structures_Graph-1.0.3/docs/html/todolist.html
+ [25] => phar://*/Structures_Graph-1.0.3/docs/tutorials/Structures_Graph/Structures_Graph.pkg
+ [26] => phar://*/Structures_Graph-1.0.3/tests/AllTests.php
+ [27] => phar://*/Structures_Graph-1.0.3/tests/testCase/BasicGraph.php
+ [28] => phar://*/package.xml
+)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/links2.php b/hphp/test/zend/bad/ext-phar-tar/links2.php
new file mode 100644
index 000000000..c247d60a8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/links2.php
@@ -0,0 +1,26 @@
+init();
+$a->addFile('hardlink', 'internal/file.txt', array(
+ 'mode' => 0xA000 + 0644,
+ 'uid' => 0,
+ 'gid' => 0,
+ 'size' => 0,
+ 'mtime' => time(),
+ ));
+$a->close();
+
+try {
+ $p = new PharData($fname);
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===?>
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/links2.php.expectf b/hphp/test/zend/bad/ext-phar-tar/links2.php.expectf
new file mode 100644
index 000000000..9022acc01
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/links2.php.expectf
@@ -0,0 +1,2 @@
+phar error: "%slinks2.tar" is a corrupted tar file - hard link to non-existent file "internal/file.txt"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/tar_001.php b/hphp/test/zend/bad/ext-phar-tar/tar_001.php
new file mode 100644
index 000000000..a343bb1d2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/tar_001.php
@@ -0,0 +1,20 @@
+init();
+$tar->addFile('tar_001.phpt', __FILE__);
+$tar->close();
+
+$tar = fopen('phar://' . dirname(__FILE__) . '/tar_001.phar.tar/tar_001.phpt', 'rb');
+try {
+ $phar = new Phar(dirname(__FILE__) . '/tar_001.phar.tar');
+ echo "should not execute\n";
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===?>
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/tar_001.php.expectf b/hphp/test/zend/bad/ext-phar-tar/tar_001.php.expectf
new file mode 100644
index 000000000..9e50f50e2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/tar_001.php.expectf
@@ -0,0 +1,3 @@
+HipHop Warning: %s
+phar error: "%star_001.phar.tar" is a corrupted tar file (truncated)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/truncated.php b/hphp/test/zend/bad/ext-phar-tar/truncated.php
new file mode 100644
index 000000000..a95f1e9f8
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/truncated.php
@@ -0,0 +1,13 @@
+getMessage() . "\n";
+}
+
+?>
+===DONE===?>
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-tar/truncated.php.expectf b/hphp/test/zend/bad/ext-phar-tar/truncated.php.expectf
new file mode 100644
index 000000000..76cf5477e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-tar/truncated.php.expectf
@@ -0,0 +1,2 @@
+phar error: "%strunc.tar" is a corrupted tar file (truncated)
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/badalias.php b/hphp/test/zend/bad/ext-phar-zip/badalias.php
new file mode 100644
index 000000000..d606f39ed
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/badalias.php
@@ -0,0 +1,11 @@
+getMessage(), "\n";
+}
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/badalias.php.expectf b/hphp/test/zend/bad/ext-phar-zip/badalias.php.expectf
new file mode 100644
index 000000000..4118e2e06
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/badalias.php.expectf
@@ -0,0 +1,6 @@
+phar error: invalid alias "hi/there" in zip-based phar "%sbadalias1.phar.zip"
+phar error: invalid alias "hi\there" in zip-based phar "%sbadalias2.phar.zip"
+phar error: invalid alias "hi\there" in zip-based phar "%sbadalias3.phar.zip"
+phar error: invalid alias "hi;there" in zip-based phar "%sbadalias4.phar.zip"
+phar error: invalid alias "hi:there" in zip-based phar "%sbadalias5.phar.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/bug48791.php b/hphp/test/zend/bad/ext-phar-zip/bug48791.php
new file mode 100644
index 000000000..dba36dcd2
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/bug48791.php
@@ -0,0 +1,4 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/bug48791.php.expectf b/hphp/test/zend/bad/ext-phar-zip/bug48791.php.expectf
new file mode 100644
index 000000000..2673b3b5c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/bug48791.php.expectf
@@ -0,0 +1,3 @@
+
+ÜberschriftName:$$n_fn$$Firma:$$org_name$$Menge:$$#menge$$
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/bzip2.php b/hphp/test/zend/bad/ext-phar-zip/bzip2.php
new file mode 100644
index 000000000..920d440da
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/bzip2.php
@@ -0,0 +1,13 @@
+ $file) {
+ echo $file->getContent();
+ }
+ $a = new Phar(dirname(__FILE__) . '/files/bz2_alias.phar.zip');
+ var_dump($a->getAlias());
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/bzip2.php.expectf b/hphp/test/zend/bad/ext-phar-zip/bzip2.php.expectf
new file mode 100644
index 000000000..88526a85f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/bzip2.php.expectf
@@ -0,0 +1,62 @@
+addFile('hi', null, 'hii');
+$a->addFile('hi2', null, 'hii2', null, null, 'encrypt', 'encrypt');
+$a->writeZip(dirname(__FILE__) . '/encrypted.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii');
+$a->addFile('', null, 'stdin');
+$a->writeZip(dirname(__FILE__) . '/stdin.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hii', null, 'hii', null, null, 'filename_len', 'filename_len');
+$a->addFile('hi', null, 'hii');
+$a->writeZip(dirname(__FILE__) . '/truncfilename.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress');
+$a->writeZip(dirname(__FILE__) . '/compress_unsup1.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 2);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup2.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 3);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup3.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 4);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup4.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 5);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup5.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 6);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup6.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 7);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup7.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 9);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup9.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 10);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup10.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 14);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup14.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 18);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup18.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 19);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup19.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 97);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup97.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 98);
+$a->writeZip(dirname(__FILE__) . '/compress_unsup98.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 11);
+$a->writeZip(dirname(__FILE__) . '/compress_unsupunknown.zip');
+?>
+string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_001.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_001.php
new file mode 100644
index 000000000..a851b527d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_001.php
@@ -0,0 +1,13 @@
+getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/count2.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_001.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_001.php.expectf
new file mode 100644
index 000000000..4e7dcbae9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_001.php.expectf
@@ -0,0 +1,3 @@
+phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar "%scount1.zip"
+phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar "%scount2.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_002.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_002.php
new file mode 100644
index 000000000..d0e5db695
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_002.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_002.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_002.php.expectf
new file mode 100644
index 000000000..0f792d0dd
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_002.php.expectf
@@ -0,0 +1,2 @@
+phar error: end of central directory not found in zip-based phar "%snozipend.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_003.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_003.php
new file mode 100644
index 000000000..a1b07278c
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_003.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_003.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_003.php.expectf
new file mode 100644
index 000000000..ff3145905
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_003.php.expectf
@@ -0,0 +1,2 @@
+phar error: corrupt zip archive, zip file comment truncated in zip-based phar "%sfilecomment.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_004.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_004.php
new file mode 100644
index 000000000..9ae5d14a6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_004.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_004.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_004.php.expectf
new file mode 100644
index 000000000..78fecd5d7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_004.php.expectf
@@ -0,0 +1,2 @@
+phar error: corrupted central directory entry, no magic signature in zip-based phar "%scdir_offset.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_005.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_005.php
new file mode 100644
index 000000000..032a28c23
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_005.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_005.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_005.php.expectf
new file mode 100644
index 000000000..580d75c19
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_005.php.expectf
@@ -0,0 +1,2 @@
+phar error: Cannot process encrypted zip files in zip-based phar "%sencrypted.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_006.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_006.php
new file mode 100644
index 000000000..1e547042b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_006.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_006.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_006.php.expectf
new file mode 100644
index 000000000..c46b129e3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_006.php.expectf
@@ -0,0 +1,2 @@
+phar error: Cannot process zips created from stdin (zero-length filename) in zip-based phar "%sstdin.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_007.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_007.php
new file mode 100644
index 000000000..1d1085e60
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_007.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_007.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_007.php.expectf
new file mode 100644
index 000000000..65cf859d3
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_007.php.expectf
@@ -0,0 +1,2 @@
+phar error: corrupted central directory entry, no magic signature in zip-based phar "%struncfilename.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_008.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_008.php
new file mode 100644
index 000000000..c46c253c6
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_008.php
@@ -0,0 +1,78 @@
+getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup2.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup3.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup4.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup5.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup6.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup7.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup9.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup10.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup14.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup18.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup19.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup97.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsup98.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ new PharData(dirname(__FILE__) . '/files/compress_unsupunknown.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_008.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_008.php.expectf
new file mode 100644
index 000000000..213a4086b
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_008.php.expectf
@@ -0,0 +1,16 @@
+phar error: unsupported compression method (Shrunk) used in this zip in zip-based phar "%scompress_unsup1.zip"
+phar error: unsupported compression method (Reduce) used in this zip in zip-based phar "%scompress_unsup2.zip"
+phar error: unsupported compression method (Reduce) used in this zip in zip-based phar "%scompress_unsup3.zip"
+phar error: unsupported compression method (Reduce) used in this zip in zip-based phar "%scompress_unsup4.zip"
+phar error: unsupported compression method (Reduce) used in this zip in zip-based phar "%scompress_unsup5.zip"
+phar error: unsupported compression method (Implode) used in this zip in zip-based phar "%scompress_unsup6.zip"
+phar error: unsupported compression method (Tokenize) used in this zip in zip-based phar "%scompress_unsup7.zip"
+phar error: unsupported compression method (Deflate64) used in this zip in zip-based phar "%scompress_unsup9.zip"
+phar error: unsupported compression method (PKWare Implode/old IBM TERSE) used in this zip in zip-based phar "%scompress_unsup10.zip"
+phar error: unsupported compression method (LZMA) used in this zip in zip-based phar "%scompress_unsup14.zip"
+phar error: unsupported compression method (IBM TERSE) used in this zip in zip-based phar "%scompress_unsup18.zip"
+phar error: unsupported compression method (IBM LZ77) used in this zip in zip-based phar "%scompress_unsup19.zip"
+phar error: unsupported compression method (WavPack) used in this zip in zip-based phar "%scompress_unsup97.zip"
+phar error: unsupported compression method (PPMd) used in this zip in zip-based phar "%scompress_unsup98.zip"
+phar error: unsupported compression method (unknown) used in this zip in zip-based phar "%scompress_unsupunknown.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_009.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_009.php
new file mode 100644
index 000000000..5b252b3f5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_009.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_009.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_009.php.expectf
new file mode 100644
index 000000000..14f07e3c1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_009.php.expectf
@@ -0,0 +1,2 @@
+phar error: Unable to process extra field header for file in central directory in zip-based phar "%sextralen_toolong.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_010.php b/hphp/test/zend/bad/ext-phar-zip/corrupt_010.php
new file mode 100644
index 000000000..dae52d84e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_010.php
@@ -0,0 +1,8 @@
+getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/corrupt_010.php.expectf b/hphp/test/zend/bad/ext-phar-zip/corrupt_010.php.expectf
new file mode 100644
index 000000000..b16a5af91
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/corrupt_010.php.expectf
@@ -0,0 +1,2 @@
+phar error: split archives spanning multiple zips cannot be processed in zip-based phar "%sdisknumber.zip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/odt.php b/hphp/test/zend/bad/ext-phar-zip/odt.php
new file mode 100644
index 000000000..cabe3fc64
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/odt.php
@@ -0,0 +1,17 @@
+isDir()) {
+ echo "dir " . $b->getPathName() . "\n";
+ } else {
+ echo $b->getPathName() . "\n";
+ }
+}
+// this next line is for increased code coverage
+try {
+ $b = new Phar(dirname(__FILE__) . '/files/odt.odt');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/odt.php.expectf b/hphp/test/zend/bad/ext-phar-zip/odt.php.expectf
new file mode 100644
index 000000000..ba507937d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/odt.php.expectf
@@ -0,0 +1,10 @@
+phar://%sodt.odt/Configurations2/accelerator%ccurrent.xml
+phar://%sodt.odt/META-INF%cmanifest.xml
+phar://%sodt.odt/Thumbnails%cthumbnail.png
+phar://%sodt.odt%ccontent.xml
+phar://%sodt.odt%cmeta.xml
+phar://%sodt.odt%cmimetype
+phar://%sodt.odt%csettings.xml
+phar://%sodt.odt%cstyles.xml
+Cannot create phar '%sodt.odt', file extension (or combination) not recognised or the directory does not exist
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/unixzip.php b/hphp/test/zend/bad/ext-phar-zip/unixzip.php
new file mode 100644
index 000000000..43fd68a9a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/unixzip.php
@@ -0,0 +1,15 @@
+isDir()) {
+ echo "dir " . $b->getPathName() . "\n";
+ } else {
+ echo $b->getPathName(), "\n";
+ echo file_get_contents($b->getPathName()), "\n";
+ }
+}
+if (isset($a['notempty/hi.txt'])) {
+ echo $a['notempty/hi.txt']->getPathName() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/unixzip.php.expectf b/hphp/test/zend/bad/ext-phar-zip/unixzip.php.expectf
new file mode 100644
index 000000000..6881f13f5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/unixzip.php.expectf
@@ -0,0 +1,7 @@
+dir phar://%s/zip.zip%cempty
+phar://%s/zip.zip%chi.txt
+hi there
+
+dir phar://%s/zip.zip%cnotempty
+phar://%s/zip.zip/notempty%chi.txt
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/zlib.php b/hphp/test/zend/bad/ext-phar-zip/zlib.php
new file mode 100644
index 000000000..43cc96013
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/zlib.php
@@ -0,0 +1,9 @@
+getAlias());
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar-zip/zlib.php.expectf b/hphp/test/zend/bad/ext-phar-zip/zlib.php.expectf
new file mode 100644
index 000000000..e82283a6d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar-zip/zlib.php.expectf
@@ -0,0 +1,2 @@
+string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/001.php b/hphp/test/zend/bad/ext-phar/001.php
new file mode 100644
index 000000000..3c2f96d6f
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/001.php
@@ -0,0 +1,4 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/001.php.expectf b/hphp/test/zend/bad/ext-phar/001.php.expectf
new file mode 100644
index 000000000..98145b966
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/001.php.expectf
@@ -0,0 +1,2 @@
+string(5) "1.1.1"
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/002.php b/hphp/test/zend/bad/ext-phar/002.php
new file mode 100644
index 000000000..690b1c759
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/002.php
@@ -0,0 +1,9 @@
+getMessage();
+}
+__HALT_COMPILER(); ?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/002.php.expectf b/hphp/test/zend/bad/ext-phar/002.php.expectf
new file mode 100644
index 000000000..346dd0adb
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/002.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %s
+internal corruption of phar "%s002.php" (truncated manifest at manifest length)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/003.php b/hphp/test/zend/bad/ext-phar/003.php
new file mode 100644
index 000000000..f86c90e96
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/003.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/003.php.expectf b/hphp/test/zend/bad/ext-phar/003.php.expectf
new file mode 100644
index 000000000..254d25151
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/003.php.expectf
@@ -0,0 +1 @@
+bool(true)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/003a.php b/hphp/test/zend/bad/ext-phar/003a.php
new file mode 100644
index 000000000..8e1948652
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/003a.php
@@ -0,0 +1,5 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/003a.php.expectf b/hphp/test/zend/bad/ext-phar/003a.php.expectf
new file mode 100644
index 000000000..c3b0dc5d5
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/003a.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-phar/005.php b/hphp/test/zend/bad/ext-phar/005.php
new file mode 100644
index 000000000..7d408f3d1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/005.php
@@ -0,0 +1,7 @@
+getMessage();
+}
+__HALT_COMPILER(); ?>()
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/005.php.expectf b/hphp/test/zend/bad/ext-phar/005.php.expectf
new file mode 100644
index 000000000..f542053c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/005.php.expectf
@@ -0,0 +1 @@
+internal corruption of phar "%s" (truncated manifest at manifest length)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/006.php b/hphp/test/zend/bad/ext-phar/006.php
new file mode 100644
index 000000000..1668f1b40
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/006.php
@@ -0,0 +1,7 @@
+getMessage();
+}
+__HALT_COMPILER(); ?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/006.php.expectf b/hphp/test/zend/bad/ext-phar/006.php.expectf
new file mode 100644
index 000000000..f542053c7
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/006.php.expectf
@@ -0,0 +1 @@
+internal corruption of phar "%s" (truncated manifest at manifest length)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/007.php b/hphp/test/zend/bad/ext-phar/007.php
new file mode 100644
index 000000000..f0163e185
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/007.php
@@ -0,0 +1,7 @@
+getMessage();
+}
+__HALT_COMPILER(); ?>~~~~
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/007.php.expectf b/hphp/test/zend/bad/ext-phar/007.php.expectf
new file mode 100644
index 000000000..45d230823
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/007.php.expectf
@@ -0,0 +1 @@
+manifest cannot be larger than 100 MB in phar "%s"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/008.phar.php b/hphp/test/zend/bad/ext-phar/008.phar.php
new file mode 100644
index 000000000..41cb56526
Binary files /dev/null and b/hphp/test/zend/bad/ext-phar/008.phar.php differ
diff --git a/hphp/test/zend/bad/ext-phar/008.php b/hphp/test/zend/bad/ext-phar/008.php
new file mode 100644
index 000000000..5869b0202
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/008.php
@@ -0,0 +1,12 @@
+";
+$file .= pack('V', 500) . 'notenough';
+file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
+try {
+include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+} catch (Exception $e) {
+echo $e->getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/008.php.expectf b/hphp/test/zend/bad/ext-phar/008.php.expectf
new file mode 100644
index 000000000..67b63959a
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/008.php.expectf
@@ -0,0 +1 @@
+internal corruption of phar "%s" (truncated manifest header)
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/bug46032.php b/hphp/test/zend/bad/ext-phar/bug46032.php
new file mode 100644
index 000000000..85c829e9e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/bug46032.php
@@ -0,0 +1,19 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/bug46032.php.expectf b/hphp/test/zend/bad/ext-phar/bug46032.php.expectf
new file mode 100644
index 000000000..341c0052d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/bug46032.php.expectf
@@ -0,0 +1,7 @@
+%string|unicode%(%d) "%smytest"
+%string|unicode%(%d) "%smytest"
+HipHop Fatal error: %s
+Stack trace:
+#0 %sbug46032.php(%d): PharData->__construct('000000000000000...')
+#1 {main}
+ thrown in %sbug46032.php on line %d
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/bug54395.php b/hphp/test/zend/bad/ext-phar/bug54395.php
new file mode 100644
index 000000000..443924e8d
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/bug54395.php
@@ -0,0 +1,9 @@
+getMessage());
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/bug54395.php.expectf b/hphp/test/zend/bad/ext-phar/bug54395.php.expectf
new file mode 100644
index 000000000..9417a7fa1
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/bug54395.php.expectf
@@ -0,0 +1 @@
+string(25) "Mounting of 1 to 1 failed"
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/bug60261.php b/hphp/test/zend/bad/ext-phar/bug60261.php
new file mode 100644
index 000000000..42fe0da5e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/bug60261.php
@@ -0,0 +1,10 @@
+getLinkTarget();
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/bug60261.php.expectf b/hphp/test/zend/bad/ext-phar/bug60261.php.expectf
new file mode 100644
index 000000000..61a3faca9
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/bug60261.php.expectf
@@ -0,0 +1,2 @@
+HipHop Warning: %s
+SplFileInfo::getLinkTarget(): Empty filename
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/nophar.php b/hphp/test/zend/bad/ext-phar/nophar.php
new file mode 100644
index 000000000..1d2027568
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/nophar.php
@@ -0,0 +1,4 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/nophar.php.expectf b/hphp/test/zend/bad/ext-phar/nophar.php.expectf
new file mode 100644
index 000000000..c61dd04ea
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/nophar.php.expectf
@@ -0,0 +1,4 @@
+in b
+getMessage() . "\n";
+}
+echo "============================================================================\n";
+echo "============================================================================\n";
+echo "============================================================================\n";
+echo "============================================================================\n";
+try {
+var_dump(Phar::createDefaultStub('my/custom/thingy.php', 'the/web.php'));
+echo "============================================================================\n";
+echo "============================================================================\n";
+var_dump(strlen(Phar::createDefaultStub('index.php', str_repeat('a', 400))));
+var_dump(Phar::createDefaultStub('hio', str_repeat('a', 401)));
+} catch (Exception $e) {
+echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/phar_createdefaultstub.php.expectf b/hphp/test/zend/bad/ext-phar/phar_createdefaultstub.php.expectf
new file mode 100644
index 000000000..ccee95a6e
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/phar_createdefaultstub.php.expectf
@@ -0,0 +1,893 @@
+string(6683) " 2,
+'c' => 'text/plain',
+'cc' => 'text/plain',
+'cpp' => 'text/plain',
+'c++' => 'text/plain',
+'dtd' => 'text/plain',
+'h' => 'text/plain',
+'log' => 'text/plain',
+'rng' => 'text/plain',
+'txt' => 'text/plain',
+'xsd' => 'text/plain',
+'php' => 1,
+'inc' => 1,
+'avi' => 'video/avi',
+'bmp' => 'image/bmp',
+'css' => 'text/css',
+'gif' => 'image/gif',
+'htm' => 'text/html',
+'html' => 'text/html',
+'htmls' => 'text/html',
+'ico' => 'image/x-ico',
+'jpe' => 'image/jpeg',
+'jpg' => 'image/jpeg',
+'jpeg' => 'image/jpeg',
+'js' => 'application/x-javascript',
+'midi' => 'audio/midi',
+'mid' => 'audio/midi',
+'mod' => 'audio/mod',
+'mov' => 'movie/quicktime',
+'mp3' => 'audio/mp3',
+'mpg' => 'video/mpeg',
+'mpeg' => 'video/mpeg',
+'pdf' => 'application/pdf',
+'png' => 'image/png',
+'swf' => 'application/shockwave-flash',
+'tif' => 'image/tiff',
+'tiff' => 'image/tiff',
+'wav' => 'audio/wav',
+'xbm' => 'image/xbm',
+'xml' => 'text/xml',
+);
+
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+
+$basename = basename(__FILE__);
+if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
+chdir(Extract_Phar::$temp);
+include $web;
+return;
+}
+$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
+if (!$pt || $pt == '/') {
+$pt = $web;
+header('HTTP/1.1 301 Moved Permanently');
+header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
+exit;
+}
+$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
+if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
+header('HTTP/1.0 404 Not Found');
+echo "\n
\n File Not Found\n \n \n 404 - File ", $pt, " Not Found
\n \n";
+exit;
+}
+$b = pathinfo($a);
+if (!isset($b['extension'])) {
+header('Content-Type: text/plain');
+header('Content-Length: ' . filesize($a));
+readfile($a);
+exit;
+}
+if (isset($mimes[$b['extension']])) {
+if ($mimes[$b['extension']] === 1) {
+include $a;
+exit;
+}
+if ($mimes[$b['extension']] === 2) {
+highlight_file($a);
+exit;
+}
+header('Content-Type: ' .$mimes[$b['extension']]);
+header('Content-Length: ' . filesize($a));
+readfile($a);
+exit;
+}
+}
+
+class Extract_Phar
+{
+static $temp;
+static $origdir;
+const GZ = 0x1000;
+const BZ2 = 0x2000;
+const MASK = 0x3000;
+const START = 'index.php';
+const LEN = 6685;
+
+static function go($return = false)
+{
+$fp = fopen(__FILE__, 'rb');
+fseek($fp, self::LEN);
+$L = unpack('V', $a = (binary)fread($fp, 4));
+$m = (binary)'';
+
+do {
+$read = 8192;
+if ($L[1] - strlen($m) < 8192) {
+$read = $L[1] - strlen($m);
+}
+$last = (binary)fread($fp, $read);
+$m .= $last;
+} while (strlen($last) && strlen($m) < $L[1]);
+
+if (strlen($m) < $L[1]) {
+die('ERROR: manifest length read was "' .
+strlen($m) .'" should be "' .
+$L[1] . '"');
+}
+
+$info = self::_unpack($m);
+$f = $info['c'];
+
+if ($f & self::GZ) {
+if (!function_exists('gzinflate')) {
+die('Error: zlib extension is not enabled -' .
+' gzinflate() function needed for zlib-compressed .phars');
+}
+}
+
+if ($f & self::BZ2) {
+if (!function_exists('bzdecompress')) {
+die('Error: bzip2 extension is not enabled -' .
+' bzdecompress() function needed for bz2-compressed .phars');
+}
+}
+
+$temp = self::tmpdir();
+
+if (!$temp || !is_writable($temp)) {
+$sessionpath = session_save_path();
+if (strpos ($sessionpath, ";") !== false)
+$sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1);
+if (!file_exists($sessionpath) || !is_dir($sessionpath)) {
+die('Could not locate temporary directory to extract phar');
+}
+$temp = $sessionpath;
+}
+
+$temp .= '/pharextract/'.basename(__FILE__, '.phar');
+self::$temp = $temp;
+self::$origdir = getcwd();
+@mkdir($temp, 0777, true);
+$temp = realpath($temp);
+
+if (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {
+self::_removeTmpFiles($temp, getcwd());
+@mkdir($temp, 0777, true);
+@file_put_contents($temp . '/' . md5_file(__FILE__), '');
+
+foreach ($info['m'] as $path => $file) {
+$a = !file_exists(dirname($temp . '/' . $path));
+@mkdir(dirname($temp . '/' . $path), 0777, true);
+clearstatcache();
+
+if ($path[strlen($path) - 1] == '/') {
+@mkdir($temp . '/' . $path, 0777);
+} else {
+file_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));
+@chmod($temp . '/' . $path, 0666);
+}
+}
+}
+
+chdir($temp);
+
+if (!$return) {
+include self::START;
+}
+}
+
+static function tmpdir()
+{
+if (strpos(PHP_OS, 'WIN') !== false) {
+if ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {
+return $var;
+}
+if (is_dir('/temp') || mkdir('/temp')) {
+return realpath('/temp');
+}
+return false;
+}
+if ($var = getenv('TMPDIR')) {
+return $var;
+}
+return realpath('/tmp');
+}
+
+static function _unpack($m)
+{
+$info = unpack('V', substr($m, 0, 4));
+ $l = unpack('V', substr($m, 10, 4));
+$m = substr($m, 14 + $l[1]);
+$s = unpack('V', substr($m, 0, 4));
+$o = 0;
+$start = 4 + $s[1];
+$ret['c'] = 0;
+
+for ($i = 0; $i < $info[1]; $i++) {
+ $len = unpack('V', substr($m, $start, 4));
+$start += 4;
+ $savepath = substr($m, $start, $len[1]);
+$start += $len[1];
+ $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));
+$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]
+& 0xffffffff);
+$ret['m'][$savepath][7] = $o;
+$o += $ret['m'][$savepath][2];
+$start += 24 + $ret['m'][$savepath][5];
+$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;
+}
+return $ret;
+}
+
+static function extractFile($path, $entry, $fp)
+{
+$data = '';
+$c = $entry[2];
+
+while ($c) {
+if ($c < 8192) {
+$data .= @fread($fp, $c);
+$c = 0;
+} else {
+$c -= 8192;
+$data .= @fread($fp, 8192);
+}
+}
+
+if ($entry[4] & self::GZ) {
+$data = gzinflate($data);
+} elseif ($entry[4] & self::BZ2) {
+$data = bzdecompress($data);
+}
+
+if (strlen($data) != $entry[0]) {
+die("Invalid internal .phar file (size error " . strlen($data) . " != " .
+$stat[7] . ")");
+}
+
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
+die("Invalid internal .phar file (checksum error)");
+}
+
+return $data;
+}
+
+static function _removeTmpFiles($temp, $origdir)
+{
+chdir($temp);
+
+foreach (glob('*') as $f) {
+if (file_exists($f)) {
+is_dir($f) ? @rmdir($f) : @unlink($f);
+if (file_exists($f) && is_dir($f)) {
+self::_removeTmpFiles($f, getcwd());
+}
+}
+}
+
+@rmdir($temp);
+clearstatcache();
+chdir($origdir);
+}
+}
+
+Extract_Phar::go();
+__HALT_COMPILER(); ?>"
+============================================================================
+============================================================================
+string(6694) " 2,
+'c' => 'text/plain',
+'cc' => 'text/plain',
+'cpp' => 'text/plain',
+'c++' => 'text/plain',
+'dtd' => 'text/plain',
+'h' => 'text/plain',
+'log' => 'text/plain',
+'rng' => 'text/plain',
+'txt' => 'text/plain',
+'xsd' => 'text/plain',
+'php' => 1,
+'inc' => 1,
+'avi' => 'video/avi',
+'bmp' => 'image/bmp',
+'css' => 'text/css',
+'gif' => 'image/gif',
+'htm' => 'text/html',
+'html' => 'text/html',
+'htmls' => 'text/html',
+'ico' => 'image/x-ico',
+'jpe' => 'image/jpeg',
+'jpg' => 'image/jpeg',
+'jpeg' => 'image/jpeg',
+'js' => 'application/x-javascript',
+'midi' => 'audio/midi',
+'mid' => 'audio/midi',
+'mod' => 'audio/mod',
+'mov' => 'movie/quicktime',
+'mp3' => 'audio/mp3',
+'mpg' => 'video/mpeg',
+'mpeg' => 'video/mpeg',
+'pdf' => 'application/pdf',
+'png' => 'image/png',
+'swf' => 'application/shockwave-flash',
+'tif' => 'image/tiff',
+'tiff' => 'image/tiff',
+'wav' => 'audio/wav',
+'xbm' => 'image/xbm',
+'xml' => 'text/xml',
+);
+
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+
+$basename = basename(__FILE__);
+if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
+chdir(Extract_Phar::$temp);
+include $web;
+return;
+}
+$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
+if (!$pt || $pt == '/') {
+$pt = $web;
+header('HTTP/1.1 301 Moved Permanently');
+header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
+exit;
+}
+$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
+if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
+header('HTTP/1.0 404 Not Found');
+echo "\n \n File Not Found\n \n \n 404 - File ", $pt, " Not Found
\n \n";
+exit;
+}
+$b = pathinfo($a);
+if (!isset($b['extension'])) {
+header('Content-Type: text/plain');
+header('Content-Length: ' . filesize($a));
+readfile($a);
+exit;
+}
+if (isset($mimes[$b['extension']])) {
+if ($mimes[$b['extension']] === 1) {
+include $a;
+exit;
+}
+if ($mimes[$b['extension']] === 2) {
+highlight_file($a);
+exit;
+}
+header('Content-Type: ' .$mimes[$b['extension']]);
+header('Content-Length: ' . filesize($a));
+readfile($a);
+exit;
+}
+}
+
+class Extract_Phar
+{
+static $temp;
+static $origdir;
+const GZ = 0x1000;
+const BZ2 = 0x2000;
+const MASK = 0x3000;
+const START = 'my/custom/thingy.php';
+const LEN = 6696;
+
+static function go($return = false)
+{
+$fp = fopen(__FILE__, 'rb');
+fseek($fp, self::LEN);
+$L = unpack('V', $a = (binary)fread($fp, 4));
+$m = (binary)'';
+
+do {
+$read = 8192;
+if ($L[1] - strlen($m) < 8192) {
+$read = $L[1] - strlen($m);
+}
+$last = (binary)fread($fp, $read);
+$m .= $last;
+} while (strlen($last) && strlen($m) < $L[1]);
+
+if (strlen($m) < $L[1]) {
+die('ERROR: manifest length read was "' .
+strlen($m) .'" should be "' .
+$L[1] . '"');
+}
+
+$info = self::_unpack($m);
+$f = $info['c'];
+
+if ($f & self::GZ) {
+if (!function_exists('gzinflate')) {
+die('Error: zlib extension is not enabled -' .
+' gzinflate() function needed for zlib-compressed .phars');
+}
+}
+
+if ($f & self::BZ2) {
+if (!function_exists('bzdecompress')) {
+die('Error: bzip2 extension is not enabled -' .
+' bzdecompress() function needed for bz2-compressed .phars');
+}
+}
+
+$temp = self::tmpdir();
+
+if (!$temp || !is_writable($temp)) {
+$sessionpath = session_save_path();
+if (strpos ($sessionpath, ";") !== false)
+$sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1);
+if (!file_exists($sessionpath) || !is_dir($sessionpath)) {
+die('Could not locate temporary directory to extract phar');
+}
+$temp = $sessionpath;
+}
+
+$temp .= '/pharextract/'.basename(__FILE__, '.phar');
+self::$temp = $temp;
+self::$origdir = getcwd();
+@mkdir($temp, 0777, true);
+$temp = realpath($temp);
+
+if (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {
+self::_removeTmpFiles($temp, getcwd());
+@mkdir($temp, 0777, true);
+@file_put_contents($temp . '/' . md5_file(__FILE__), '');
+
+foreach ($info['m'] as $path => $file) {
+$a = !file_exists(dirname($temp . '/' . $path));
+@mkdir(dirname($temp . '/' . $path), 0777, true);
+clearstatcache();
+
+if ($path[strlen($path) - 1] == '/') {
+@mkdir($temp . '/' . $path, 0777);
+} else {
+file_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));
+@chmod($temp . '/' . $path, 0666);
+}
+}
+}
+
+chdir($temp);
+
+if (!$return) {
+include self::START;
+}
+}
+
+static function tmpdir()
+{
+if (strpos(PHP_OS, 'WIN') !== false) {
+if ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {
+return $var;
+}
+if (is_dir('/temp') || mkdir('/temp')) {
+return realpath('/temp');
+}
+return false;
+}
+if ($var = getenv('TMPDIR')) {
+return $var;
+}
+return realpath('/tmp');
+}
+
+static function _unpack($m)
+{
+$info = unpack('V', substr($m, 0, 4));
+ $l = unpack('V', substr($m, 10, 4));
+$m = substr($m, 14 + $l[1]);
+$s = unpack('V', substr($m, 0, 4));
+$o = 0;
+$start = 4 + $s[1];
+$ret['c'] = 0;
+
+for ($i = 0; $i < $info[1]; $i++) {
+ $len = unpack('V', substr($m, $start, 4));
+$start += 4;
+ $savepath = substr($m, $start, $len[1]);
+$start += $len[1];
+ $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));
+$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]
+& 0xffffffff);
+$ret['m'][$savepath][7] = $o;
+$o += $ret['m'][$savepath][2];
+$start += 24 + $ret['m'][$savepath][5];
+$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;
+}
+return $ret;
+}
+
+static function extractFile($path, $entry, $fp)
+{
+$data = '';
+$c = $entry[2];
+
+while ($c) {
+if ($c < 8192) {
+$data .= @fread($fp, $c);
+$c = 0;
+} else {
+$c -= 8192;
+$data .= @fread($fp, 8192);
+}
+}
+
+if ($entry[4] & self::GZ) {
+$data = gzinflate($data);
+} elseif ($entry[4] & self::BZ2) {
+$data = bzdecompress($data);
+}
+
+if (strlen($data) != $entry[0]) {
+die("Invalid internal .phar file (size error " . strlen($data) . " != " .
+$stat[7] . ")");
+}
+
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
+die("Invalid internal .phar file (checksum error)");
+}
+
+return $data;
+}
+
+static function _removeTmpFiles($temp, $origdir)
+{
+chdir($temp);
+
+foreach (glob('*') as $f) {
+if (file_exists($f)) {
+is_dir($f) ? @rmdir($f) : @unlink($f);
+if (file_exists($f) && is_dir($f)) {
+self::_removeTmpFiles($f, getcwd());
+}
+}
+}
+
+@rmdir($temp);
+clearstatcache();
+chdir($origdir);
+}
+}
+
+Extract_Phar::go();
+__HALT_COMPILER(); ?>"
+============================================================================
+============================================================================
+int(7074)
+============================================================================
+============================================================================
+Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
+============================================================================
+============================================================================
+============================================================================
+============================================================================
+string(6696) " 2,
+'c' => 'text/plain',
+'cc' => 'text/plain',
+'cpp' => 'text/plain',
+'c++' => 'text/plain',
+'dtd' => 'text/plain',
+'h' => 'text/plain',
+'log' => 'text/plain',
+'rng' => 'text/plain',
+'txt' => 'text/plain',
+'xsd' => 'text/plain',
+'php' => 1,
+'inc' => 1,
+'avi' => 'video/avi',
+'bmp' => 'image/bmp',
+'css' => 'text/css',
+'gif' => 'image/gif',
+'htm' => 'text/html',
+'html' => 'text/html',
+'htmls' => 'text/html',
+'ico' => 'image/x-ico',
+'jpe' => 'image/jpeg',
+'jpg' => 'image/jpeg',
+'jpeg' => 'image/jpeg',
+'js' => 'application/x-javascript',
+'midi' => 'audio/midi',
+'mid' => 'audio/midi',
+'mod' => 'audio/mod',
+'mov' => 'movie/quicktime',
+'mp3' => 'audio/mp3',
+'mpg' => 'video/mpeg',
+'mpeg' => 'video/mpeg',
+'pdf' => 'application/pdf',
+'png' => 'image/png',
+'swf' => 'application/shockwave-flash',
+'tif' => 'image/tiff',
+'tiff' => 'image/tiff',
+'wav' => 'audio/wav',
+'xbm' => 'image/xbm',
+'xml' => 'text/xml',
+);
+
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+
+$basename = basename(__FILE__);
+if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
+chdir(Extract_Phar::$temp);
+include $web;
+return;
+}
+$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
+if (!$pt || $pt == '/') {
+$pt = $web;
+header('HTTP/1.1 301 Moved Permanently');
+header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
+exit;
+}
+$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
+if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
+header('HTTP/1.0 404 Not Found');
+echo "\n \n File Not Found\n \n \n 404 - File ", $pt, " Not Found
\n \n";
+exit;
+}
+$b = pathinfo($a);
+if (!isset($b['extension'])) {
+header('Content-Type: text/plain');
+header('Content-Length: ' . filesize($a));
+readfile($a);
+exit;
+}
+if (isset($mimes[$b['extension']])) {
+if ($mimes[$b['extension']] === 1) {
+include $a;
+exit;
+}
+if ($mimes[$b['extension']] === 2) {
+highlight_file($a);
+exit;
+}
+header('Content-Type: ' .$mimes[$b['extension']]);
+header('Content-Length: ' . filesize($a));
+readfile($a);
+exit;
+}
+}
+
+class Extract_Phar
+{
+static $temp;
+static $origdir;
+const GZ = 0x1000;
+const BZ2 = 0x2000;
+const MASK = 0x3000;
+const START = 'my/custom/thingy.php';
+const LEN = 6698;
+
+static function go($return = false)
+{
+$fp = fopen(__FILE__, 'rb');
+fseek($fp, self::LEN);
+$L = unpack('V', $a = (binary)fread($fp, 4));
+$m = (binary)'';
+
+do {
+$read = 8192;
+if ($L[1] - strlen($m) < 8192) {
+$read = $L[1] - strlen($m);
+}
+$last = (binary)fread($fp, $read);
+$m .= $last;
+} while (strlen($last) && strlen($m) < $L[1]);
+
+if (strlen($m) < $L[1]) {
+die('ERROR: manifest length read was "' .
+strlen($m) .'" should be "' .
+$L[1] . '"');
+}
+
+$info = self::_unpack($m);
+$f = $info['c'];
+
+if ($f & self::GZ) {
+if (!function_exists('gzinflate')) {
+die('Error: zlib extension is not enabled -' .
+' gzinflate() function needed for zlib-compressed .phars');
+}
+}
+
+if ($f & self::BZ2) {
+if (!function_exists('bzdecompress')) {
+die('Error: bzip2 extension is not enabled -' .
+' bzdecompress() function needed for bz2-compressed .phars');
+}
+}
+
+$temp = self::tmpdir();
+
+if (!$temp || !is_writable($temp)) {
+$sessionpath = session_save_path();
+if (strpos ($sessionpath, ";") !== false)
+$sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1);
+if (!file_exists($sessionpath) || !is_dir($sessionpath)) {
+die('Could not locate temporary directory to extract phar');
+}
+$temp = $sessionpath;
+}
+
+$temp .= '/pharextract/'.basename(__FILE__, '.phar');
+self::$temp = $temp;
+self::$origdir = getcwd();
+@mkdir($temp, 0777, true);
+$temp = realpath($temp);
+
+if (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {
+self::_removeTmpFiles($temp, getcwd());
+@mkdir($temp, 0777, true);
+@file_put_contents($temp . '/' . md5_file(__FILE__), '');
+
+foreach ($info['m'] as $path => $file) {
+$a = !file_exists(dirname($temp . '/' . $path));
+@mkdir(dirname($temp . '/' . $path), 0777, true);
+clearstatcache();
+
+if ($path[strlen($path) - 1] == '/') {
+@mkdir($temp . '/' . $path, 0777);
+} else {
+file_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));
+@chmod($temp . '/' . $path, 0666);
+}
+}
+}
+
+chdir($temp);
+
+if (!$return) {
+include self::START;
+}
+}
+
+static function tmpdir()
+{
+if (strpos(PHP_OS, 'WIN') !== false) {
+if ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {
+return $var;
+}
+if (is_dir('/temp') || mkdir('/temp')) {
+return realpath('/temp');
+}
+return false;
+}
+if ($var = getenv('TMPDIR')) {
+return $var;
+}
+return realpath('/tmp');
+}
+
+static function _unpack($m)
+{
+$info = unpack('V', substr($m, 0, 4));
+ $l = unpack('V', substr($m, 10, 4));
+$m = substr($m, 14 + $l[1]);
+$s = unpack('V', substr($m, 0, 4));
+$o = 0;
+$start = 4 + $s[1];
+$ret['c'] = 0;
+
+for ($i = 0; $i < $info[1]; $i++) {
+ $len = unpack('V', substr($m, $start, 4));
+$start += 4;
+ $savepath = substr($m, $start, $len[1]);
+$start += $len[1];
+ $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));
+$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]
+& 0xffffffff);
+$ret['m'][$savepath][7] = $o;
+$o += $ret['m'][$savepath][2];
+$start += 24 + $ret['m'][$savepath][5];
+$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;
+}
+return $ret;
+}
+
+static function extractFile($path, $entry, $fp)
+{
+$data = '';
+$c = $entry[2];
+
+while ($c) {
+if ($c < 8192) {
+$data .= @fread($fp, $c);
+$c = 0;
+} else {
+$c -= 8192;
+$data .= @fread($fp, 8192);
+}
+}
+
+if ($entry[4] & self::GZ) {
+$data = gzinflate($data);
+} elseif ($entry[4] & self::BZ2) {
+$data = bzdecompress($data);
+}
+
+if (strlen($data) != $entry[0]) {
+die("Invalid internal .phar file (size error " . strlen($data) . " != " .
+$stat[7] . ")");
+}
+
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
+die("Invalid internal .phar file (checksum error)");
+}
+
+return $data;
+}
+
+static function _removeTmpFiles($temp, $origdir)
+{
+chdir($temp);
+
+foreach (glob('*') as $f) {
+if (file_exists($f)) {
+is_dir($f) ? @rmdir($f) : @unlink($f);
+if (file_exists($f) && is_dir($f)) {
+self::_removeTmpFiles($f, getcwd());
+}
+}
+}
+
+@rmdir($temp);
+clearstatcache();
+chdir($origdir);
+}
+}
+
+Extract_Phar::go();
+__HALT_COMPILER(); ?>"
+============================================================================
+============================================================================
+int(7074)
+Illegal web filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/withphar.php b/hphp/test/zend/bad/ext-phar/withphar.php
new file mode 100644
index 000000000..1d2027568
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/withphar.php
@@ -0,0 +1,4 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/bad/ext-phar/withphar.php.expectf b/hphp/test/zend/bad/ext-phar/withphar.php.expectf
new file mode 100644
index 000000000..c61dd04ea
--- /dev/null
+++ b/hphp/test/zend/bad/ext-phar/withphar.php.expectf
@@ -0,0 +1,4 @@
+in b
+getMessage();
+}
+?>
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-phar/004.php.expectf b/hphp/test/zend/good/ext-phar/004.php.expectf
new file mode 100644
index 000000000..838004d31
--- /dev/null
+++ b/hphp/test/zend/good/ext-phar/004.php.expectf
@@ -0,0 +1 @@
+__HALT_COMPILER(); must be declared in a phar
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-phar/phar_get_supportedcomp4.php b/hphp/test/zend/good/ext-phar/phar_get_supportedcomp4.php
new file mode 100644
index 000000000..1013995df
--- /dev/null
+++ b/hphp/test/zend/good/ext-phar/phar_get_supportedcomp4.php
@@ -0,0 +1,4 @@
+
+===DONE===
\ No newline at end of file
diff --git a/hphp/test/zend/good/ext-phar/phar_get_supportedcomp4.php.expectf b/hphp/test/zend/good/ext-phar/phar_get_supportedcomp4.php.expectf
new file mode 100644
index 000000000..de29593a1
--- /dev/null
+++ b/hphp/test/zend/good/ext-phar/phar_get_supportedcomp4.php.expectf
@@ -0,0 +1,3 @@
+array(0) {
+}
+===DONE===
\ No newline at end of file
diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py
index 2b933fc64..c87a93ea2 100755
--- a/hphp/tools/import_zend_test.py
+++ b/hphp/tools/import_zend_test.py
@@ -110,7 +110,6 @@ no_import = (
'/ext/pdo_oci',
'/ext/pdo_odbc',
'/ext/pdo_pgsql',
- '/ext/phar',
'/ext/pspell',
'/ext/readline',
'/ext/recode',
@@ -144,9 +143,6 @@ bad_tests = (
'/zend/unset_cv05.php',
'/zend/unset_cv06.php',
- # not implemented extensions
- 'phar', # this appears in filenames
-
# works in interp but not others
'/tests-lang/bug25922.php',
'/zend/bug34064.php',