From 1a40d615b3b68e07480fd5d86e4e65c160bd2d64 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 1 Apr 2008 00:10:16 +0200 Subject: fixed bug in HTTPClient breaking GET requests on certain servers The change of a parameter default made the HTTP client send data after sending the headers for a GET request. darcs-hash:20080331221016-7ad00-a46165b1ded7155a6482398c6bdf721a4eb37507.gz --- inc/HTTPClient.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'inc') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index d40a7b4db..e263989a4 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -148,13 +148,13 @@ class HTTPClient { * sent as is. You will need to setup your own Content-Type header then. * * @param string $url - the complete URL - * @param mixed $data - the post data + * @param mixed $data - the post data either as array or raw data * @param string $method - HTTP Method usually GET or POST. * @return bool - true on success * @author Andreas Goetz * @author Andreas Gohr */ - function sendRequest($url,$data=array(),$method='GET'){ + function sendRequest($url,$data='',$method='GET'){ $this->start = $this->_time(); $this->error = ''; $this->status = 0; @@ -371,14 +371,16 @@ class HTTPClient { * * @author Andreas Gohr */ - function _debug($info,$var){ + function _debug($info,$var=null){ if(!$this->debug) return; print ''.$info.' '.($this->_time() - $this->start).'s
'; - ob_start(); - print_r($var); - $content = htmlspecialchars(ob_get_contents()); - ob_end_clean(); - print '
'.$content.'
'; + if(!is_null($var)){ + ob_start(); + print_r($var); + $content = htmlspecialchars(ob_get_contents()); + ob_end_clean(); + print '
'.$content.'
'; + } } /** -- cgit v1.2.3