From 6997bb1b8e2c4a736b66cee126e58c047f94d459 Mon Sep 17 00:00:00 2001 From: joyqi Date: Mon, 16 Dec 2013 09:39:08 +0800 Subject: [PATCH] fixed issue #129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据实验,在某些web服务器上,对`urlencode`也就是RFC 3986的标准解释不同,它们将unicode字符转义为以百分号开头的小写字符,而php中则默认为大写字符。比如“你好”在php中被转义为`%E4%BD%A0%E5%A5%BD`而在某些服务器上被转义为`%e4%bd%a0%e5%a5%bd`。 这导致`Widget_Archive`中的`checkPermalink`函数将它们识别为不同的路径,从而循环重定向。 解决方法:在`checkPermalink`函数中直接比较`urldecode`以后的`path` --- var/Widget/Archive.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php index 508ecf89..9c98d100 100644 --- a/var/Widget/Archive.php +++ b/var/Widget/Archive.php @@ -621,7 +621,7 @@ class Widget_Archive extends Widget_Abstract_Contents $src = parse_url($permalink); $target = parse_url($requestUrl); - if ($src['host'] != $target['host'] || $src['path'] != $target['path']) { + if ($src['host'] != $target['host'] || urldecode($src['path']) != urldecode($target['path'])) { $this->response->redirect($permalink, true); } }