new test for invalid rewrite callback

This commit is contained in:
Greg Beaver 2008-04-23 16:47:12 +00:00
parent 50835e4bb7
commit ce5732112e
4 changed files with 29 additions and 1 deletions

View file

@ -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);

Binary file not shown.

View file

@ -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();');
?>

View file

@ -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