From 48090d9d2faa0f3bb5a18c9e50000bacf19fb758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E5=AE=81?= Date: Wed, 14 May 2014 14:26:41 +0800 Subject: [PATCH] close #238 fix query builder --- var/Typecho/Http/Client/Adapter.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/var/Typecho/Http/Client/Adapter.php b/var/Typecho/Http/Client/Adapter.php index 7923b32f..7f8fa2c9 100644 --- a/var/Typecho/Http/Client/Adapter.php +++ b/var/Typecho/Http/Client/Adapter.php @@ -311,11 +311,14 @@ abstract class Typecho_Http_Client_Adapter $this->path = $params['path']; } - if (!empty($params['query'])) { - $this->path .= '?' . $params['query'] . (empty($this->query) ? NULL : '&' . $this->query); - $url .= (empty($this->query) ? NULL : '&' . $this->query); - } else { - $url .= (empty($this->query) ? NULL : '?' . $this->query); + $query = empty($params['query']) ? '' : $params['query']; + + if (!empty($this->query)) { + $query = empty($query) ? $this->query : '&' . $this->query; + } + + if (!empty($query)) { + $this->path .= '?' . $query; } $this->scheme = $params['scheme'];