]> granicus.if.org Git - php/commitdiff
new test for custom 404 handler, fix segfault found by test
authorGreg Beaver <cellog@php.net>
Mon, 21 Apr 2008 17:46:24 +0000 (17:46 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 21 Apr 2008 17:46:24 +0000 (17:46 +0000)
ext/phar/phar_object.c
ext/phar/tests/files/frontcontroller8.phar
ext/phar/tests/files/frontcontroller8.phar.inc
ext/phar/tests/files/frontcontroller9.phar
ext/phar/tests/frontcontroller24.phpt [new file with mode: 0644]

index acfa4903bea697aef6536e248b499f65260b6c81..a3af3695d4d7e217c19b6b4e24e4ad0589e52f42 100755 (executable)
@@ -419,6 +419,12 @@ static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, in
                u[0] = '\0';
                u_len = strlen(u + 1);
                e_len -= u_len + 1;
+               if (e_len < 0) {
+                       if (saveu) {
+                               saveu[0] = '/';
+                       }
+                       return;
+               }
        } while (1);
 }
 /* }}} */
index 213fe35d4da795b6c3427d6c299b29f58b5e8cc5..a53bfe899634d7244ed7cd6b2e90371ece2e35e9 100644 (file)
Binary files a/ext/phar/tests/files/frontcontroller8.phar and b/ext/phar/tests/files/frontcontroller8.phar differ
index ccedb46e347729f1a90efe8747114e5e898c4c63..84f12ce8d9a6ca6b6af602a3d81fdae79eca66cf 100644 (file)
@@ -5,8 +5,9 @@ $a['a.phps'] = 'hio1';
 $a['a.jpg'] = 'hio2';
 $a['a.php'] = '<?php function hio(){}';
 $a['fronk.gronk'] = 'hio3';
+$a['404.php'] = 'My 404 is rawesome';
 $a->setStub('<?php
-Phar::webPhar("whatever", "index.php", null, array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS));
+Phar::webPhar("whatever", "index.php", "404.php", array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS));
 echo "oops did not run\n";
 var_dump($_ENV, $_SERVER);
 __HALT_COMPILER();');
index d84b11b87504bf9c4973c1135c72f203ef14d403..39ca28c96cfaec73cc9f195aece427d0228305fb 100644 (file)
Binary files a/ext/phar/tests/files/frontcontroller9.phar and b/ext/phar/tests/files/frontcontroller9.phar differ
diff --git a/ext/phar/tests/frontcontroller24.phpt b/ext/phar/tests/frontcontroller24.phpt
new file mode 100644 (file)
index 0000000..dca5a69
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Phar front controller with custom 404 php script
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--ENV--
+SCRIPT_NAME=/frontcontroller24.php
+REQUEST_URI=/frontcontroller24.php/unknown/file
+PATH_INFO=/unknown/file
+--FILE_EXTERNAL--
+files/frontcontroller8.phar
+--EXPECTHEADERS--
+Content-type: text/html
+--EXPECTF--
+My 404 is rawesome
\ No newline at end of file