]> granicus.if.org Git - php/commitdiff
new test
authorGreg Beaver <cellog@php.net>
Sat, 5 Jan 2008 05:12:44 +0000 (05:12 +0000)
committerGreg Beaver <cellog@php.net>
Sat, 5 Jan 2008 05:12:44 +0000 (05:12 +0000)
ext/phar/phar_object.c
ext/phar/tests/frontcontroller10.phpt [new file with mode: 0644]
ext/phar/tests/frontcontroller3.phar
ext/phar/tests/frontcontroller4.phar [new file with mode: 0644]
ext/phar/tests/frontcontroller4.phar.inc [new file with mode: 0644]

index 156145f84dac0663dfbbb6b1cc3bbd885c5f7065..4532e6a1d53bcb390434f95b1631620ea0ba8321 100755 (executable)
@@ -477,6 +477,7 @@ PHP_METHOD(Phar, webPhar)
                if (SUCCESS == zend_hash_find(Z_ARRVAL_P(rewrites), entry, entry_len+1, (void **) &fd_ptr)) {
                        if (IS_STRING != Z_TYPE_PP(fd_ptr)) {
                                zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "phar rewrite value for \"%s\" was not a string", entry);
+                               return;
                        }
                        if (entry != index_php) {
                                efree(entry);
diff --git a/ext/phar/tests/frontcontroller10.phpt b/ext/phar/tests/frontcontroller10.phpt
new file mode 100644 (file)
index 0000000..a0c53af
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Phar front controller rewrite array invalid
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--ENV--
+SCRIPT_NAME=/frontcontroller10.php/hi
+REQUEST_URI=/frontcontroller10.php/hi
+--FILE_EXTERNAL--
+frontcontroller4.phar
+--EXPECTHEADERS--
+Content-type: text/html
+--EXPECTF--
+Fatal error: Uncaught exception 'UnexpectedValueException' with message 'phar rewrite value for "/hi" was not a string' in %sfrontcontroller10.php:2
+Stack trace:
+#0 %sfrontcontroller10.php(2): Phar::webPhar('whatever', 'index.php', '', Array, Array)
+#1 {main}
+  thrown in %sfrontcontroller10.php on line 2
\ No newline at end of file
index 41c43d9da5b87a965bbae9d067149b90a81cd94b..69908c02ab0d0ac55527f85d5de401b9e2c1e402 100644 (file)
Binary files a/ext/phar/tests/frontcontroller3.phar and b/ext/phar/tests/frontcontroller3.phar differ
diff --git a/ext/phar/tests/frontcontroller4.phar b/ext/phar/tests/frontcontroller4.phar
new file mode 100644 (file)
index 0000000..3460526
Binary files /dev/null and b/ext/phar/tests/frontcontroller4.phar differ
diff --git a/ext/phar/tests/frontcontroller4.phar.inc b/ext/phar/tests/frontcontroller4.phar.inc
new file mode 100644 (file)
index 0000000..5d9728c
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+@unlink(dirname(__FILE__) . '/frontcontroller4.phar');
+$a = new Phar(dirname(__FILE__) . '/frontcontroller4.phar');
+$a['a.php'] = 'hio';
+$a['a.jpg'] = 'hio';
+$a['a.phps'] = '<?php function hio(){}';
+$a->setStub('<?php
+Phar::webPhar("whatever", "index.php", null, array(), array("/hi" => true));
+echo "oops did not run\n";
+var_dump($_ENV, $_SERVER);
+__HALT_COMPILER();');
+?>