From: Greg Beaver Date: Mon, 21 Apr 2008 17:46:24 +0000 (+0000) Subject: new test for custom 404 handler, fix segfault found by test X-Git-Tag: RELEASE_2_0_0b1~279 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f56c7f3435f9df8fb44c41b5284383558d84b8b;p=php new test for custom 404 handler, fix segfault found by test --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index acfa4903be..a3af3695d4 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -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); } /* }}} */ diff --git a/ext/phar/tests/files/frontcontroller8.phar b/ext/phar/tests/files/frontcontroller8.phar index 213fe35d4d..a53bfe8996 100644 Binary files a/ext/phar/tests/files/frontcontroller8.phar and b/ext/phar/tests/files/frontcontroller8.phar differ diff --git a/ext/phar/tests/files/frontcontroller8.phar.inc b/ext/phar/tests/files/frontcontroller8.phar.inc index ccedb46e34..84f12ce8d9 100644 --- a/ext/phar/tests/files/frontcontroller8.phar.inc +++ b/ext/phar/tests/files/frontcontroller8.phar.inc @@ -5,8 +5,9 @@ $a['a.phps'] = 'hio1'; $a['a.jpg'] = 'hio2'; $a['a.php'] = 'setStub(' "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();'); diff --git a/ext/phar/tests/files/frontcontroller9.phar b/ext/phar/tests/files/frontcontroller9.phar index d84b11b875..39ca28c96c 100644 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 index 0000000000..dca5a693cd --- /dev/null +++ b/ext/phar/tests/frontcontroller24.phpt @@ -0,0 +1,14 @@ +--TEST-- +Phar front controller with custom 404 php script +--SKIPIF-- + +--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