]> granicus.if.org Git - php/commitdiff
new test for invalid rewrite callback
authorGreg Beaver <cellog@php.net>
Wed, 23 Apr 2008 16:47:12 +0000 (16:47 +0000)
committerGreg Beaver <cellog@php.net>
Wed, 23 Apr 2008 16:47:12 +0000 (16:47 +0000)
ext/phar/phar_object.c
ext/phar/tests/files/frontcontroller16.phar [new file with mode: 0644]
ext/phar/tests/files/frontcontroller16.phar.inc [new file with mode: 0644]
ext/phar/tests/frontcontroller31.phpt [new file with mode: 0644]

index 8df06f3f5646be679ae2c99a6d04976cd1750781..35b8cbd53e982987d037ca34bbf2f6d0421c51c2 100755 (executable)
@@ -560,7 +560,6 @@ PHP_METHOD(Phar, webPhar)
        if (!(SG(request_info).request_method && SG(request_info).request_uri && (!strcmp(SG(request_info).request_method, "GET") || !strcmp(SG(request_info).request_method, "POST")))) {
                return;
        }
-
 #ifdef PHP_WIN32
        fname = estrndup(fname, fname_len);
        phar_unixify_path_separators(fname, fname_len);
diff --git a/ext/phar/tests/files/frontcontroller16.phar b/ext/phar/tests/files/frontcontroller16.phar
new file mode 100644 (file)
index 0000000..66fc145
Binary files /dev/null and b/ext/phar/tests/files/frontcontroller16.phar differ
diff --git a/ext/phar/tests/files/frontcontroller16.phar.inc b/ext/phar/tests/files/frontcontroller16.phar.inc
new file mode 100644 (file)
index 0000000..3c9986d
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+@unlink(dirname(__FILE__) . '/frontcontroller16.phar');
+$a = new Phar(dirname(__FILE__) . '/frontcontroller16.phar');
+$a['index.php'] = '<?php
+echo "hi";
+';
+$a->setStub('<?php
+try {
+Phar::webPhar("test.phar", "/index.php", null, array(), array("fail", "here"));
+} catch (Exception $e) {
+die($e->getMessage() . "\n");
+}
+echo "oops did not run\n";
+var_dump($_ENV, $_SERVER);
+__HALT_COMPILER();');
+?>
diff --git a/ext/phar/tests/frontcontroller31.phpt b/ext/phar/tests/frontcontroller31.phpt
new file mode 100644 (file)
index 0000000..6ec7ca1
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Phar front controller with invalid callback for rewrites
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--ENV--
+SCRIPT_NAME=/frontcontroller31.php
+REQUEST_URI=/frontcontroller31.php
+--EXPECTHEADERS--
+Content-type: text/html
+--FILE_EXTERNAL--
+files/frontcontroller16.phar
+--EXPECT--
+phar error: invalid rewrite callback
\ No newline at end of file