cvs: pear /HTTP_Request Request.php

From: Date: Thu, 03 Oct 2002 13:38:05 +0000
Subject: cvs: pear /HTTP_Request Request.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-6835@lists.php.net to get a copy of this message
richard Thu Oct 3 09:38:05 2002 EDT Modified files: /pear/HTTP_Request Request.php Log: Added (slightly modified) patch from Alexey Borzov Index: pear/HTTP_Request/Request.php diff -u pear/HTTP_Request/Request.php:1.18 pear/HTTP_Request/Request.php:1.19 --- pear/HTTP_Request/Request.php:1.18 Sun Sep 29 10:47:30 2002 +++ pear/HTTP_Request/Request.php Thu Oct 3 09:38:04 2002 @@ -32,7 +32,7 @@ // | Author: Richard Heyes <richard@phpguru.org> | // +-----------------------------------------------------------------------+ // -// $Id: Request.php,v 1.18 2002/09/29 14:47:30 richard Exp $ +// $Id: Request.php,v 1.19 2002/10/03 13:38:04 richard Exp $ // // HTTP_Request Class // @@ -315,7 +315,11 @@ */ function addPostData($name, $value, $preencoded = false) { - $this->_postData[$name] = $preencoded ? $value : urlencode($value); + if ($preencoded) { + $this->_postData[$name] = $value; + } else { + $this->_postData[$name] = is_array($value)? array_map('urlencode', $value): urlencode($value); + } } /** @@ -439,8 +443,15 @@ // Post data if it's an array if (!empty($this->_postData) AND is_array($this->_postData)) { foreach($this->_postData as $name => $value) { - $postdata[] = $name . '=' . $value; + if (is_array($value)) { + foreach ($value as $k => $v) { + $postdata[] = sprintf('%s[%s]=%s', $name, $k, $v); + } + } else { + $postdata[] = $name . '=' . $value; + } } + $postdata = implode('&', $postdata); $request .= 'Content-Length: ' . strlen($postdata) . "\r\n\r\n"; $request .= $postdata;

« previous php.pear.cvs (#6835) next »