From: Greg Beaver Date: Mon, 21 Apr 2008 17:59:28 +0000 (+0000) Subject: fix discovery of files hidden in a URL - makes using any regular front controller... X-Git-Tag: RELEASE_2_0_0b1~278 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25cdc7de2b09b4396286fb5f656347ec92da2c19;p=php fix discovery of files hidden in a URL - makes using any regular front controller possible --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index a3af3695d4..e50092b195 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -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); diff --git a/ext/phar/tests/files/frontcontroller8.phar b/ext/phar/tests/files/frontcontroller8.phar index a53bfe8996..bd1070fc4f 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 84f12ce8d9..243da136c1 100644 --- a/ext/phar/tests/files/frontcontroller8.phar.inc +++ b/ext/phar/tests/files/frontcontroller8.phar.inc @@ -2,6 +2,7 @@ @unlink(dirname(__FILE__) . '/frontcontroller8.phar'); $a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar'); $a['a.phps'] = 'hio1'; +$a['a1.phps'] = ' +--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" \ No newline at end of file