mirror of
https://github.com/php/php-src.git
synced 2024-12-14 20:33:36 +08:00
fix discovery of files hidden in a URL - makes using any regular front controller possible
This commit is contained in:
parent
2f56c7f343
commit
25cdc7de2b
@ -384,7 +384,7 @@ nofile:
|
||||
|
||||
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, *saveu = NULL;
|
||||
char *e = *entry + 1, *u = NULL, *u1 = NULL, *saveu = NULL;
|
||||
int e_len = *entry_len - 1, u_len = 0;
|
||||
phar_archive_data **pphar;
|
||||
|
||||
@ -406,15 +406,22 @@ static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, in
|
||||
return;
|
||||
}
|
||||
if (u) {
|
||||
u1 = strrchr(e, '/');
|
||||
u[0] = '/';
|
||||
saveu = u;
|
||||
}
|
||||
u = strrchr(e, '/');
|
||||
if (!u) {
|
||||
if (saveu) {
|
||||
saveu[0] = '/';
|
||||
e_len += u_len + 1;
|
||||
u = u1;
|
||||
if (!u) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
u = strrchr(e, '/');
|
||||
if (!u) {
|
||||
if (saveu) {
|
||||
saveu[0] = '/';
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
u[0] = '\0';
|
||||
u_len = strlen(u + 1);
|
||||
|
Binary file not shown.
@ -2,6 +2,7 @@
|
||||
@unlink(dirname(__FILE__) . '/frontcontroller8.phar');
|
||||
$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar');
|
||||
$a['a.phps'] = 'hio1';
|
||||
$a['a1.phps'] = '<?php var_dump($_SERVER["REQUEST_URI"]);';
|
||||
$a['a.jpg'] = 'hio2';
|
||||
$a['a.php'] = '<?php function hio(){}';
|
||||
$a['fronk.gronk'] = 'hio3';
|
||||
|
14
ext/phar/tests/frontcontroller25.phpt
Normal file
14
ext/phar/tests/frontcontroller25.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Phar front controller with extra path_info
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--ENV--
|
||||
SCRIPT_NAME=/frontcontroller25.php
|
||||
REQUEST_URI=/frontcontroller25.php/a1.phps/extra/stuff
|
||||
PATH_INFO=/a1.phps/extra/stuff
|
||||
--FILE_EXTERNAL--
|
||||
files/frontcontroller8.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html
|
||||
--EXPECTF--
|
||||
string(42) "/frontcontroller25.php/a1.phps/extra/stuff"
|
Loading…
Reference in New Issue
Block a user