From: Greg Beaver Date: Sat, 5 Jan 2008 03:41:43 +0000 (+0000) Subject: fix front controller tests (requires patch to run-tests.php posted to internals a... X-Git-Tag: RELEASE_2_0_0a1~1029 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=653dc9e8cec8c6aeed481a0271cd4cb4819cbc63;p=php fix front controller tests (requires patch to run-tests.php posted to internals a little while ago) allow phars to have extension .php as last resort fix phar-based phars for MIME_OTHER type --- diff --git a/ext/phar/phar.c b/ext/phar/phar.c index f3f7396e28..5c9e95be20 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1990,6 +1990,9 @@ int phar_detect_phar_fname_ext(const char *filename, int check_length, char **ex } else if ((pos_p = strstr(filename, ".phar")) != NULL) { *ext_str = pos_p; *ext_len = 5; + } else if ((pos_p = strstr(filename, ".php")) != NULL) { + *ext_str = pos_p; + *ext_len = 4; } else { /* We have an alias with no extension, so locate the first / and fail */ *ext_str = strstr(filename, "/"); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 0bc123c435..487f01c3b5 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -222,6 +222,9 @@ static int phar_file_action(phar_entry_data *phar, char *mime_type, int code, ch phar->fp = phar->internal_file->fp; if (phar->internal_file->fp == phar->phar->fp) { phar->zero = phar->internal_file->offset_within_phar; + if (!phar->is_tar && !phar->is_zip) { + phar->zero += phar->phar->internal_file_start; + } } } php_stream_seek(phar->fp, phar->zero, SEEK_SET); diff --git a/ext/phar/tests/frontcontroller.phar b/ext/phar/tests/frontcontroller.phar new file mode 100644 index 0000000000..8790f7bc5b Binary files /dev/null and b/ext/phar/tests/frontcontroller.phar differ diff --git a/ext/phar/tests/frontcontroller.phar.inc b/ext/phar/tests/frontcontroller.phar.inc new file mode 100644 index 0000000000..989909751e --- /dev/null +++ b/ext/phar/tests/frontcontroller.phar.inc @@ -0,0 +1,12 @@ +setStub(' diff --git a/ext/phar/tests/frontcontroller1.phpt b/ext/phar/tests/frontcontroller1.phpt index 0cff6e6f3d..ebe5c35b5b 100644 --- a/ext/phar/tests/frontcontroller1.phpt +++ b/ext/phar/tests/frontcontroller1.phpt @@ -2,32 +2,11 @@ Phar front controller --SKIPIF-- ---INI-- -phar.require_hash=0 -phar.readonly=0 --ENV-- -REQUEST_URI=/frontcontroller1.phar.php/a.jpg ---FILE-- -setStub(' -===DONE=== ---CLEAN-- - +SCRIPT_NAME=/frontcontroller1.php/a.jpg +REQUEST_URI=/frontcontroller1.php/a.jpg +--FILE_EXTERNAL-- +frontcontroller.phar --EXPECTHEADERS-- Content-type: image/jpeg Content-length: 3 diff --git a/ext/phar/tests/frontcontroller2.phpt b/ext/phar/tests/frontcontroller2.phpt index d1449a2f49..69573f95d3 100644 --- a/ext/phar/tests/frontcontroller2.phpt +++ b/ext/phar/tests/frontcontroller2.phpt @@ -1,31 +1,12 @@ --TEST-- -Phar front controller php +Phar front controller PHP test --SKIPIF-- ---INI-- -phar.require_hash=0 -phar.readonly=0 ---FILE-- -setStub(' -===DONE=== ---CLEAN-- - +--ENV-- +SCRIPT_NAME=/frontcontroller2.php/a.php +REQUEST_URI=/frontcontroller2.php/a.php +--FILE_EXTERNAL-- +frontcontroller.phar --EXPECTHEADERS-- Content-type: text/html --EXPECT-- diff --git a/ext/phar/tests/frontcontroller3.phpt b/ext/phar/tests/frontcontroller3.phpt index 99bba11660..932dd0d8c0 100644 --- a/ext/phar/tests/frontcontroller3.phpt +++ b/ext/phar/tests/frontcontroller3.phpt @@ -2,30 +2,11 @@ Phar front controller phps --SKIPIF-- ---INI-- -phar.require_hash=0 -phar.readonly=0 ---FILE-- -setStub(' -===DONE=== ---CLEAN-- - +--ENV-- +SCRIPT_NAME=/frontcontroller3.php/a.phps +REQUEST_URI=/frontcontroller3.php/a.phps +--FILE_EXTERNAL-- +frontcontroller.phar --EXPECTHEADERS-- Content-type: text/html --EXPECT--