]> granicus.if.org Git - php/commitdiff
new test for webPhar with phar.extract_list
authorGreg Beaver <cellog@php.net>
Wed, 23 Apr 2008 16:00:06 +0000 (16:00 +0000)
committerGreg Beaver <cellog@php.net>
Wed, 23 Apr 2008 16:00:06 +0000 (16:00 +0000)
ext/phar/phar_object.c
ext/phar/tests/webphar_plainmap.phpt [new file with mode: 0644]

index 62a469816750be3aac7461c28dda735bbc1bbbb0..8df06f3f5646be679ae2c99a6d04976cd1750781 100755 (executable)
@@ -371,6 +371,9 @@ nofile:
 }
 /* }}} */
 
+/* post-process REQUEST_URI and retrieve the actual request URI.  This is for
+   cases like http://localhost/blah.phar/path/to/file.php/extra/stuff
+   which calls "blah.phar" file "path/to/file.php" with PATH_INFO "/extra/stuff" */
 static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, int *entry_len, char **ru, int *ru_len TSRMLS_DC) /* {{{ */
 {
        char *e = *entry + 1, *u = NULL, *u1 = NULL, *saveu = NULL;
diff --git a/ext/phar/tests/webphar_plainmap.phpt b/ext/phar/tests/webphar_plainmap.phpt
new file mode 100644 (file)
index 0000000..ba14c92
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Phar: Phar::webPhar with phar.extract_list
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip");?>
+--INI--
+phar.readonly=1
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.plain.php';
+
+file_put_contents($fname, '<?php Phar::webPhar("myphar.phar", "index.php");');
+ini_set('phar.extract_list', 'myphar.phar=' . dirname(__FILE__));
+
+try {
+include 'phar://myphar.phar/' . basename($fname);
+} catch (Exception $e) {
+echo $e->getMessage() . "\n";
+}
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.plain.php');
+?>
+--EXPECT--
+Cannot use Phar::webPhar() from an extracted phar archive, simply use the extracted files directly
\ No newline at end of file