diff --git a/src/Wikipedia/Api.php b/src/Wikipedia/Api.php index 7c459cd..a3fe301 100644 --- a/src/Wikipedia/Api.php +++ b/src/Wikipedia/Api.php @@ -476,10 +476,6 @@ public function edit( } $x = $this->http->post($this->apiurl, $params); - if ($this->logger !== null) { - $this->logger->addDebug($x); - } - $x = $this->http->unserialize($x); if ($x['edit']['result'] == 'Success') { @@ -523,7 +519,7 @@ public function gettoken($title) public function getLoginToken() { $x = $this->http->get($this->apiurl . '?rawcontinue=1&format=php' . - '?action=query&meta=tokens&type=login'); + '&meta=tokens&type=login'); $x = $this->http->unserialize($x); return $x['query']['tokens']['logintoken']; @@ -547,10 +543,6 @@ public function login($user, $pass) 'lgtoken' => $this->getLoginToken()) ); - if ($this->logger !== null) { - $this->logger->addDebug($x); - } - $x = $this->http->unserialize($x); return $x['login']['result'] == 'Success'; @@ -584,11 +576,6 @@ public function move($old, $new, $reason, $checkrun = true) ); $x = $this->http->post($this->apiurl, $params); - - if ($this->logger !== null) { - $this->logger->addDebug($x); - } - $this->http->unserialize($x); // this emits warnings if needed } diff --git a/src/Wikipedia/Http.php b/src/Wikipedia/Http.php index 0409dac..286a6d5 100644 --- a/src/Wikipedia/Http.php +++ b/src/Wikipedia/Http.php @@ -136,6 +136,10 @@ public function get($url) **/ public function unserialize($response) { + if ($this->logger !== null) { + $this->logger->addDebug('Decoding response: ' . $response); + } + $response = unserialize($response); if ($this->logger !== null) {