diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index a3af3695d4d..e50092b1956 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 a53bfe89963..bd1070fc4fe 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 84f12ce8d9a..243da136c19 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