Index: branches/version-2_11-dev/html/user_data/packages/default/css/bloc.css
===================================================================
--- branches/version-2_11-dev/html/user_data/packages/default/css/bloc.css	(revision 21317)
+++ branches/version-2_11-dev/html/user_data/packages/default/css/bloc.css	(revision 21410)
@@ -14,5 +14,5 @@
 -新着情報
 -現在のカゴの中
--カテゴリ
+-カテゴリー
 -ガイドリンク
 -ログイン（サイド用）
@@ -179,5 +179,5 @@
 
 /* ===============================================
-▼カテゴリ
+▼カテゴリー
 =============================================== */
 #category_area .bloc_body{
Index: branches/version-2_11-dev/data/Smarty/templates/default/frontparts/bloc/category.tpl
===================================================================
--- branches/version-2_11-dev/data/Smarty/templates/default/frontparts/bloc/category.tpl	(revision 21317)
+++ branches/version-2_11-dev/data/Smarty/templates/default/frontparts/bloc/category.tpl	(revision 21410)
@@ -29,5 +29,5 @@
     <div id="category_area">
         <div class="bloc_body">
-            <h2><img src="<!--{$TPL_URLPATH}-->img/title/tit_bloc_category.gif" alt="商品カテゴリ" /></h2>
+            <h2><img src="<!--{$TPL_URLPATH}-->img/title/tit_bloc_category.gif" alt="商品カテゴリー" /></h2>
             <!--{strip}-->
                 <ul id="categorytree">
Index: branches/version-2_11-dev/data/Smarty/templates/mobile/frontparts/bloc/category.tpl
===================================================================
--- branches/version-2_11-dev/data/Smarty/templates/mobile/frontparts/bloc/category.tpl	(revision 21317)
+++ branches/version-2_11-dev/data/Smarty/templates/mobile/frontparts/bloc/category.tpl	(revision 21410)
@@ -22,5 +22,5 @@
  */
 *}-->
-<!--▼商品カテゴリここから-->
+<!--▼商品カテゴリーここから-->
 <!--{1|numeric_emoji}-->商品カテゴリ<br>
 <!--{section name=cnt loop=$arrCat}-->
@@ -33,3 +33,3 @@
 　<font color="<!--{cycle values="#000000,#880000,#8888ff,#88ff88,#ff0000"}-->">■</font><a href="<!--{$path}-->?category_id=<!--{$arrCat[cnt].category_id}-->"><!--{$disp_name|sfCutString:10:false|h}--></a><br>
 <!--{/section}-->
-<!--▲商品カテゴリここまで-->
+<!--▲商品カテゴリーここまで-->
Index: branches/version-2_11-dev/data/Smarty/templates/admin/products/subnavi.tpl
===================================================================
--- branches/version-2_11-dev/data/Smarty/templates/admin/products/subnavi.tpl	(revision 21317)
+++ branches/version-2_11-dev/data/Smarty/templates/admin/products/subnavi.tpl	(revision 21410)
@@ -29,6 +29,6 @@
 <li<!--{if $tpl_subno == 'class'}--> class="on"<!--{/if}--> id="navi-products-class"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/class.php"><span>規格管理</span></a></li>
 <!--{/if}-->
-<li<!--{if $tpl_subno == 'category'}--> class="on"<!--{/if}--> id="navi-products-category"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/category.php"><span>カテゴリ登録</span></a></li>
-<li<!--{if $tpl_subno == 'upload_csv_category'}--> class="on"<!--{/if}--> id="navi-products-upload-csv-category"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/upload_csv_category.php"><span>カテゴリ登録CSV</span></a></li>
+<li<!--{if $tpl_subno == 'category'}--> class="on"<!--{/if}--> id="navi-products-category"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/category.php"><span>カテゴリー登録</span></a></li>
+<li<!--{if $tpl_subno == 'upload_csv_category'}--> class="on"<!--{/if}--> id="navi-products-upload-csv-category"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/upload_csv_category.php"><span>カテゴリー登録CSV</span></a></li>
 <li<!--{if $tpl_subno == 'maker'}--> class="on"<!--{/if}--> id="navi-products-maker"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/maker.php"><span>メーカー登録</span></a></li>
 <li<!--{if $tpl_subno == 'product_rank'}--> class="on"<!--{/if}--> id="navi-products-rank"><a href="<!--{$smarty.const.ROOT_URLPATH}--><!--{$smarty.const.ADMIN_DIR}-->products/product_rank.php"><span>商品並び替え</span></a></li>
Index: branches/version-2_11-dev/data/Smarty/templates/sphone/frontparts/bloc/category.tpl
===================================================================
--- branches/version-2_11-dev/data/Smarty/templates/sphone/frontparts/bloc/category.tpl	(revision 21317)
+++ branches/version-2_11-dev/data/Smarty/templates/sphone/frontparts/bloc/category.tpl	(revision 21410)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *}-->
-<!--商品カテゴリここから-->
+<!--商品カテゴリーここから-->
 <section id="category_area">
-<h2 class="title_block">商品カテゴリ</h2>
+<h2 class="title_block">商品カテゴリー</h2>
 <nav id="categorytree">
 <ul id="categorytreelist">
@@ -70,5 +70,5 @@
 <script>
 //<![CDATA[
-initCategoryList(); //カテゴリリストの初期化
+initCategoryList(); //カテゴリーリストの初期化
 //]]>
 </script>
Index: branches/version-2_11-dev/data/module/SOAP/WSDL.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/WSDL.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/WSDL.php	(revision 21410)
@@ -25,5 +25,5 @@
 require_once 'SOAP/Base.php';
 require_once 'SOAP/Fault.php';
-require_once 'HTTP/Request.php';
+require_once 'Request.php';
 
 define('WSDL_CACHE_MAX_AGE', 43200);
@@ -37,4 +37,5 @@
  *
  * @todo
+ * - add wsdl caching
  * - refactor namespace handling ($namespace/$ns)
  * - implement IDL type syntax declaration so we can generate WSDL
@@ -230,14 +231,14 @@
      *                                 service.
      */
-    function parseObject($wsdl_obj, $targetNamespace, $service_name,
+    function parseObject(&$wsdl_obj, $targetNamespace, $service_name,
                          $service_desc = '')
     {
-        $parser = new SOAP_WSDL_ObjectParser($wsdl_obj, $this,
-                                             $targetNamespace, $service_name,
-                                             $service_desc);
-
-        if ($parser->fault) {
-            $this->_raiseSoapFault($parser->fault);
-        }
+        $parser =& new SOAP_WSDL_ObjectParser($wsdl_obj, $this,
+                                              $targetNamespace, $service_name,
+                                              $service_desc);
+
+         if ($parser->fault) {
+             $this->_raiseSoapFault($parser->fault);
+         }
     }
 
@@ -313,5 +314,5 @@
             $opData = $this->bindings[$binding]['operations'][$operation];
         }
-        // Get operation data from porttype.
+        // get operation data from porttype
         $portType = $this->bindings[$binding]['type'];
         if (!$portType) {
@@ -405,31 +406,27 @@
         }
 
-        if (!isset($this->ns[$namespace])) {
-            return null;
-        }
-
-        $nsp = $this->ns[$namespace];
-        //if (!isset($this->elements[$nsp]))
-        //    $nsp = $this->namespaces[$nsp];
-        if (!isset($this->elements[$nsp][$datatype])) {
-            return null;
-        }
-
-        $checkmessages = array();
-        // Find what messages use this datatype.
-        foreach ($this->messages as $messagename => $message) {
-            foreach ($message as $part) {
-                if ($part['type'] == $datatype) {
-                    $checkmessages[] = $messagename;
-                    break;
-                }
-            }
-        }
-        // Find the operation that uses this message.
-        foreach($this->portTypes as $porttype) {
-            foreach ($porttype as $opname => $opinfo) {
-                foreach ($checkmessages as $messagename) {
-                    if ($opinfo['input']['message'] == $messagename) {
-                        return $opname;
+        if (isset($this->ns[$namespace])) {
+            $nsp = $this->ns[$namespace];
+            //if (!isset($this->elements[$nsp]))
+            //    $nsp = $this->namespaces[$nsp];
+            if (isset($this->elements[$nsp][$datatype])) {
+                $checkmessages = array();
+                // Find what messages use this datatype.
+                foreach ($this->messages as $messagename => $message) {
+                    foreach ($message as $part) {
+                        if ($part['type'] == $datatype) {
+                            $checkmessages[] = $messagename;
+                            break;
+                        }
+                    }
+                }
+                // Find the operation that uses this message.
+                foreach($this->portTypes as $porttype) {
+                    foreach ($porttype as $opname => $opinfo) {
+                        foreach ($checkmessages as $messagename) {
+                            if ($opinfo['input']['message'] == $messagename) {
+                                return $opname;
+                            }
+                        }
                     }
                 }
@@ -854,12 +851,5 @@
     }
 
-    /**
-     * @param QName $name  A parameter name.
-     * @param QName $type  A parameter type.
-     *
-     * @return array  A list of [type, array element type, array element
-     *                namespace, array length].
-     */
-    function getSchemaType($type, $name)
+    function getSchemaType($type, $name, $type_namespace)
     {
         // see if it's a complex type so we can deal properly with
@@ -869,25 +859,25 @@
             // look up the name in the wsdl and validate the type.
             foreach ($this->complexTypes as $types) {
-                if (isset($types[$type->name])) {
-                    if (isset($types[$type->name]['type'])) {
-                        list($arraytype_ns, $arraytype, $array_depth) = isset($types[$type->name]['arrayType'])
-                            ? $this->_getDeepestArrayType($types[$type->name]['namespace'], $types[$type->name]['arrayType'])
-                            : array($this->namespaces[$types[$type->name]['namespace']], null, 0);
-                        return array($types[$type->name]['type'], $arraytype, $arraytype_ns, $array_depth);
-                    }
-                    if (isset($types[$type->name]['arrayType'])) {
+                if (isset($types[$type])) {
+                    if (isset($types[$type]['type'])) {
+                        list($arraytype_ns, $arraytype, $array_depth) = isset($types[$type]['arrayType'])
+                            ? $this->_getDeepestArrayType($types[$type]['namespace'], $types[$type]['arrayType'])
+                            : array($this->namespaces[$types[$type]['namespace']], null, 0);
+                        return array($types[$type]['type'], $arraytype, $arraytype_ns, $array_depth);
+                    }
+                    if (isset($types[$type]['arrayType'])) {
                         list($arraytype_ns, $arraytype, $array_depth) =
-                            $this->_getDeepestArrayType($types[$type->name]['namespace'], $types[$type->name]['arrayType']);
+                            $this->_getDeepestArrayType($types[$type]['namespace'], $types[$type]['arrayType']);
                         return array('Array', $arraytype, $arraytype_ns, $array_depth);
                     }
-                    if (!empty($types[$type->name]['elements'][$name->name])) {
-                        $type->name = $types[$type->name]['elements']['type'];
-                        return array($type->name, null, $this->namespaces[$types[$type->name]['namespace']], null);
-                    }
-                    break;
-                }
-            }
-        }
-        if ($type && $type->namespace) {
+                    if (!empty($types[$type]['elements'][$name])) {
+                        $type = $types[$type]['elements']['type'];
+                        return array($type, null, $this->namespaces[$types[$type]['namespace']], null);
+                    }
+                    break;
+                }
+            }
+        }
+        if ($type && $type_namespace) {
             $arrayType = null;
             // XXX TODO:
@@ -895,28 +885,28 @@
             // types in wsdl need to do a generalized function to figure out
             // complex types
-            $p = $this->ns[$type->namespace];
-            if ($p && !empty($this->complexTypes[$p][$type->name])) {
-                if ($arrayType = $this->complexTypes[$p][$type->name]['arrayType']) {
-                    $type->name = 'Array';
-                } elseif ($this->complexTypes[$p][$type->name]['order'] == 'sequence' &&
-                          array_key_exists('elements', $this->complexTypes[$p][$type->name])) {
-                    reset($this->complexTypes[$p][$type->name]['elements']);
+            $p = $this->ns[$type_namespace];
+            if ($p && !empty($this->complexTypes[$p][$type])) {
+                if ($arrayType = $this->complexTypes[$p][$type]['arrayType']) {
+                    $type = 'Array';
+                } elseif ($this->complexTypes[$p][$type]['order'] == 'sequence' &&
+                          array_key_exists('elements', $this->complexTypes[$p][$type])) {
+                    reset($this->complexTypes[$p][$type]['elements']);
                     // assume an array
-                    if (count($this->complexTypes[$p][$type->name]['elements']) == 1) {
-                        $arg = current($this->complexTypes[$p][$type->name]['elements']);
+                    if (count($this->complexTypes[$p][$type]['elements']) == 1) {
+                        $arg = current($this->complexTypes[$p][$type]['elements']);
                         $arrayType = $arg['type'];
-                        $type->name = 'Array';
+                        $type = 'Array';
                     } else {
-                        foreach ($this->complexTypes[$p][$type->name]['elements'] as $element) {
-                            if ($element['name'] == $type->name) {
+                        foreach ($this->complexTypes[$p][$type]['elements'] as $element) {
+                            if ($element['name'] == $type) {
                                 $arrayType = $element['type'];
-                                $type->name = $element['type'];
+                                $type = $element['type'];
                             }
                         }
                     }
                 } else {
-                    $type->name = 'Struct';
-                }
-                return array($type->name, $arrayType, $type->namespace, null);
+                    $type = 'Struct';
+                }
+                return array($type, $arrayType, $type_namespace, null);
             }
         }
@@ -1038,7 +1028,12 @@
             // Try to retrieve WSDL from cache
             $cachename = $this->_cacheDir() . '/' . md5($wsdl_fname). ' .wsdl';
-            if (file_exists($cachename) &&
-                $file_data = file_get_contents($cachename)) {
-                $md5_wsdl = md5($file_data);
+            if (file_exists($cachename)) {
+                $wf = fopen($cachename, 'rb');
+                if ($wf) {
+                    // Reading cached file
+                    $file_data = fread($wf, filesize($cachename));
+                    $md5_wsdl = md5($file_data);
+                    fclose($wf);
+                }
                 if ($cache) {
                     if ($cache != $md5_wsdl) {
@@ -1048,26 +1043,26 @@
                     $fi = stat($cachename);
                     $cache_mtime = $fi[8];
+                    //print cache_mtime, time()
                     if ($cache_mtime + $this->_cacheMaxAge < time()) {
-                        // Expired, refetch.
-                        $md5_wsdl = '';
-                    }
-                }
-            }
-        }
-
-        // Not cached or not using cache. Retrieve WSDL from URL
+                        // expired
+                        $md5_wsdl = ''; // refetch
+                    }
+                }
+            }
+        }
+
         if (!$md5_wsdl) {
-            // Is it a local file?
-            if (strpos($wsdl_fname, 'file://') === 0) {
-                $wsdl_fname = substr($wsdl_fname, 7);
+            // Not cached or not using cache. Retrieve WSDL from URL
+
+            // is it a local file?
+            // this section should be replace by curl at some point
+            if (!preg_match('/^(https?|file):\/\//', $wsdl_fname)) {
                 if (!file_exists($wsdl_fname)) {
-                    return $this->_raiseSoapFault('Unable to read local WSDL file', $wsdl_fname);
+                    return $this->_raiseSoapFault("Unable to read local WSDL $wsdl_fname", $wsdl_fname);
                 }
                 $file_data = file_get_contents($wsdl_fname);
-            } elseif (!preg_match('|^https?://|', $wsdl_fname)) {
-                return $this->_raiseSoapFault('Unknown schema of WSDL URL', $wsdl_fname);
             } else {
                 $uri = explode('?', $wsdl_fname);
-                $rq = new HTTP_Request($uri[0], $proxy_params);
+                $rq =& new HTTP_Request($uri[0], $proxy_params);
                 // the user agent HTTP_Request uses fouls things up
                 if (isset($uri[1])) {
@@ -1079,12 +1074,9 @@
                     isset($proxy_params['proxy_user']) &&
                     isset($proxy_params['proxy_pass'])) {
-                    $rq->setProxy($proxy_params['proxy_host'],
-                                  $proxy_params['proxy_port'],
-                                  $proxy_params['proxy_user'],
-                                  $proxy_params['proxy_pass']);
+                    $rq->setProxy($proxy_params['proxy_host'], $proxy_params['proxy_port'],
+                                  $proxy_params['proxy_user'], $proxy_params['proxy_pass']);
                 } elseif (isset($proxy_params['proxy_host']) &&
                           isset($proxy_params['proxy_port'])) {
-                    $rq->setProxy($proxy_params['proxy_host'],
-                                  $proxy_params['proxy_port']);
+                    $rq->setProxy($proxy_params['proxy_host'], $proxy_params['proxy_port']);
                 }
 
@@ -1107,9 +1099,7 @@
             }
         }
-
         if ($this->_cacheUse && $cache && $cache != $md5_wsdl) {
-            return $this->_raiseSoapFault('WSDL Checksum error!', $wsdl_fname);
-        }
-
+            return $this->_raiseSoapFault("WSDL Checksum error!", $wsdl_fname);
+        }
         return $file_data;
     }
@@ -1985,5 +1975,5 @@
      *                                 <service>.
      */
-    function SOAP_WSDL_ObjectParser($objects, &$wsdl, $targetNamespace,
+    function SOAP_WSDL_ObjectParser(&$objects, &$wsdl, $targetNamespace,
                                     $service_name, $service_desc = '')
     {
@@ -1996,5 +1986,5 @@
 
         // Parse each web service object
-        $wsdl_ref = is_array($objects) ? $objects : array($objects);
+        $wsdl_ref = (is_array($objects)? $objects : array(&$objects));
 
         foreach ($wsdl_ref as $ref_item) {
@@ -2031,5 +2021,5 @@
         $this->wsdl->namespaces[$this->tnsPrefix] = 'urn:' . $service_name;                 // Target namespace
         $this->wsdl->namespaces['xsd'] = array_search('xsd', $this->_namespaces);           // XML Schema
-        $this->wsdl->namespaces[SOAP_BASE::SOAPENCPrefix()] = array_search(SOAP_BASE::SOAPENCPrefix(), $this->_namespaces); // SOAP types
+        $this->wsdl->namespaces['SOAP-ENC'] = array_search('SOAP-ENC', $this->_namespaces); // SOAP types
 
         // XXX Refactor $namespace/$ns for Shane :-)
@@ -2050,5 +2040,5 @@
      * @param string $service_name     Name of the WSDL <service>.
      */
-    function _parse($object, $schemaNamespace, $service_name)
+    function _parse(&$object, $schemaNamespace, $service_name)
     {
         // Create namespace prefix for the schema
@@ -2109,8 +2099,4 @@
         // *** <wsdl:message> ***
         foreach ($object->__dispatch_map as $operationName => $messages) {
-            // We need at least 'in' and 'out' parameters.
-            if (!isset($messages['in']) || !isset($messages['out'])) {
-                return $this->_raiseSoapFault('The dispatch map for the method "' . $operationName . '" is missing an "in" or "out" definition.', 'urn:' . get_class($object));
-            }
             foreach ($messages as $messageType => $messageParts) {
                 unset($thisMessage);
Index: branches/version-2_11-dev/data/module/SOAP/Base.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Base.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Base.php	(revision 21410)
@@ -25,7 +25,5 @@
  */
 
-/** Define linebreak sequence for the Mail_Mime package. */
 define('MAIL_MIMEPART_CRLF', "\r\n");
-
 require_once 'PEAR.php';
 
@@ -37,6 +35,6 @@
 }
 
-define('SOAP_LIBRARY_VERSION', '0.12.0');
-define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.12.0-beta');
+define('SOAP_LIBRARY_VERSION', '0.11.0');
+define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.11.0-beta');
 
 // Set schema version.
@@ -63,7 +61,4 @@
 define('SOAP_DEFAULT_ENCODING',  'UTF-8');
 
-/**
- * @package SOAP
- */
 class SOAP_Base_Object extends PEAR
 {
@@ -121,5 +116,5 @@
         $is_instance = isset($this) && is_a($this, 'SOAP_Base_Object');
         if (is_object($str)) {
-            $fault = $str;
+            $fault =& $str;
         } else {
             if (!$code) {
@@ -127,9 +122,13 @@
             }
             require_once 'SOAP/Fault.php';
-            $fault = new SOAP_Fault($str, $code, $actorURI, $detail, $mode,
-                                    $options);
+            $fault =& new SOAP_Fault($str,
+                                     $code,
+                                     $actorURI,
+                                     $detail,
+                                     $mode,
+                                     $options);
         }
         if ($is_instance) {
-            $this->fault = $fault;
+            $this->fault =& $fault;
         }
 
@@ -242,5 +241,5 @@
      * Hash with used namespaces.
      *
-     * @var array
+     * @array
      */
     var $_namespaces;
@@ -249,5 +248,5 @@
      * The default namespace.
      *
-     * @var string
+     * @string
      */
     var $_namespace;
@@ -288,40 +287,4 @@
 
     /**
-     * Sets the SOAP-ENV prefix and returns the current value.
-     *
-     * @access public
-     *
-     * @param string SOAP-ENV prefix
-     *
-     * @return string current SOAP-ENV prefix.
-     */
-    function SOAPENVPrefix($prefix = null)
-    {
-        static $_soapenv_prefix = 'SOAP-ENV';
-        if (!is_null($prefix)) {
-            $_soapenv_prefix = $prefix;
-        }
-        return $_soapenv_prefix;
-    }
-
-    /**
-     * Sets the SOAP-ENC prefix and returns the current value.
-     *
-     * @access public
-     *
-     * @param string SOAP-ENC prefix
-     *
-     * @return string current SOAP-ENC prefix.
-     */
-    function SOAPENCPrefix($prefix = null)
-    {
-        static $_soapenv_prefix = 'SOAP-ENC';
-        if (!is_null($prefix)) {
-            $_soapenv_prefix = $prefix;
-        }
-        return $_soapenv_prefix;
-    }
-
-    /**
      * Sets the default namespace.
      *
@@ -336,8 +299,8 @@
     {
         $this->_namespaces = array(
-            'http://schemas.xmlsoap.org/soap/envelope/' => SOAP_BASE::SOAPENVPrefix(),
+            'http://schemas.xmlsoap.org/soap/envelope/' => 'SOAP-ENV',
             'http://www.w3.org/2001/XMLSchema' => 'xsd',
             'http://www.w3.org/2001/XMLSchema-instance' => 'xsi',
-            'http://schemas.xmlsoap.org/soap/encoding/' => SOAP_BASE::SOAPENCPrefix());
+            'http://schemas.xmlsoap.org/soap/encoding/' => 'SOAP-ENC');
     }
 
@@ -384,33 +347,26 @@
     }
 
-    /**
-     * Serializes a value, array or object according to the rules set by this
-     * object.
-     *
-     * @see SOAP_Value
-     *
-     * @param mixed $value       The actual value.
-     * @param QName $name        The value name.
-     * @param QName $type        The value type.
-     * @param array $options     A list of encoding and serialization options.
-     * @param array $attributes  A hash of additional attributes.
-     * @param string $artype     The type of any array elements.
-     */
-    function _serializeValue($value, $name = null, $type = null,
+    function _isSoapValue(&$value)
+    {
+        return is_a($value, 'SOAP_Value');
+    }
+
+    function _serializeValue(&$value, $name = '', $type = false,
+                             $elNamespace = null, $typeNamespace = null,
                              $options = array(), $attributes = array(),
                              $artype = '')
     {
-        $namespaces  = array();
-        $arrayType   = $array_depth = $xmlout_value = null;
-        $typePrefix  = $elPrefix = $xmlout_arrayType = '';
+        $namespaces = array();
+        $arrayType = $array_depth = $xmlout_value = null;
+        $typePrefix = $elPrefix = $xmlout_offset = $xmlout_arrayType = '';
         $xmlout_type = $xmlns = $ptype = $array_type_ns = '';
 
-        if (!$name->name || is_numeric($name->name)) {
-            $name->name = 'item';
+        if (!$name || is_numeric($name)) {
+            $name = 'item';
         }
 
         if ($this->_wsdl) {
             list($ptype, $arrayType, $array_type_ns, $array_depth)
-                = $this->_wsdl->getSchemaType($type, $name);
+                = $this->_wsdl->getSchemaType($type, $name, $typeNamespace);
         }
 
@@ -422,11 +378,16 @@
         }
         if (!$type) {
-            $type = new QName($ptype);
+            $type = $ptype;
         }
 
         if (strcasecmp($ptype, 'Struct') == 0 ||
-            strcasecmp($type->name, 'Struct') == 0) {
+            strcasecmp($type, 'Struct') == 0) {
             // Struct
-            $vars = is_object($value) ? get_object_vars($value) : $value;
+            $vars = null;
+            if (is_object($value)) {
+                $vars = get_object_vars($value);
+            } else {
+                $vars = &$value;
+            }
             if (is_array($vars)) {
                 foreach (array_keys($vars) as $k) {
@@ -435,5 +396,4 @@
                         continue;
                     }
-
                     if (is_object($vars[$k])) {
                         if (is_a($vars[$k], 'SOAP_Value')) {
@@ -443,15 +403,17 @@
                             // converting to an array is more overhead than we
                             // should really do.
-                            $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), new QName($k, $this->_section5 ? null : $name->namepace), null, $options);
+                            $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5 ? null : $elNamespace);
                         }
                     } else {
-                        $xmlout_value .= $this->_serializeValue($vars[$k], new QName($k, $this->_section5 ? null : $name->namespace), false, $options);
+                        $xmlout_value .= $this->_serializeValue($vars[$k], $k, false, $this->_section5 ? null : $elNamespace);
                     }
                 }
             }
         } elseif (strcasecmp($ptype, 'Array') == 0 ||
-                  strcasecmp($type->name, 'Array') == 0) {
+                  strcasecmp($type, 'Array') == 0) {
             // Array.
-            $type = new QName('Array', SOAP_SCHEMA_ENCODING);
+            $typeNamespace = SOAP_SCHEMA_ENCODING;
+            $orig_type = $type;
+            $type = 'Array';
             $numtypes = 0;
             $value = (array)$value;
@@ -477,5 +439,5 @@
                 $ar_size = count($value);
                 foreach ($value as $array_val) {
-                    if (is_a($array_val, 'SOAP_Value')) {
+                    if ($this->_isSoapValue($array_val)) {
                         $array_type = $array_val->type;
                         $array_types[$array_type] = 1;
@@ -485,12 +447,9 @@
                         $array_type = $this->_getType($array_val);
                         $array_types[$array_type] = 1;
-                        if (empty($options['keep_arrays_flat'])) {
-                            $xmlout_value .= $this->_serializeValue($array_val, new QName('item', $this->_section5 ? null : $name->namespace), new QName($array_type), $options);
-                        } else {
-                            $xmlout_value .= $this->_serializeValue($array_val, $name, new QName($array_type), $options, $attributes);
-                        }
+                        $xmlout_value .= $this->_serializeValue($array_val, 'item', $array_type, $this->_section5 ? null : $elNamespace);
                     }
                 }
 
+                $xmlout_offset = ' SOAP-ENC:offset="[0]"';
                 if (!$arrayType) {
                     $numtypes = count($array_types);
@@ -519,6 +478,4 @@
                 } elseif (isset($this->_typemap[$this->_XMLSchemaVersion][$arrayType])) {
                     $array_type_prefix = $this->_namespaces[$this->_XMLSchemaVersion];
-                } elseif (isset($this->_typemap[SOAP_SCHEMA_ENCODING][$arrayType])) {
-                    $array_type_prefix = SOAP_BASE::SOAPENCPrefix();
                 }
                 if ($array_type_prefix) {
@@ -527,6 +484,5 @@
             }
 
-            $xmlout_arrayType = ' ' . SOAP_BASE::SOAPENCPrefix()
-                . ':arrayType="' . $arrayType;
+            $xmlout_arrayType = ' SOAP-ENC:arrayType="' . $arrayType;
             if ($array_depth != null) {
                 for ($i = 0; $i < $array_depth; $i++) {
@@ -535,45 +491,42 @@
             }
             $xmlout_arrayType .= "[$ar_size]\"";
-        } elseif (is_a($value, 'SOAP_Value')) {
+        } elseif ($this->_isSoapValue($value)) {
             $xmlout_value = $value->serialize($this);
-        } elseif ($type->name == 'string') {
+        } elseif ($type == 'string') {
             $xmlout_value = htmlspecialchars($value);
-        } elseif ($type->name == 'rawstring') {
-            $xmlout_value = $value;
-        } elseif ($type->name == 'boolean') {
+        } elseif ($type == 'rawstring') {
+            $xmlout_value =& $value;
+        } elseif ($type == 'boolean') {
             $xmlout_value = $value ? 'true' : 'false';
         } else {
-            $xmlout_value = $value;
+            $xmlout_value =& $value;
         }
 
         // Add namespaces.
-        if ($name->namespace) {
-            $elPrefix = $this->_getNamespacePrefix($name->namespace);
+        if ($elNamespace) {
+            $elPrefix = $this->_getNamespacePrefix($elNamespace);
             if ($elPrefix) {
-                $xmlout_name = $elPrefix . ':' . $name->name;
-            } else {
-                $xmlout_name = $name->name;
+                $xmlout_name = "$elPrefix:$name";
+            } else {
+                $xmlout_name = $name;
             }
         } else {
-            $xmlout_name = $name->name;
-        }
-
-        if ($type->namespace) {
-            $typePrefix = false;
-            if (empty($options['no_type_prefix'])) {
-                $typePrefix = $this->_getNamespacePrefix($type->namespace);
-            }
+            $xmlout_name = $name;
+        }
+
+        if ($typeNamespace) {
+            $typePrefix = $this->_getNamespacePrefix($typeNamespace);
             if ($typePrefix) {
-                $xmlout_type = $typePrefix . ':' . $type->name;
-            } else {
-                $xmlout_type = $type->name;
-            }
-        } elseif ($type->name &&
-                  isset($this->_typemap[$this->_XMLSchemaVersion][$type->name])) {
+                $xmlout_type = "$typePrefix:$type";
+            } else {
+                $xmlout_type = $type;
+            }
+        } elseif ($type &&
+                  isset($this->_typemap[$this->_XMLSchemaVersion][$type])) {
             $typePrefix = $this->_namespaces[$this->_XMLSchemaVersion];
             if ($typePrefix) {
-                $xmlout_type = $typePrefix . ':' . $type->name;
-            } else {
-                $xmlout_type = $type->name;
+                $xmlout_type = "$typePrefix:$type";
+            } else {
+                $xmlout_type = $type;
             }
         }
@@ -604,8 +557,6 @@
             } else {
                 $xml = "\r\n<$xmlout_name$xmlout_type$xmlns$xmlout_arrayType" .
-                    "$xml_attr>$xmlout_value</$xmlout_name>";
-            }
-        } elseif ($type->name == 'Array' && !empty($options['keep_arrays_flat'])) {
-            $xml = $xmlout_value;
+                    "$xmlout_offset$xml_attr>$xmlout_value</$xmlout_name>";
+            }
         } else {
             if (is_null($xmlout_value)) {
@@ -623,9 +574,11 @@
      * Converts a PHP type to a SOAP type.
      *
-     * @param mixed $value  The value to inspect.
+     * @access   private
+     *
+     * @param string $value  The value to inspect.
      *
      * @return string  The value's SOAP type.
      */
-    function _getType($value)
+    function _getType(&$value)
     {
         $type = gettype($value);
@@ -643,20 +596,24 @@
             if ($this->_isHash($value)) {
                 $type = 'Struct';
-                break;
-            }
-            if (count($value) > 1) {
-                // For non-wsdl structs that are all the same type
+            } else {
+                $ar_size = count($value);
                 reset($value);
-                $value1 = next($value);
-                $value2 = next($value);
-                if (is_a($value1, 'SOAP_Value') &&
-                    is_a($value2, 'SOAP_Value') &&
-                    $value1->name != $value2->name) {
-                    // This is a struct, not an array.
-                    $type = 'Struct';
-                    break;
+                $key1 = key($value);
+                if ($ar_size > 0 && is_a($key1, 'SOAP_Value')) {
+                    // FIXME: for non-wsdl structs that are all the same type
+                    $key2 = key($value);
+                    if ($ar_size > 1 &&
+                        $this->_isSoapValue($key1) &&
+                        $this->_isSoapValue($key2) &&
+                        $key1->name != $key2->name) {
+                        // This is a struct, not an array.
+                        $type = 'Struct';
+                    } else {
+                        $type = 'Array';
+                    }
+                } else {
+                    $type = 'Array';
                 }
             }
-            $type = 'Array';
             break;
 
@@ -707,5 +664,5 @@
         } else {
             $type = $this->_getType($value);
-            $xml .= $this->_serializeValue($value, new QName('item'), new QName($type));
+            $xml .= $this->_serializeValue($value, 'item', $type);
         }
         $size = null;
@@ -733,11 +690,20 @@
      * @return boolean  True if the specified array is a hash.
      */
-    function _isHash($a)
-    {
-        foreach (array_keys($a) as $k) {
+    function _isHash(&$a)
+    {
+        // I really dislike having to loop through this in PHP code, really
+        // large arrays will be slow.  We need a C function to do this.
+        $it = 0;
+        foreach ($a as $k => $v) {
             // Checking the type is faster than regexp.
             if (!is_int($k)) {
                 return true;
             }
+            // If someone has a large hash they should really be defining the
+            // type.
+            if ($it++ > 10) {
+                $this->_raiseSoapFault('Large associative array passed where a SOAP_Value was expected');
+                return false;
+            }
         }
         return false;
@@ -752,15 +718,12 @@
 
     /**
-     * Converts a SOAP_Value object into a PHP value.
-     */
-    function _decode($soapval)
-    {
-        if (!is_a($soapval, 'SOAP_Value')) {
+    *   Converts a SOAP_Value object into a StdClass PHP object
+    */
+    function &_decode(&$soapval)
+    {
+        if (!$this->_isSoapValue($soapval)) {
             return $soapval;
-        }
-
-        if (is_array($soapval->value)) {
-            $isstruct = $soapval->type != 'Array';
-            if ($isstruct) {
+        } elseif (is_array($soapval->value)) {
+            if ($soapval->type != 'Array') {
                 $classname = $this->_defaultObjectClassname;
                 if (isset($this->_type_translation[$soapval->tqn->fqn()])) {
@@ -782,11 +745,13 @@
                     }
                 }
-                $return = new $classname;
+                $return =& new $classname;
             } else {
                 $return = array();
             }
 
+            $counter = 1;
+            $isstruct = !is_array($return);
             foreach ($soapval->value as $item) {
-                if ($isstruct) {
+                if (is_object($return)) {
                     if ($this->_wsdl) {
                         // Get this child's WSDL information.
@@ -801,8 +766,8 @@
                         }
                     }
-                    if ($item->type == 'Array') {
+                    if (!$isstruct || $item->type == 'Array') {
                         if (isset($return->{$item->name}) &&
                             is_object($return->{$item->name})) {
-                            $return->{$item->name} = $this->_decode($item);
+                            $return->{$item->name} =& $this->_decode($item);
                         } elseif (isset($return->{$item->name}) &&
                                   is_array($return->{$item->name})) {
@@ -814,18 +779,19 @@
                             );
                         } elseif (is_array($return)) {
-                            $return[] = $this->_decode($item);
+                            $return[] =& $this->_decode($item);
                         } else {
-                            $return->{$item->name} = $this->_decode($item);
+                            $return->{$item->name} =& $this->_decode($item);
                         }
                     } elseif (isset($return->{$item->name})) {
-                        $d = $this->_decode($item);
+                        //$isstruct = false;
                         if (count(get_object_vars($return)) == 1) {
-                            $isstruct = false;
+                            $d =& $this->_decode($item);
                             $return = array($return->{$item->name}, $d);
                         } else {
+                            $d =& $this->_decode($item);
                             $return->{$item->name} = array($return->{$item->name}, $d);
                         }
                     } else {
-                        $return->{$item->name} = $this->_decode($item);
+                        $return->{$item->name} =& $this->_decode($item);
                     }
                     // Set the attributes as members in the class.
@@ -838,5 +804,5 @@
                     }
                 } else {
-                    if ($soapval->arrayType && is_a($item, 'SOAP_Value')) {
+                    if ($soapval->arrayType && $this->_isSoapValue($item)) {
                         if ($this->_isBase64Type($item->type) &&
                             !$this->_isBase64Type($soapval->arrayType)) {
@@ -847,5 +813,13 @@
                         $item->type = $soapval->arrayType;
                     }
-                    $return[] = $this->_decode($item);
+                    if (!$isstruct) {
+                        $return[] = $this->_decode($item);
+                    } elseif (isset($return[$item->name])) {
+                        $isstruct = false;
+                        $d =& $this->_decode($item);
+                        $return = array($return[$item->name], $d);
+                    } else {
+                        $return[$item->name] = $this->_decode($item);
+                    }
                 }
             }
@@ -866,6 +840,4 @@
             settype($soapval->value,
                     $this->_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]);
-        } elseif ($soapval->type == 'Struct') {
-            $soapval->value = null;
         }
 
@@ -876,14 +848,13 @@
      * Creates the SOAP envelope with the SOAP envelop data.
      *
-     * @param SOAP_Value $method  SOAP_Value instance with the method name as
-     *                            the name, and the method arguments as the
-     *                            value.
-     * @param array $headers      A list of additional SOAP_Header objects.
-     * @param string $encoding    The charset of the SOAP message.
-     * @param array $options      A list of encoding/serialization options.
-     *
-     * @return string  The complete SOAP message.
-     */
-    function makeEnvelope($method, $headers, $encoding = SOAP_DEFAULT_ENCODING,
+     * @param mixed $method
+     * @param array $headers
+     * @param string $encoding
+     * @param array $options
+     *
+     * @return string
+     */
+    function makeEnvelope(&$method, &$headers,
+                          $encoding = SOAP_DEFAULT_ENCODING,
                           $options = array())
     {
@@ -891,15 +862,15 @@
 
         if ($headers) {
-            for ($i = 0, $c = count($headers); $i < $c; $i++) {
+            $c = count($headers);
+            for ($i = 0; $i < $c; $i++) {
                 $header_xml .= $headers[$i]->serialize($this);
             }
-            $header_xml = sprintf("<%s:Header>\r\n%s\r\n</%s:Header>\r\n",
-                                  SOAP_BASE::SOAPENVPrefix(), $header_xml,
-                                  SOAP_BASE::SOAPENVPrefix());
+            $header_xml = "<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n";
         }
 
         if (!isset($options['input']) || $options['input'] == 'parse') {
             if (is_array($method)) {
-                for ($i = 0, $c = count($method); $i < $c; $i++) {
+                $c = count($method);
+                for ($i = 0; $i < $c; $i++) {
                     $smsg .= $method[$i]->serialize($this);
                 }
@@ -910,29 +881,22 @@
             $smsg = $method;
         }
-        $body = sprintf("<%s:Body>%s\r\n</%s:Body>\r\n",
-                        SOAP_BASE::SOAPENVPrefix(), $smsg,
-                        SOAP_BASE::SOAPENVPrefix());
+        $body = "<SOAP-ENV:Body>\r\n" . $smsg . "\r\n</SOAP-ENV:Body>\r\n";
 
         foreach ($this->_namespaces as $k => $v) {
-            $ns_string .= "\r\n " . sprintf('xmlns:%s="%s"', $v, $k);
+            $ns_string .= " xmlns:$v=\"$k\"\r\n";
         }
         if ($this->_namespace) {
-            $ns_string .= "\r\n " . sprintf('xmlns="%s"', $this->_namespace);
-        }
-
-        /* If 'use' == 'literal', do not put in the encodingStyle.  This is
+            $ns_string .= " xmlns=\"{$this->_namespace}\"\r\n";
+        }
+
+        /* If 'use' == 'literal', we do not put in the encodingStyle.  This is
          * denoted by $this->_section5 being false.  'use' can be defined at a
          * more granular level than we are dealing with here, so this does not
          * work for all services. */
-        $xml = sprintf('<?xml version="1.0" encoding="%s"?>%s<%s:Envelope%s',
-                       $encoding, "\r\n", SOAP_BASE::SOAPENVPrefix(),
-                       $ns_string);
-        if ($this->_section5) {
-            $xml .= "\r\n " . sprintf('%s:encodingStyle="%s"',
-                                      SOAP_BASE::SOAPENVPrefix(),
-                                      SOAP_SCHEMA_ENCODING);
-        }
-        $xml .= sprintf('>%s%s%s</%s:Envelope>' . "\r\n",
-                        "\r\n", $header_xml, $body, SOAP_BASE::SOAPENVPrefix());
+        $xml = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n".
+            "<SOAP-ENV:Envelope $ns_string".
+            ($this->_section5 ? ' SOAP-ENV:encodingStyle="' . SOAP_SCHEMA_ENCODING . '"' : '').
+            ">\r\n".
+            "$header_xml$body</SOAP-ENV:Envelope>\r\n";
 
         return $xml;
@@ -953,4 +917,5 @@
         $params['content_type'] = 'text/xml';
         $params['charset'] = $encoding;
+        $params['encoding'] = 'base64';
         $msg->addSubPart($xml, $params);
 
@@ -1001,5 +966,5 @@
 
         // Lame thing to have to do for decoding.
-        $decoder = new Mail_mimeDecode($data);
+        $decoder =& new Mail_mimeDecode($data);
         $structure = $decoder->decode($params);
 
@@ -1013,19 +978,19 @@
             $headers = array_merge($structure->headers,
                                    $structure->parts[0]->headers);
-            if (count($structure->parts) <= 1) {
-                return;
-            }
-
-            $mime_parts = array_splice($structure->parts, 1);
-            // Prepare the parts for the SOAP parser.
-            for ($i = 0, $c = count($mime_parts); $i < $c; $i++) {
-                $p = $mime_parts[$i];
-                if (isset($p->headers['content-location'])) {
-                    // TODO: modify location per SwA note section 3
-                    // http://www.w3.org/TR/SOAP-attachments
-                    $attachments[$p->headers['content-location']] = $p->body;
-                } else {
-                    $cid = 'cid:' . substr($p->headers['content-id'], 1, -1);
-                    $attachments[$cid] = $p->body;
+            if (count($structure->parts) > 1) {
+                $mime_parts = array_splice($structure->parts,1);
+                // Prepare the parts for the SOAP parser.
+
+                $c = count($mime_parts);
+                for ($i = 0; $i < $c; $i++) {
+                    $p =& $mime_parts[$i];
+                    if (isset($p->headers['content-location'])) {
+                        // TODO: modify location per SwA note section 3
+                        // http://www.w3.org/TR/SOAP-attachments
+                        $attachments[$p->headers['content-location']] = $p->body;
+                    } else {
+                        $cid = 'cid:' . substr($p->headers['content-id'], 1, -1);
+                        $attachments[$cid] = $p->body;
+                    }
                 }
             }
@@ -1045,5 +1010,5 @@
         // This SHOULD be moved to the transport layer, e.g. PHP itself should
         // handle parsing DIME ;)
-        $dime = new Net_DIME_Message();
+        $dime =& new Net_DIME_Message();
         $err = $dime->decodeData($data);
         if (PEAR::isError($err)) {
@@ -1071,4 +1036,12 @@
 
     /**
+     * @deprecated Use setTypeTranslation().
+     */
+    function __set_type_translation($type, $class = null)
+    {
+        $this->setTypeTranslation($type, $class);
+    }
+
+    /**
      * Explicitly sets the translation for a specific class.
      *
@@ -1093,4 +1066,5 @@
  * Class used to handle QNAME values in XML.
  *
+ * @access   public
  * @package  SOAP
  * @author   Shane Caraveo <shane@php.net> Conversion to PEAR and updates
@@ -1100,5 +1074,5 @@
     var $name = '';
     var $ns = '';
-    var $namespace = '';
+    var $namespace='';
 
     function QName($name, $namespace = '')
Index: branches/version-2_11-dev/data/module/SOAP/tools/genproxy.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/tools/genproxy.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/tools/genproxy.php	(revision 21410)
Index: branches/version-2_11-dev/data/module/SOAP/Fault.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Fault.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Fault.php	(revision 21410)
@@ -24,5 +24,4 @@
  */
 
-/** PEAR_Error */
 require_once 'PEAR.php';
 
@@ -30,13 +29,13 @@
  * PEAR::Error wrapper used to match SOAP Faults to PEAR Errors
  *
- * SOAP_Fault can provide a complete backtrace of the error.  Revealing these
- * details in a public web services is a bad idea because it can be used by
- * attackers.  Thus you have to enable backtrace information in SOAP_Fault
- * responses by putting the following code in your script after your
- * "require_once 'SOAP/Server.php';" line:
+ * SOAP_Fault transmissions normally contain a complete backtrace of the
+ * error.  Revealing these details in a public web services is a bad idea
+ * because it can be used by attackers.  Backtrace information can be kept out
+ * of SOAP_Fault responses by putting the following code in your script after
+ * your "require_once 'SOAP/Server.php';" line:
  *
  * <code>
- * $backtrace =& PEAR::getStaticProperty('SOAP_Fault', 'backtrace');
- * $backtrace = true;
+ * $skiptrace =& PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
+ * $skiptrace = true;
  * </code>
  *
@@ -77,9 +76,8 @@
         $msg = new SOAP_Base();
         $params = array();
-        $params[] = new SOAP_Value('faultcode', 'QName', SOAP_BASE::SOAPENVPrefix().':' . $this->code);
+        $params[] = new SOAP_Value('faultcode', 'QName', 'SOAP-ENV:' . $this->code);
         $params[] = new SOAP_Value('faultstring', 'string', $this->message);
         $params[] = new SOAP_Value('faultactor', 'anyURI', $this->error_message_prefix);
-        if (PEAR::getStaticProperty('SOAP_Fault', 'backtrace') &&
-            isset($this->backtrace)) {
+        if (isset($this->backtrace)) {
             $params[] = new SOAP_Value('detail', 'string', $this->backtrace);
         } else {
Index: branches/version-2_11-dev/data/module/SOAP/Type/dateTime.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Type/dateTime.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Type/dateTime.php	(revision 21410)
@@ -1,5 +1,5 @@
 <?php
 /**
- * This file contains the code for the SOAP_Type_dateTime class.
+ * This file contains the code for the SOAP date/time clas.
  *
  * PHP versions 4 and 5
@@ -17,5 +17,5 @@
  * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
  * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
+ * @copyright  2003-2005 The PHP Group
  * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
  * @link       http://pear.php.net/package/SOAP
@@ -31,5 +31,5 @@
  * @author   Jan Schneider <jan@horde.org>       Maintenance
  */
-class SOAP_Type_dateTime
+class SOAP_Type_dateTime 
 {
     var $_iso8601 =
@@ -97,5 +97,5 @@
         //simulate PHP5's P parameter
         $zone = date('O', $timestamp);
-        if (strlen($zone) === 5) {
+        if (strlen($zone) == 5) {
             $zone = substr($zone, 0, 3) . ':' . substr($zone, 3);
         }
Index: branches/version-2_11-dev/data/module/SOAP/Type/duration.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Type/duration.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Type/duration.php	(revision 21410)
@@ -1,96 +1,71 @@
 <?php
-/**
- * This file contains the code for the SOAP_Type_duration class.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+/*
+http://www.w3.org/TR/xmlschema-2/
 
-/**
- * This is only an aproximation of duration, more work still to do.  See the
- * schema url for more info on duration.
- *
- * http://www.w3.org/TR/xmlschema-2/
- *
- * [Definition:]   duration represents a duration of time. The value space of
- * duration is a six-dimensional space where the coordinates designate the
- * Gregorian year, month, day, hour, minute, and second components
- * defined in  5.5.3.2 of [ISO 8601], respectively. These components are
- * ordered in their significance by their order of appearance i.e. as year,
- * month, day, hour, minute, and second.
- *
- * 3.2.6.1 Lexical representation
- * The lexical representation for duration is the [ISO 8601] extended
- * format PnYn MnDTnH nMnS, where nY represents the number of
- * years, nM the number of months, nD the number of days, 'T' is the
- * date/time separator, nH the number of hours, nM the number of
- * minutes and nS the number of seconds. The number of seconds
- * can include decimal digits to arbitrary precision.
- *
- * The values of the Year, Month, Day, Hour and Minutes components
- * are not restricted but allow an arbitrary integer. Similarly, the
- * value of the Seconds component allows an arbitrary decimal.
- * Thus, the lexical representation of duration does not follow the
- * alternative format of  5.5.3.2.1 of [ISO 8601].
- *
- * An optional preceding minus sign ('-') is allowed, to indicate a
- * negative duration. If the sign is omitted a positive duration is
- * indicated. See also ISO 8601 Date and Time Formats (D).
- *
- * For example, to indicate a duration of 1 year, 2 months, 3 days,
- * 10 hours, and 30 minutes, one would write: P1Y2M3DT10H30M.
- * One could also indicate a duration of minus 120 days as: -P120D.
- *
- * Reduced precision and truncated representations of this format
- * are allowed provided they conform to the following:
- *
- * If the number of years, months, days, hours, minutes, or seconds
- * in any expression equals zero, the number and its corresponding
- * designator *may* be omitted. However, at least one number and
- * its designator *must* be present.
- * The seconds part *may* have a decimal fraction.
- * The designator 'T' shall be absent if all of the time items are absent.
- * The designator 'P' must always be present.
- * For example, P1347Y, P1347M and P1Y2MT2H are all allowed; P0Y1347M
- * and P0Y1347M0D are allowed. P-1347M is not allowed although -P1347M
- * is allowed. P1Y2MT is not allowed.
- *
- * @access   public
- * @package  SOAP
- * @author   Shane Caraveo <shane@php.net> Port to PEAR and more
- * @author   Jan Schneider <jan@horde.org> Maintenance
- * @todo     Figure out best aproximation for year and month conversion to
- *           seconds
- */
+[Definition:]   duration represents a duration of time. The value space of
+duration is a six-dimensional space where the coordinates designate the
+Gregorian year, month, day, hour, minute, and second components
+defined in  5.5.3.2 of [ISO 8601], respectively. These components are
+ordered in their significance by their order of appearance i.e. as year,
+month, day, hour, minute, and second. 
+
+3.2.6.1 Lexical representation
+The lexical representation for duration is the [ISO 8601] extended
+format PnYn MnDTnH nMnS, where nY represents the number of
+years, nM the number of months, nD the number of days, 'T' is the
+date/time separator, nH the number of hours, nM the number of
+minutes and nS the number of seconds. The number of seconds
+can include decimal digits to arbitrary precision.
+
+The values of the Year, Month, Day, Hour and Minutes components
+are not restricted but allow an arbitrary integer. Similarly, the
+value of the Seconds component allows an arbitrary decimal.
+Thus, the lexical representation of duration does not follow the
+alternative format of  5.5.3.2.1 of [ISO 8601].
+
+An optional preceding minus sign ('-') is allowed, to indicate a
+negative duration. If the sign is omitted a positive duration is
+indicated. See also ISO 8601 Date and Time Formats (D). 
+
+For example, to indicate a duration of 1 year, 2 months, 3 days,
+10 hours, and 30 minutes, one would write: P1Y2M3DT10H30M.
+One could also indicate a duration of minus 120 days as: -P120D. 
+
+Reduced precision and truncated representations of this format
+are allowed provided they conform to the following: 
+
+If the number of years, months, days, hours, minutes, or seconds
+in any expression equals zero, the number and its corresponding
+designator *may* be omitted. However, at least one number and
+its designator *must* be present. 
+The seconds part *may* have a decimal fraction. 
+The designator 'T' shall be absent if all of the time items are absent.
+The designator 'P' must always be present. 
+For example, P1347Y, P1347M and P1Y2MT2H are all allowed; P0Y1347M
+and P0Y1347M0D are allowed. P-1347M is not allowed although -P1347M
+is allowed. P1Y2MT is not allowed. 
+
+*/
+
+/* this is only an aproximation of duration, more work still to do.
+   see above schema url for more info on duration
+   
+   TODO: figure out best aproximation for year and month conversion to seconds
+*/
+   
+$ereg_duration = '(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?';
 class SOAP_Type_duration
 {
     // format PnYnMnDTnHnMnS
-    function unix_to_duration($seconds)
-    {
+    function unix_to_duration($seconds) {
         return SOAP_Type_duration::getduration($seconds);
     }
-
-    function mod($a, $b, &$d, &$r)
-    {
-        $d = floor($a / $b);
+    
+    function mod($a, $b, &$d, &$r) {
+        $d = floor( $a / $b );
         $r = $a % $b;
     }
-
-    function getduration($seconds)
-    {
+    
+    function getduration($seconds) {
         $neg = '';
         if ($seconds < 0) {
@@ -98,5 +73,5 @@
             $seconds = $seconds * -1;
         }
-
+        
         $_mi = 60;
         $_h = $_mi * 60;
@@ -111,5 +86,5 @@
         SOAP_Type_duration::mod($seconds, $_h, $h, $seconds);
         SOAP_Type_duration::mod($seconds, $_mi, $mi, $s);
-
+        
         $duration = $neg.'P';
         if ($y) $duration .= $y.'Y';
@@ -121,10 +96,8 @@
         if ($s) $duration .= $s.'S';
         if ($duration == 'P' || $duration == '-P') $duration = 'PT0S';
-
         return $duration;
     }
-
-    function mkduration($n, $Y, $Mo, $D, $H, $Mi, $S)
-    {
+    
+    function mkduration($n, $Y, $Mo, $D, $H, $Mi, $S) {
         $_mi = 60;
         $_h = $_mi * 60;
@@ -133,26 +106,24 @@
         $_m = $_d * 30;
         $_y = $_d * 365;
-
+        
         $sec = $Y * $_y + $Mo * $_m + $D * $_d + $H * $_h + $Mi * $_mi + $S;
         if ($n == '-') $sec = $sec * -1;
-
         return $sec;
     }
-
-    function duration_to_unix($duration)
-    {
-        if (ereg('(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?', $duration, $regs)) {
+    
+    function duration_to_unix($duration) {
+        global $ereg_duration;
+        if (ereg($ereg_duration,$duration,$regs)) {
             return SOAP_Type_duration::mkduration($regs[1], $regs[2], $regs[3], $regs[4], $regs[5], $regs[6], $regs[7]);
         }
-        return false;
+        return FALSE;
     }
-
-    function is_duration($duration)
-    {
-        return ereg('(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?', $duration, $regs);
+    
+    function is_duration($duration) {
+        global $ereg_duration;
+        return ereg($ereg_duration,$duration,$regs);
     }
-
-    function _test($time)
-    {
+    
+    function _test($time) {
         if (SOAP_Type_duration::is_duration($time)) {
             $t = SOAP_Type_duration::duration_to_unix($time);
@@ -164,14 +135,12 @@
         return $t;
     }
-
-    function add($d1, $d2)
-    {
+    
+    function add($d1, $d2) {
         $s1 = SOAP_Type_duration::duration_to_unix($d1);
         $s2 = SOAP_Type_duration::duration_to_unix($d2);
         return SOAP_Type_duration::unix_to_duration($s1 + $s2);
     }
-
-    function subtract($d1, $d2)
-    {
+    
+    function subtract($d1, $d2) {
         $s1 = SOAP_Type_duration::duration_to_unix($d1);
         $s2 = SOAP_Type_duration::duration_to_unix($d2);
@@ -181,5 +150,6 @@
 }
 
-/* Tests. */
+/* tests */
+
 $t = SOAP_Type_duration::_test('P1Y2M3DT10H30M');
 SOAP_Type_duration::_test($t);
@@ -187,8 +157,9 @@
 SOAP_Type_duration::_test($t);
 
-/* Duration since 1970. */
+// duration since 1970
 $t = SOAP_Type_duration::_test(time());
 SOAP_Type_duration::_test($t);
 
-echo 'Add should be PT0S: ' . SOAP_Type_duration::add('-P120D','P4M') . "\n";
-echo 'Subtract should be PT0S: ' . SOAP_Type_duration::subtract('P120D','P4M') . "\n";
+print "Add should be PT0S: ".SOAP_Type_duration::add('-P120D','P4M')."\n";
+print "Subtract should be PT0S: ".SOAP_Type_duration::subtract('P120D','P4M')."\n";
+?>
Index: branches/version-2_11-dev/data/module/SOAP/Parser.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Parser.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Parser.php	(revision 21410)
@@ -221,10 +221,12 @@
 
         // Add current node's value.
-        $nqn = new QName($this->message[$pos]['name'],
-                         $this->message[$pos]['namespace']);
-        $tqn = new QName($this->message[$pos]['type'],
-                         $this->message[$pos]['type_namespace']);
         if ($response) {
-            $response = new SOAP_Value($nqn->fqn(), $tqn->fqn(), $response,
+            $nqn = new QName($this->message[$pos]['name'],
+                             $this->message[$pos]['namespace']);
+            $tqn = new QName($this->message[$pos]['type'],
+                             $this->message[$pos]['type_namespace']);
+            $response = new SOAP_Value($nqn->fqn(),
+                                       $tqn->fqn(),
+                                       $response,
                                        $attrs);
             if (isset($this->message[$pos]['arrayType'])) {
@@ -232,13 +234,17 @@
             }
         } else {
+            $nqn = new QName($this->message[$pos]['name'],
+                             $this->message[$pos]['namespace']);
+            $tqn = new QName($this->message[$pos]['type'],
+                             $this->message[$pos]['type_namespace']);
             // Check if value is an empty array
             if ($tqn->name == 'Array') {
-                $response = new SOAP_Value($nqn->fqn(), $tqn->fqn(), array(),
-                                           $attrs);
-                //if ($pos == 4) var_dump($this->message[$pos], $response);
+                $response =& new SOAP_Value($nqn->fqn(), $tqn->fqn(),
+                                            array(), $attrs);
             } else {
-                $response = new SOAP_Value($nqn->fqn(), $tqn->fqn(),
-                                           $this->message[$pos]['cdata'],
-                                           $attrs);
+                $response = new SOAP_Value($nqn->fqn(),
+                                            $tqn->fqn(),
+                                            $this->message[$pos]['cdata'],
+                                            $attrs);
             }
         }
@@ -251,5 +257,4 @@
             $response->mustunderstand = $this->message[$pos]['mustUnderstand'];
         }
-
         return $response;
     }
Index: branches/version-2_11-dev/data/module/SOAP/Transport.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Transport.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Transport.php	(revision 21410)
@@ -116,10 +116,11 @@
     }
 
-    function getTransport($url, $encoding = SOAP_DEFAULT_ENCODING)
+    function &getTransport($url, $encoding = SOAP_DEFAULT_ENCODING)
     {
         $urlparts = @parse_url($url);
 
         if (!$urlparts['scheme']) {
-            return SOAP_Base_Object::_raiseSoapFault("Invalid transport URI: $url");
+            $fault = SOAP_Base_Object::_raiseSoapFault("Invalid transport URI: $url");
+            return $fault;
         }
 
@@ -132,15 +133,18 @@
             $transport_type = strtoupper($urlparts['scheme']);
         }
+        $transport_include = 'SOAP/Transport/' . basename($transport_type) . '.php';
+        $res = @include_once($transport_include);
+        if (!$res) {
+            $fault = SOAP_Base_Object::_raiseSoapFault("No Transport for {$urlparts['scheme']}");
+            return $fault;
+        }
         $transport_class = "SOAP_Transport_$transport_type";
         if (!class_exists($transport_class)) {
-            if (!(@include_once('SOAP/Transport/' . basename($transport_type) . '.php'))) {
-                return SOAP_Base_Object::_raiseSoapFault("No Transport for {$urlparts['scheme']}");
-            }
+            $fault = SOAP_Base_Object::_raiseSoapFault("No Transport class $transport_class");
+            return $fault;
         }
-        if (!class_exists($transport_class)) {
-            return SOAP_Base_Object::_raiseSoapFault("No Transport class $transport_class");
-        }
+        $t =& new $transport_class($url, $encoding);
 
-        return new $transport_class($url, $encoding);
+        return $t;
     }
 
Index: branches/version-2_11-dev/data/module/SOAP/Value.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Value.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Value.php	(revision 21410)
@@ -41,74 +41,37 @@
 {
     /**
-     * The actual value.
-     *
-     * @var mixed
+     * @var string
      */
     var $value = null;
 
     /**
-     * QName instance representing the value name.
-     *
-     * @var QName
-     */
+     * @var string
+     */
+    var $name = '';
+
+    /**
+     * @var string
+     */
+    var $type = '';
+
+    /**
+     * Namespace
+     *
+     * @var string
+     */
+    var $namespace = '';
+    var $type_namespace = '';
+
+    var $attributes = array();
+
+    /**
+     * @var string
+     */
+    var $arrayType = '';
+
+    var $options = array();
+
     var $nqn;
-
-    /**
-     * The value name, without namespace information.
-     *
-     * @var string
-     */
-    var $name = '';
-
-    /**
-     * The namespace of the value name.
-     *
-     * @var string
-     */
-    var $namespace = '';
-
-    /**
-     * QName instance representing the value type.
-     *
-     * @var QName
-     */
     var $tqn;
-
-    /**
-     * The value type, without namespace information.
-     *
-     * @var string
-     */
-    var $type = '';
-
-    /**
-     * The namespace of the value type.
-     *
-     * @var string
-     */
-    var $type_namespace = '';
-
-    /**
-     * The type of the array elements, if this value is an array.
-     *
-     * @var string
-     */
-    var $arrayType = '';
-
-    /**
-     * A hash of additional attributes.
-     *
-     * @see SOAP_Value()
-     * @var array
-     */
-    var $attributes = array();
-
-    /**
-     * List of encoding and serialization options.
-     *
-     * @see SOAP_Value()
-     * @var array
-     */
-    var $options = array();
 
     /**
@@ -119,32 +82,19 @@
      *                           automatically if not set.
      * @param mixed $value       Value to set.
-     * @param array $attributes  A has of additional XML attributes to be
-     *                           added to the serialized value.
-     * @param array $options     A list of encoding and serialization options:
-     *                           - 'attachment': array with information about
-     *                             the attachment
-     *                           - 'soap_encoding': defines encoding for SOAP
-     *                             message part of a MIME encoded SOAP request
-     *                             (default: base64)
-     *                           - 'keep_arrays_flat': use the tag name
-     *                             multiple times for each element when
-     *                             passing in an array in literal mode
-     *                           - 'no_type_prefix': supress adding of the
-     *                             namespace prefix
+     * @param array $attributes  Attributes.
      */
     function SOAP_Value($name = '', $type = false, $value = null,
-                        $attributes = array(), $options = array())
-    {
+                        $attributes = array())
+    {
+        // Detect type if not passed.
         $this->nqn = new QName($name);
         $this->name = $this->nqn->name;
         $this->namespace = $this->nqn->namespace;
-        if ($type) {
-            $this->tqn = new QName($type);
-            $this->type = $this->tqn->name;
-            $this->type_namespace = $this->tqn->namespace;
-        }
+        $this->tqn = new QName($type);
+        $this->type = $this->tqn->name;
+        $this->type_prefix = $this->tqn->ns;
+        $this->type_namespace = $this->tqn->namespace;
         $this->value = $value;
         $this->attributes = $attributes;
-        $this->options = $options;
     }
 
@@ -160,6 +110,8 @@
     {
         return $serializer->_serializeValue($this->value,
-                                            $this->nqn,
-                                            $this->tqn,
+                                            $this->name,
+                                            $this->type,
+                                            $this->namespace,
+                                            $this->type_namespace,
                                             $this->options,
                                             $this->attributes,
@@ -205,9 +157,9 @@
 
         if (isset($actor)) {
-            $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = $actor;
-        } elseif (!isset($this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'])) {
-            $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = 'http://schemas.xmlsoap.org/soap/actor/next';
-        }
-        $this->attributes[SOAP_BASE::SOAPENVPrefix().':mustUnderstand'] = (int)$mustunderstand;
+            $this->attributes['SOAP-ENV:actor'] = $actor;
+        } elseif (!isset($this->attributes['SOAP-ENV:actor'])) {
+            $this->attributes['SOAP-ENV:actor'] = 'http://schemas.xmlsoap.org/soap/actor/next';
+        }
+        $this->attributes['SOAP-ENV:mustUnderstand'] = (int)$mustunderstand;
     }
 
@@ -232,12 +184,11 @@
      *                          is provide.
      * @param string $file      The attachment data.
-     * @param array $attributes Attributes.
      */
     function SOAP_Attachment($name = '', $type = 'application/octet-stream',
-                             $filename, $file = null, $attributes = null)
+                             $filename, $file = null)
     {
         parent::SOAP_Value($name, null, null);
 
-        $filedata = $file === null ? $this->_file2str($filename) : $file;
+        $filedata = ($file === null) ? $this->_file2str($filename) : $file;
         $filename = basename($filename);
         if (PEAR::isError($filedata)) {
@@ -248,6 +199,5 @@
         $cid = md5(uniqid(time()));
 
-        $this->attributes = $attributes;
-        $this->attributes['href'] = 'cid:' . $cid;
+        $this->attributes['href'] = 'cid:' . $cid; 
 
         $this->options['attachment'] = array('body' => $filedata,
Index: branches/version-2_11-dev/data/module/SOAP/Client.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Client.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Client.php	(revision 21410)
@@ -23,5 +23,4 @@
  */
 
-/** SOAP_Value */
 require_once 'SOAP/Value.php';
 require_once 'SOAP/Base.php';
@@ -37,7 +36,4 @@
 // these two are BC/FC handlers for call in PHP4/5
 
-/**
- * @package SOAP
- */
 if (!class_exists('SOAP_Client_Overload')) {
     if (substr(zend_version(), 0, 1) > 1) {
@@ -297,21 +293,13 @@
      * placed in the options array.  This is done to provide backwards
      * compatibility with current clients, but may be removed in the future.
-     * The currently supported values are:
-     * - 'namespace'
-     * - 'soapaction'
-     * - 'timeout': HTTP socket timeout
-     * - 'transfer-encoding': SMTP transport, Content-Transfer-Encoding: header
-     * - 'from': SMTP transport, From: header
-     * - 'subject': SMTP transport, Subject: header
-     * - 'headers': SMTP transport, hash of extra SMTP headers
-     * - 'attachments': what encoding to use for attachments (Mime, Dime)
-     * - 'trace': whether to trace the SOAP communication
-     * - 'style': 'document' or 'rpc'; when set to 'document' the parameters
-     *   are not wrapped inside a tag with the SOAP action name
-     * - 'use': 'literal' for literal encoding, anything else for section 5
-     *   encoding; when set to 'literal' SOAP types will be omitted.
-     * - 'keep_arrays_flat': use the tag name multiple times for each element
-     *   when passing in an array in literal mode
-     * - 'no_type_prefix': supress adding of the namespace prefix
+     * The currently supported values are:<pre>
+     *   namespace
+     *   soapaction
+     *   timeout (HTTP socket timeout)
+     *   transfer-encoding (SMTP, Content-Transfer-Encoding: header)
+     *   from (SMTP, From: header)
+     *   subject (SMTP, Subject: header)
+     *   headers (SMTP, hash of extra SMTP headers)
+     * </pre>
      *
      * @access public
@@ -319,12 +307,10 @@
      * @param string $method           The method to call.
      * @param array $params            The method parameters.
-     * @param string|array $namespace  Namespace or hash with options. Note:
-     *                                 most options need to be repeated for
-     *                                 SOAP_Value instances.
+     * @param string|array $namespace  Namespace or hash with options.
      * @param string $soapAction
      *
      * @return mixed  The method result or a SOAP_Fault on error.
      */
-    function call($method, $params, $namespace = false, $soapAction = false)
+    function &call($method, &$params, $namespace = false, $soapAction = false)
     {
         $this->headersIn = null;
@@ -347,8 +333,9 @@
         if (!$this->_soap_transport ||
             $this->_endpoint != $this->_soap_transport->url) {
-            $this->_soap_transport = SOAP_Transport::getTransport($this->_endpoint);
+            $this->_soap_transport =& SOAP_Transport::getTransport($this->_endpoint);
             if (PEAR::isError($this->_soap_transport)) {
-                $fault = $this->_raiseSoapFault($this->_soap_transport);
+                $fault =& $this->_soap_transport;
                 $this->_soap_transport = null;
+                $fault = $this->_raiseSoapFault($fault);
                 return $fault;
             }
@@ -379,6 +366,6 @@
         $this->__result_encoding = $this->_soap_transport->result_encoding;
 
-        $result = $this->parseResponse($this->xml, $this->__result_encoding,
-                                       $this->_soap_transport->attachments);
+        $result = &$this->parseResponse($this->xml, $this->__result_encoding,
+                                        $this->_soap_transport->attachments);
         return $result;
     }
@@ -442,5 +429,5 @@
         }
 
-        $return_value = $this->call($method, $params);
+        $return_value =& $this->call($method, $params);
 
         return true;
@@ -448,4 +435,13 @@
 
     /**
+     * @deprecated Use getLastRequest().
+     */
+    function &__getlastrequest()
+    {
+        $request = $this->getLastRequest();
+        return $request;
+    }
+
+    /**
      * Returns the XML content of the last SOAP request.
      *
@@ -458,4 +454,13 @@
 
     /**
+     * @deprecated Use getLastResponse().
+     */
+    function &__getlastresponse()
+    {
+        $response =& $this->getLastResponse;
+        return $response;
+    }
+
+    /**
      * Returns the XML content of the last SOAP response.
      *
@@ -468,8 +473,14 @@
 
     /**
+     * @deprecated Use setUse().
+     */
+    function __use($use)
+    {
+        $this->setUse($use);
+    }
+
+    /**
      * Sets the SOAP encoding.
      *
-     * The default encoding is section 5 encoded.
-     *
      * @param string $use  Either 'literal' or 'encoded' (section 5).
      */
@@ -480,8 +491,14 @@
 
     /**
+     * @deprecated Use setStyle().
+     */
+    function __style($style)
+    {
+        $this->setStyle($style);
+    }
+
+    /**
      * Sets the SOAP encoding style.
      *
-     * The default style is rpc.
-     *
      * @param string $style  Either 'document' or 'rpc'.
      */
@@ -492,4 +509,12 @@
 
     /**
+     * @deprecated Use setTrace().
+     */
+    function __trace($level)
+    {
+        $this->setTrace($level);
+    }
+
+    /**
      * Sets whether to trace the traffic on the transport level.
      *
@@ -503,49 +528,30 @@
     }
 
-    /**
-     * Generates the complete XML SOAP message for an RPC call.
-     *
-     * @see call()
-     *
-     * @param string $method           The method to call.
-     * @param array $params            The method parameters.
-     * @param string|array $namespace  Namespace or hash with options. Note:
-     *                                 most options need to be repeated for
-     *                                 SOAP_Value instances.
-     * @param string $soapAction
-     *
-     * @return string  The SOAP message including envelope.
-     */
-    function _generate($method, $params, $namespace = false,
+    function _generate($method, &$params, $namespace = false,
                        $soapAction = false)
     {
         $this->fault = null;
-        $this->_options['input'] = 'parse';
+        $this->_options['input'] = 'parse'; 
         $this->_options['result'] = 'parse';
         $this->_options['parameters'] = false;
 
-        if ($params && !is_array($params)) {
+        if ($params && gettype($params) != 'array') {
             $params = array($params);
         }
 
-        if (is_array($namespace)) {
-            // Options passed as a hash.
+        if (gettype($namespace) == 'array') {
             foreach ($namespace as $optname => $opt) {
                 $this->_options[strtolower($optname)] = $opt;
+            }
+            if (isset($this->_options['namespace'])) {
+                $namespace = $this->_options['namespace'];
+            } else {
+                $namespace = false;
             }
         } else {
             // We'll place $soapAction into our array for usage in the
             // transport.
-            if ($soapAction) {
-                $this->_options['soapaction'] = $soapAction;
-            }
-            if ($namespace) {
-                $this->_options['namespace'] = $namespace;
-            }
-        }
-        if (isset($this->_options['namespace'])) {
-            $namespace = $this->_options['namespace'];
-        } else {
-            $namespace = false;
+            $this->_options['soapaction'] = $soapAction;
+            $this->_options['namespace'] = $namespace;
         }
 
@@ -573,7 +579,7 @@
                 return $this->_raiseSoapFault($opData);
             }
-            $namespace                    = $opData['namespace'];
-            $this->_options['style']      = $opData['style'];
-            $this->_options['use']        = $opData['input']['use'];
+            $namespace = $opData['namespace'];
+            $this->_options['style'] = $opData['style'];
+            $this->_options['use'] = $opData['input']['use'];
             $this->_options['soapaction'] = $opData['soapAction'];
 
@@ -643,6 +649,5 @@
             $this->docparams = true;
             $mqname = new QName($method, $namespace);
-            $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params,
-                                          array(), $this->_options);
+            $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params);
             $soap_msg = $this->makeEnvelope($methodValue,
                                             $this->headersOut,
@@ -652,5 +657,6 @@
             if (!$params) {
                 $mqname = new QName($method, $namespace);
-                $params = new SOAP_Value($mqname->fqn(), 'Struct', null);
+                $mynull = null;
+                $params = new SOAP_Value($mqname->fqn(), 'Struct', $mynull);
             } elseif ($this->_options['input'] == 'parse') {
                 if (is_array($params)) {
@@ -680,5 +686,5 @@
                                             $this->_options);
         }
-        $this->headersOut = null;
+        unset($this->headersOut);
 
         if (PEAR::isError($soap_msg)) {
@@ -722,4 +728,12 @@
 
     /**
+     * @deprecated Use parseResponse().
+     */
+    function &__parse(&$response, $encoding, &$attachments)
+    {
+        return $this->parseResponse($response, $encoding, $attachments);
+    }
+
+    /**
      * Parses a SOAP response.
      *
@@ -730,33 +744,32 @@
      * @param array $attachments  List of attachments.
      */
-    function parseResponse($response, $encoding, $attachments)
+    function &parseResponse($response, $encoding, &$attachments)
     {
         // Parse the response.
-        $response = new SOAP_Parser($response, $encoding, $attachments);
+        $response =& new SOAP_Parser($response, $encoding, $attachments);
         if ($response->fault) {
-            $fault = $this->_raiseSoapFault($response->fault);
+            $fault =& $this->_raiseSoapFault($response->fault);
             return $fault;
         }
 
         // Return array of parameters.
-        $return = $response->getResponse();
-        $headers = $response->getHeaders();
+        $return =& $response->getResponse();
+        $headers =& $response->getHeaders();
         if ($headers) {
-            $this->headersIn = $this->_decodeResponse($headers, false);
-        }
-
-        $decoded = $this->_decodeResponse($return);
+            $this->headersIn =& $this->_decodeResponse($headers, false);
+        }
+
+        $decoded = &$this->_decodeResponse($return);
         return $decoded;
     }
 
     /**
-     * Converts a complex SOAP_Value into a PHP Array
-     *
-     * @param SOAP_Value $response  Value object.
-     * @param boolean $shift
-     *
-     * @return array
-     */
-    function _decodeResponse($response, $shift = true)
+    *   Converts a complex SOAP_Value into a PHP Array
+    *
+    *   @param SOAP_Value   $response   value object
+    *   @param boolean      $shift      FIXME
+    *   @return Array
+    */
+    function &_decodeResponse($response, $shift = true)
     {
         if (!$response) {
@@ -767,17 +780,17 @@
         // Check for valid response.
         if (PEAR::isError($response)) {
-            $fault = $this->_raiseSoapFault($response);
+            $fault =& $this->_raiseSoapFault($response);
             return $fault;
         } elseif (!is_a($response, 'soap_value')) {
-            $fault = $this->_raiseSoapFault("Didn't get SOAP_Value object back from client");
+            $fault =& $this->_raiseSoapFault("Didn't get SOAP_Value object back from client");
             return $fault;
         }
 
         // Decode to native php datatype.
-        $returnArray = $this->_decode($response);
+        $returnArray =& $this->_decode($response);
 
         // Fault?
         if (PEAR::isError($returnArray)) {
-            $fault = $this->_raiseSoapFault($returnArray);
+            $fault =& $this->_raiseSoapFault($returnArray);
             return $fault;
         }
@@ -787,8 +800,7 @@
             $returnArray = get_object_vars($returnArray);
         }
-
         if (is_array($returnArray)) {
             if (isset($returnArray['faultcode']) ||
-                isset($returnArray[SOAP_BASE::SOAPENVPrefix().':faultcode'])) {
+                isset($returnArray['SOAP-ENV:faultcode'])) {
                 $faultcode = $faultstring = $faultdetail = $faultactor = '';
                 foreach ($returnArray as $k => $v) {
@@ -798,6 +810,5 @@
                     if (stristr($k, 'faultactor')) $faultactor = $v;
                 }
-                $fault = $this->_raiseSoapFault($faultstring, $faultdetail,
-                                                $faultactor, $faultcode);
+                $fault =& $this->_raiseSoapFault($faultstring, $faultdetail, $faultactor, $faultcode);
                 return $fault;
             }
@@ -809,6 +820,13 @@
             return $returnArray;
         }
-
         return $returnArray;
+    }
+
+    /**
+     * @deprecated Use getWire().
+     */
+    function __get_wire()
+    {
+        return $this->getWire();
     }
 
Index: branches/version-2_11-dev/data/module/SOAP/Server/Email.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Server/Email.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Server/Email.php	(revision 21410)
@@ -20,5 +20,4 @@
  */
 
-/** SOAP_Server */
 require_once 'SOAP/Server.php';
 require_once 'SOAP/Client.php';
Index: branches/version-2_11-dev/data/module/SOAP/Server/Email_Gateway.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Server/Email_Gateway.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Server/Email_Gateway.php	(revision 21410)
@@ -20,5 +20,4 @@
  */
 
-/** SOAP_Server_Email */
 require_once 'SOAP/Server/Email.php';
 require_once 'SOAP/Transport.php';
Index: branches/version-2_11-dev/data/module/SOAP/Disco.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Disco.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Disco.php	(revision 21410)
@@ -23,10 +23,6 @@
  */
 
-/** SOAP_Base */
 require_once 'SOAP/Base.php';
 
-/**
- * @package SOAP
- */
 class SOAP_DISCO_Server extends SOAP_Base_Object {
 
@@ -95,5 +91,5 @@
             $this->namespaces[$this->_service_ns] = 'tns';
             $this->namespaces[$flipped['xsd']] = 'xsd';
-            $this->namespaces[$flipped[SOAP_BASE::SOAPENCPrefix()]] = SOAP_BASE::SOAPENCPrefix();
+            $this->namespaces[$flipped['SOAP-ENC']] = 'SOAP-ENC';
         }
 
@@ -213,8 +209,8 @@
                     } else {
                         $ctype['complexContent']['attr'] = '';
-                        $ctype['complexContent']['restriction']['attr']['base'] = SOAP_BASE::SOAPENCPrefix().':Array';
+                        $ctype['complexContent']['restriction']['attr']['base'] = 'SOAP-ENC:Array';
                         foreach ($_vartype as $array_type) {
                             list($_vartypens, $_vartype) = $this->_getTypeNs($array_type);
-                            $ctype['complexContent']['restriction']['attribute']['attr']['ref'] = SOAP_BASE::SOAPENCPrefix().':arrayType';
+                            $ctype['complexContent']['restriction']['attribute']['attr']['ref'] = 'SOAP-ENC:arrayType';
                             $ctype['complexContent']['restriction']['attribute']['attr']['wsdl:arrayType'] = $_vartypens . ':' . $_vartype . '[]';
                         }
Index: branches/version-2_11-dev/data/module/SOAP/example/stockquote.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/stockquote.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/stockquote.php	(revision 21410)
@@ -1,52 +1,54 @@
 <html><body>
 <?
-/**
- * Stockquote client.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
+// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author         |
+// +----------------------------------------------------------------------+
+//
+// $Id: stockquote.php,v 1.7 2005/03/10 23:16:40 yunosh Exp $
+//
+// include soap client class
+include("SOAP/Client.php");
 
-/* Include SOAP_Client class. */
-require_once 'SOAP/Client.php';
-
-echo '<br><strong>wsdl:</strong>';
-$wsdl = new SOAP_WSDL('http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl');
+print "<br>\n<strong>wsdl:</strong>";
+$wsdl = new SOAP_WSDL("http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl");
 $soapclient = $wsdl->getProxy();
-$ret = $soapclient->call('getQuote', array('symbol' => 'ibm'));
-print_r($ret);
+print_r($soapclient->getQuote("ibm"));
+print "\n\n";
 
 if (extension_loaded('overload')) {
-	echo '<br><strong>overloaded:</strong>';
-	$ret = $soapclient->getQuote('ibm');
+	print "\n<br><strong>overloaded:</strong>";
+	$ret = $soapclient->getQuote("ibm");
 	print_r($ret);
+	print "\n\n";
 }
+unset($soapclient);
 
-echo '<br><strong>non wsdl:</strong>';
-$soapclient = new SOAP_Client('http://services.xmethods.net:80/soap');
-$namespace = 'urn:xmethods-delayed-quotes';
-/* Some SOAP servers require a Soapaction HTTP header.  PEAR::SOAP does not
- * use them in any way, other to send them if you supply them.  soapaction is
- * deprecated in later SOAP versions. */
-$soapaction = 'urn:xmethods-delayed-quotes#getQuote';
-$ret = $soapclient->call('getQuote',
-                         array('symbol' => 'ibm'),
-                         $namespace,
-                         $soapaction);
+print "\n<br><strong>non wsdl:</strong>";
+$soapclient = new SOAP_Client("http://services.xmethods.net:80/soap");
+$namespace = "urn:xmethods-delayed-quotes";
+/**
+ * some soap servers require a Soapaction http header.  PEAR::SOAP does
+ * not use them in any way, other to send them if you supply them.
+ * soapaction is deprecated in later SOAP versions.
+ */
+$soapaction = "urn:xmethods-delayed-quotes#getQuote";
+$ret = $soapclient->call("getQuote",array("symbol"=>"ibm"),$namespace,$soapaction);
 print_r($ret);
+print "\n\n";
+unset($soapclient);
 
 ?>
Index: branches/version-2_11-dev/data/module/SOAP/example/server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/server.php	(revision 21410)
@@ -1,59 +1,49 @@
 <?php
-/**
- * Server endpoint.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: server.php,v 1.10 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* If you want to implement Basic HTTP Authentication, uncomment the following
- * lines of code. */
-// if (!isset($_SERVER['PHP_AUTH_USER']) ||
-//     !isset($_SERVER['PHP_AUTH_PW']) ||
-//     $_SERVER['PHP_AUTH_USER'] !== 'username' ||
-//     $_SERVER['PHP_AUTH_PW'] !== 'password') {
-//     header('WWW-Authenticate: Basic realm="My Realm"');
-//     header('HTTP/1.0 401 Unauthorized');
-//     echo 'Not authorized!';
-//     exit;
-// }
+// first, include the SOAP/Server class
+require_once 'SOAP/Server.php';
 
-/* First, include the SOAP_Server class. */
-require_once 'SOAP/Server.php';
 $server = new SOAP_Server;
-
-/* Tell server to translate to classes we provide if possible. */
+/* tell server to translate to classes we provide if possible */
 $server->_auto_translation = true;
 
-require_once dirname(__FILE__) . '/example_server.php';
+require_once 'example_server.php';
+
 $soapclass = new SOAP_Example_Server();
-$server->addObjectMap($soapclass, 'urn:SOAP_Example_Server');
+$server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
 
 if (isset($_SERVER['REQUEST_METHOD']) &&
-    $_SERVER['REQUEST_METHOD'] == 'POST') {
+    $_SERVER['REQUEST_METHOD']=='POST') {
     $server->service($HTTP_RAW_POST_DATA);
 } else {
     require_once 'SOAP/Disco.php';
-    $disco = new SOAP_DISCO_Server($server, 'ServerExample');
-    header('Content-type: text/xml');
+    $disco = new SOAP_DISCO_Server($server,'ServerExample');
+    header("Content-type: text/xml");
     if (isset($_SERVER['QUERY_STRING']) &&
-        strpos($_SERVER['QUERY_STRING'], 'wsdl') !== false) {
+       strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
         echo $disco->getWSDL();
     } else {
         echo $disco->getDISCO();
     }
+    exit;
 }
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/wsdl_client.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/wsdl_client.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/wsdl_client.php	(revision 21410)
@@ -1,79 +1,83 @@
 <?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: wsdl_client.php,v 1.5 2007/01/22 11:33:27 yunosh Exp $
+//
+include("SOAP/Client.php");
+
 /**
- * WSDL client.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
+ * this client runs against the example server in SOAP/example/server.php
+ * it does not use WSDL to run these requests, but that can be changed easily by simply
+ * adding '?wsdl' to the end of the url.
  */
-
-require_once 'SOAP/Client.php';
-
-/* This client runs against the example server in SOAP/example/server.php.  It
- * does not use WSDL to run these requests, but that can be changed easily by
- * simply adding '?wsdl' to the end of the url. */
-$wsdl = new SOAP_WSDL('http://localhost/SOAP/example/server.php?wsdl');
+$wsdl = new SOAP_WSDL("http://localhost/SOAP/example/server.php?wsdl");
 $soapclient = $wsdl->getProxy();
 
-$ret = $soapclient->echoStringSimple('this is a test string');
-// echo $soapclient->getWire();
-print_r($ret);
+$ret = $soapclient->echoStringSimple("this is a test string");
+//print $soapclient->getWire();
+print_r($ret);echo "<br>\n";
 
-$ret = $soapclient->echoString('this is a test string');
-print_r($ret);
+$ret = $soapclient->echoString("this is a test string");
+print_r($ret);echo "<br>\n";
 
-$ret = $soapclient->divide(22, 7);
-// echo $soapclient->getWire();
-if (is_a($ret, 'PEAR_Error')) {
-    echo 'Error: ' . $ret->getMessage() . "\n";
-} else {
-    echo 'Quotient is ' . $ret . "\n";
-}
+$ret = $soapclient->divide(22,7);
+// print $soapclient->getWire();
+if (PEAR::isError($ret))
+    print("Error: " . $ret->getMessage() . "<br>\n");
+else
+    print("Quotient is " . $ret . "<br>\n");
 
-$ret = $soapclient->divide(22, 0);
-if (is_a($ret, 'PEAR_Error')) {
-    echo 'Error: ' . $ret->getMessage() . "\n";
-} else {
-    echo 'Quotient is ' . $ret . "\n";
-}
+$ret = $soapclient->divide(22,0);
+if (PEAR::isError($ret))
+    print("Error: " . $ret->getMessage() . "<br>\n");
+else
+    print("Quotient is " . $ret . "<br>\n");
 
-/* SOAPStruct is defined in the following file. */
-require_once './example_types.php';
-$struct = new SOAPStruct('test string', 123, 123.123);
 
-/* Tell the client to translate to classes we provide if possible.
- * You can explicitly set the translation for a specific class.
+// SOAPStruct is defined in the following file
+require_once 'example_types.php';
+
+$struct = new SOAPStruct('test string',123,123.123);
+
+/* Send an object, get an object back.
+ * Tell the client to translate to classes we provide if possible. */
+$soapclient->_auto_translation = true;
+/* Or you can explicitly set the translation for a specific class.
  * auto_translation works for all cases, but opens ANY class in the script to
- * be used as a data type, and may not be desireable.  Both can be used on
+ * be used as a data type, and may not be desireable.  both can be used on
  * client or server. */
-$soapclient->_auto_translation = true;
-
 $soapclient->setTypeTranslation('{http://soapinterop.org/xsd}SOAPStruct',
                                 'SOAPStruct');
 $ret = $soapclient->echoStruct($struct->__to_soap());
-// echo $soapclient->getWire();
+//print $soapclient->getWire();
 print_r($ret);
 
-/* PHP doesn't support multiple OUT parameters in function calls, so we must
+/**
+ * PHP doesn't support multiple OUT parameters in function calls, so we must
  * do a little work to make it happen here.  This requires knowledge on the
- * developers part to figure out how they want to deal with it. */
+ * developers part to figure out how they want to deal with it.
+ */
 $ret = $soapclient->echoStructAsSimpleTypes($struct->__to_soap());
-if (is_a($ret, 'PEAR_Error')) {
-    echo 'Error: ' . $ret->getMessage() . "\n";
+if (PEAR::isError($ret)) {
+    print("Error: " . $ret->getMessage() . "<br>\n");
 } else {
     list($string, $int, $float) = array_values($ret);
 }
-echo "varString: $string\nvarInt: $int\nvarFloat: $float\n";
+echo "varString: $string<br>\nvarInt: $int<br>\nvarFloat: $float<br>\n";
+
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/email_gateway.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/email_gateway.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/email_gateway.php	(revision 21410)
@@ -1,46 +1,48 @@
 <?php
-/**
- * This reads a message from stdin, and passes the request to a SOAP server
- * residing on a web server, sends the response out as an email. You can use
- * this from qmail by creating a .qmail-soapgateway file with:
- * <code>
- * | /usr/bin/php /path/to/email_server.php
- * </code>
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
+// +----------------------------------------------------------------------+
+//
+// $Id: email_gateway.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* SOAP_Server_Email_Gateway */
+/*
+This reads a message from stdin, and passes the request to
+a soap server residing on a web server, sends the response
+out as an email
+
+You can use this from qmail by creating a .qmail-soapgateway file with:
+    | /usr/bin/php /path/to/email_server.php
+*/
+
+# include the email server class
 require_once 'SOAP/Server/Email_Gateway.php';
 
-/* Read stdin. */
-$fin = fopen('php://stdin', 'rb');
-if (!$fin) {
-    exit(1);
-}
+# read stdin
+$fin = fopen('php://stdin','rb');
+if (!$fin) exit(0);
 
 $email = '';
 while (!feof($fin) && $data = fread($fin, 8096)) {
-    $email .= $data;
+  $email .= $data;
 }
 
 fclose($fin);
 
-/* Do it! */
+# doit!
 $server = new SOAP_Server_Email_Gateway();
 $server->service($data, 'http://localhost/soap/example/server.php');
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/tcp_server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/tcp_server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/tcp_server.php	(revision 21410)
@@ -1,34 +1,35 @@
 <?php
-/**
- * TCP server.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: tcp_server.php,v 1.4 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* First, include the SOAP_Server_TCP class. */
+// first, include the SOAP/Server class
+require_once 'SOAP/Server/TCP.php';
 set_time_limit(0);
-require_once 'SOAP/Server/TCP.php';
-$server = new SOAP_Server_TCP('127.0.0.1', 82);
 
-/* Tell the server to translate to classes we provide if possible. */
+$server = new SOAP_Server_TCP("127.0.0.1",82);
+/* tell server to translate to classes we provide if possible */
 $server->_auto_translation = true;
 
-require_once dirname(__FILE__) . '/example_server.php';
+require_once 'example_server.php';
+
 $soapclass = new SOAP_Example_Server();
-$server->addObjectMap($soapclass, 'urn:SOAP_Example_Server');
+$server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
 $server->run();
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/com_client.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/com_client.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/com_client.php	(revision 21410)
@@ -1,28 +1,24 @@
 <?php
-/**
- * This file contains an example SOAP client based on the Windows
- * MSSOAP.SoapClient30 COM object that calls methods on the example SOAP
- * server in this same directory.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
-
-/** SOAPStruct */
-require_once './example_types.php';
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: com_client.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $
+//
+// SOAPStruct is defined in the following file
+require_once 'example_types.php';
 
 /* just a simple example of using MS SOAP on win32 as a client
Index: branches/version-2_11-dev/data/module/SOAP/example/email_server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/email_server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/email_server.php	(revision 21410)
@@ -1,53 +1,56 @@
 <?php
-/**
- * This reads a message from stdin, and calls the SOAP server defined.
- * 
- * You can use this from qmail by creating a .qmail-soaptest file with:
- * <code>
- * | /usr/bin/php /path/to/email_server.php
- * </code>
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
+// +----------------------------------------------------------------------+
+//
+// $Id: email_server.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* SOAP_Server_Email */
+/*
+This reads a message from stdin, and calls the soap server defined
+
+You can use this from qmail by creating a .qmail-soaptest file with:
+    | /usr/bin/php /path/to/email_server.php
+*/
+
+# include the email server class
 require_once 'SOAP/Server/Email.php';
+
 $server = new SOAP_Server_Email;
 
-/* Tell the server to translate to classes we provide if possible. */
+/* tell server to translate to classes we provide if possible */
 $server->_auto_translation = true;
 
-require_once './example_server.php';
+require_once 'example_server.php';
+
 $soapclass = new SOAP_Example_Server();
 $server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
 
-/* Read stdin. */
-$fin = fopen('php://stdin', 'rb');
-if (!$fin) {
-    exit(1);
-}
+# read stdin
+$fin = fopen('php://stdin','rb');
+if (!$fin) exit(0);
 
 $email = '';
 while (!feof($fin) && $data = fread($fin, 8096)) {
-    $email .= $data;
+  $email .= $data;
 }
 
 fclose($fin);
 
-/* Do it! */
+# doit!
 $server->service($email);
+
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/client.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/client.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/client.php	(revision 21410)
@@ -16,77 +16,57 @@
  * @package    SOAP
  * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
+ * @copyright  2003-2005 The PHP Group
  * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
  * @link       http://pear.php.net/package/SOAP
  */
 
-/** SOAP_Client */
 require 'SOAP/Client.php';
 
-/* This client runs against the example server in SOAP/example/server.php.  It
+/**
+ * This client runs against the example server in SOAP/example/server.php.  It
  * does not use WSDL to run these requests, but that can be changed easily by
- * simply adding '?wsdl' to the end of the url. */
+ * simply adding '?wsdl' to the end of the url.
+ */
 $soapclient = new SOAP_Client('http://localhost/SOAP/example/server.php');
+// This namespace is the same as declared in server.php.
+$options = array('namespace' => 'urn:SOAP_Example_Server',
+                 'trace' => true);
 
-/* Set a few options. */
-$options = array();
+$ret = $soapclient->call('echoStringSimple',
+                         $params = array('inputStringSimple' => 'this is a test string'),
+                         $options);
+// print $soapclient->getWire();
+print_r($ret);
+echo "<br>\n";
 
-/* This namespace is the same as declared in server.php. */
-$options['namespace'] = 'urn:SOAP_Example_Server';
+$ret = $soapclient->call('echoString',
+                         $params = array('inputString' => 'this is a test string'),
+                         $options);
+print_r($ret);
+echo "<br>\n";
 
-/* Trace the communication for debugging purposes, so we can later inspect the
- * data with getWire(). */
-$options['trace'] = true;
+$ret = $soapclient->call('divide',
+                         $params = array('dividend' => 22, 'divisor' => 7),
+                         $options);
+// print $soapclient->getWire();
+if (PEAR::isError($ret)) {
+    echo 'Error: ' . $ret->getMessage() . "<br>\n";
+} else {
+    echo 'Quotient is ' . $ret . "<br>\n";
+}
 
-/* Uncomment the following lines if you want to use Basic HTTP
- * Authentication. */
-// $options['user'] = 'username';
-// $options['pass'] = 'password';
+$ret = $soapclient->call('divide',
+                         $params = array('dividend' => 22, 'divisor' => 0),
+                         $options);
+if (PEAR::isError($ret)) {
+    echo 'Error: ' . $ret->getMessage() . "<br>\n";
+} else {
+    echo 'Quotient is ' . $ret . "<br>\n";
+}
 
-header('Content-Type: text/plain');
 
-/* Calling echoStringSimple. */
-$ret = $soapclient->call('echoStringSimple',
-                         array('inputStringSimple' => 'this is a test string'),
-                         $options);
-// echo $soapclient->getWire();
-print_r($ret);
-echo "\n";
+// SOAPStruct is defined in the following file.
+require_once 'example_types.php';
 
-/* Calling echoString. */
-$ret = $soapclient->call('echoString',
-                         array('inputString' => 'this is a test string'),
-                         $options);
-// echo $soapclient->getWire();
-print_r($ret);
-echo "\n";
-
-/* Calling divide with valid parameters. */
-$ret = $soapclient->call('divide',
-                         array('dividend' => 22, 'divisor' => 7),
-                         $options);
-// echo $soapclient->getWire();
-if (PEAR::isError($ret)) {
-    echo 'Error: ' . $ret->getMessage();
-} else {
-    echo 'Quotient is ' . $ret;
-}
-echo "\n";
-
-/* Calling divide with invalid parameters. */
-$ret = $soapclient->call('divide',
-                         array('dividend' => 22, 'divisor' => 0),
-                         $options);
-// echo $soapclient->getWire();
-if (PEAR::isError($ret)) {
-    echo 'Error: ' . $ret->getMessage();
-} else {
-    echo 'Quotient is ' . $ret;
-}
-echo "\n";
-
-/* The SOAPStruct class is defined in example_types.php. */
-require_once 'example_types.php';
 $struct = new SOAPStruct('test string', 123, 123.123);
 
@@ -94,5 +74,4 @@
  * we provide if possible. */
 $soapclient->_auto_translation = true;
-
 /* You can explicitly set the translation for a specific
  * class. auto_translation works for all cases, but opens ANY class in the
@@ -101,37 +80,22 @@
 $soapclient->setTypeTranslation('{http://soapinterop.org/xsd}SOAPStruct',
                                 'SOAPStruct');
-
-/* Calling echoStruct. */
 $ret = $soapclient->call('echoStruct',
-                         array('inputStruct' => $struct->__to_soap()),
+                         $p = array('inputStruct' => $struct->__to_soap()),
                          $options);
-// echo $soapclient->getWire();
+// print $soapclient->getWire();
 print_r($ret);
 
-/* Calling echoStructAsSimpleTypes.
- * PHP doesn't support multiple return values in function calls, so we must do
- * a little work to make it happen here, for example returning an array
- * instead.  This requires knowledge on the developers part to figure out how
- * they want to deal with it. */
+/**
+ * PHP doesn't support multiple OUT parameters in function calls, so we must
+ * do a little work to make it happen here.  This requires knowledge on the
+ * developers part to figure out how they want to deal with it.
+ */
 $ret = $soapclient->call('echoStructAsSimpleTypes',
-                         array('inputStruct' => $struct->__to_soap()),
+                         $p = array('inputStruct' => $struct->__to_soap()),
                          $options);
-// echo $soapclient->getWire();
 if (PEAR::isError($ret)) {
-    echo 'Error: ' . $ret->getMessage();
+    echo 'Error: ' . $ret->getMessage() . "<br>\n";
 } else {
     list($string, $int, $float) = array_values($ret);
-    echo "varString: $string\nvarInt: $int\nvarFloat: $float";
+    echo "varString: $string<br>\nvarInt: $int<br>\nvarFloat: $float<br>\n";
 }
-echo "\n";
-
-/* Calling echoMimeAttachment.
- * We want to use MIME encoding here, the default is to use DIME encoding. */
-$options['attachments'] = 'Mime';
-$attachment = new SOAP_Attachment('attachment', 'text/plain', null,
-                                  'This is a MIME attachment');
-$ret = $soapclient->call('echoMimeAttachment',
-                         array($attachment),
-                         $options);
-// echo $soapclient->getWire();
-print_r($ret);
Index: branches/version-2_11-dev/data/module/SOAP/example/example_types.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/example_types.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/example_types.php	(revision 21410)
@@ -11,7 +11,4 @@
  * it from your soap server class, echoStruct in the server class is an
  * example of doing this.
- *
- * @category Web Services
- * @package  SOAP
  */
 class SOAPStruct
@@ -33,23 +30,15 @@
                         $actor = 'http://schemas.xmlsoap.org/soap/actor/next')
     {
-        $inner = array(
-            new SOAP_Value('varString', 'string', $this->varString),
-            new SOAP_Value('varInt', 'int', $this->varInt),
-            new SOAP_Value('varFloat', 'float', $this->varFloat));
+        $inner[] = new SOAP_Value('varString', 'string', $this->varString);
+        $inner[] = new SOAP_Value('varInt', 'int', $this->varInt);
+        $inner[] = new SOAP_Value('varFloat', 'float', $this->varFloat);
 
         if ($header) {
-            $value = new SOAP_Header($name,
-                                     '{http://soapinterop.org/xsd}SOAPStruct',
-                                     $inner,
-                                     $mustUnderstand,
-                                     $actor);
+            $value = new SOAP_Header($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner,$mustUnderstand,$actor);
         } else {
-            $value = new SOAP_Value($name,
-                                    '{http://soapinterop.org/xsd}SOAPStruct',
-                                    $inner);
+            $value = new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner);
         }
 
         return $value;
     }
-
 }
Index: branches/version-2_11-dev/data/module/SOAP/example/example_server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/example_server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/example_server.php	(revision 21410)
@@ -1,116 +1,123 @@
 <?php
-/**
- * Example server.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: example_server.php,v 1.6 2007/01/22 11:51:45 yunosh Exp $
+//
 
-/** SOAP_Value */
+// first, include the SOAP/Server class
 require_once 'SOAP/Value.php';
 require_once 'SOAP/Fault.php';
 
-/** SOAPStruct */
-require_once dirname(__FILE__) . '/example_types.php';
+// SOAPStruct is defined in the following file
+require_once 'example_types.php';
 
-/* Create a class for your SOAP functions. */
+// create a class for your soap functions
 class SOAP_Example_Server {
-    /* The dispatch map does not need to be used, but aids the server class in
-     * knowing what parameters are used with the functions.  This is the ONLY
-     * way to have multiple OUT parameters.  If you use a dispatch map, you
-     * MUST add ALL functions you wish to allow be called.  If you do not use
-     * a dispatch map, then any public function can be called from SOAP. We
-     * consider this to be any function in the class unless it starts with
-     * underscore.  If you do not define in/out parameters, the function can
-     * be called with parameters, but no validation on parameters will
-     * occur. */
+    /**
+     * The dispactch map does not need to be used, but aids
+     * the server class in knowing what parameters are used
+     * with the functions.  This is the ONLY way to have
+     * multiple OUT parameters.  If you use a dispatch map, you
+     * MUST add ALL functions you wish to allow be called.  If
+     * you do not use a dispatch map, then any public function
+     * can be called from soap (in php4, we consider this to be
+     * any function in the class unless it starts with underscore,
+     * php5 support is not complete yet in this regard).  
+     * if you do not define in/out parameters, the function can be
+     * called with parameters, but no validation on parameters will
+     * occure.
+     */
     var $__dispatch_map = array();
 
     function SOAP_Example_Server() {
-        /* When generating WSDL for a server, you have to define any special
-         * complex types that you use (ie classes).  Using a namespace id
-         * before the type will create an XML schema with the targetNamespace
-         * for the type multiple types with the same namespace will appear in
-         * the same schema section.  Types with different namespaces will be
-         * in seperate schema sections.  The following SOAPStruct typedef
-         * cooresponds to the SOAPStruct class above. */
-        $this->__typedef['{http://soapinterop.org/xsd}SOAPStruct'] =
-            array('varString' => 'string',
-                  'varInt' => 'int',
-                  'varFloat' => 'float');
+        /**
+        * when generating wsdl for a server, you have to define
+        * any special complex types that you use (ie classes).
+        * using a namespace id before the type will create an
+        * xml schema with the targetNamespace for the type
+        * multiple types with the same namespace will appear
+        * in the same schema section.  types with different
+        * namespaces will be in seperate schema sections.
+        * the following SOAPStruct typedef cooresponds to the
+        * SOAPStruct class above.
+        */
+        $this->__typedef['{http://soapinterop.org/xsd}SOAPStruct'] = 
+                    array(
+                        'varString' => 'string',
+                        'varInt' => 'int', 
+                        'varFloat' => 'float'
+                         );
 
-        /* An aliased function with multiple out parameters. */
-        $this->__dispatch_map['echoStructAsSimpleTypes'] =
-            array('in' => array('inputStruct' => '{http://soapinterop.org/xsd}SOAPStruct'),
-                  'out' => array('outputString' => 'string',
-                                 'outputInteger' => 'int',
-                                 'outputFloat' => 'float'),
-                  'alias' => 'myEchoStructAsSimpleTypes');
-        $this->__dispatch_map['echoStringSimple'] =
-            array('in' => array('inputStringSimple' => 'string'),
-                  'out' => array('outputStringSimple' => 'string'));
-        $this->__dispatch_map['echoString'] =
-            array('in' => array('inputString' => 'string'),
-                  'out' => array('outputString' => 'string'));
-        $this->__dispatch_map['divide'] =
-            array('in' => array('dividend' => 'int',
-                                'divisor' => 'int'),
-                  'out' => array('outputFloat' => 'float'));
-        $this->__dispatch_map['echoStruct'] =
-            array('in' => array('inputStruct' => '{http://soapinterop.org/xsd}SOAPStruct'),
-                  'out' => array('outputStruct' => '{http://soapinterop.org/xsd}SOAPStruct'));
-
-        $this->__dispatch_map['echoMimeAttachment'] =
-            array('in' => array('stuff' => 'string'),
-                  'out' => array('outputMime' => 'string'));
+        // an aliased function with multiple out parameters
+	$this->__dispatch_map['echoStructAsSimpleTypes'] =
+		array('in' => array('inputStruct' => '{http://soapinterop.org/xsd}SOAPStruct'),
+		      'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float'),
+		      'alias' => 'myEchoStructAsSimpleTypes'
+		      );
+	$this->__dispatch_map['echoStringSimple'] =
+		array('in' => array('inputStringSimple' => 'string'),
+		      'out' => array('outputStringSimple' => 'string'),
+		      );
+	$this->__dispatch_map['echoString'] =
+		array('in' => array('inputString' => 'string'),
+		      'out' => array('outputString' => 'string'),
+		      );
+	$this->__dispatch_map['divide'] =
+		array('in' => array('dividend' => 'int', 'divisor' => 'int'),
+		      'out' => array('outputFloat' => 'float'),
+		      );
+	$this->__dispatch_map['echoStruct'] =
+		array('in' => array('inputStruct' => '{http://soapinterop.org/xsd}SOAPStruct'),
+		      'out' => array('outputStruct' => '{http://soapinterop.org/xsd}SOAPStruct'),
+		      );
+	
+	$this->__dispatch_map['echoMimeAttachment'] = array();
     }
 
-    /* This private function is called on by SOAP_Server to determine any
-     * special dispatch information that might be necessary.  This, for
-     * example, can be used to set up a dispatch map for functions that return
-     * multiple OUT parameters. */
-    function __dispatch($methodname)
-    {
-        if (isset($this->__dispatch_map[$methodname])) {
+    /* this private function is called on by SOAP_Server to determine any
+        special dispatch information that might be necessary.  This, for example,
+        can be used to set up a dispatch map for functions that return multiple
+        OUT parameters */
+    function __dispatch($methodname) {
+        if (isset($this->__dispatch_map[$methodname]))
             return $this->__dispatch_map[$methodname];
-        }
-        return null;
+        return NULL;
     }
 
-    /* A simple echoString function. */
+    // a simple echoString function
     function echoStringSimple($inputString)
     {
-        return $inputString;
+	return $inputString;
     }
-
-    /* An explicit echoString function. */
+    
+    // an explicit echostring function
     function echoString($inputString)
     {
-        return new SOAP_Value('outputString', 'string', $inputString);
+	return new SOAP_Value('outputString','string',$inputString);
     }
 
     function divide($dividend, $divisor)
     {
-        /* The SOAP server would normally catch errors like this and return a
-         * fault, but this is how you do it yourself. */
-        if ($divisor == 0) {
+        // the soap server would normally catch errors like this
+        // and return a fault, but this is how you do it yourself.
+        if ($divisor == 0)
             return new SOAP_Fault('You cannot divide by zero', 'Client');
-        } else {
+        else
             return $dividend / $divisor;
-        }
     }
 
@@ -119,37 +126,36 @@
         return $inputStruct->__to_soap('outputStruct');
     }
-
+    
     /**
-     * Takes a SOAPStruct as input, and returns each of its elements as OUT
-     * parameters.
+     * echoStructAsSimpleTypes
+     * takes a SOAPStruct as input, and returns each of its elements
+     * as OUT parameters
      *
-     * This function is also aliased so you have to call it as
-     * echoStructAsSimpleTypes.
+     * this function is also aliased so you have to call it with
+     * echoStructAsSimpleTypes
      *
      * SOAPStruct is defined as:
-     * <code>
+     *
      * struct SOAPStruct:
      *    string varString
      *    integer varInt
      *    float varFloat
-     * </code>
+     *
      */
     function myEchoStructAsSimpleTypes($struct)
     {
-        /* Convert a SOAPStruct to an array. */
-        return array(
-            new SOAP_Value('outputString', 'string', $struct->varString),
-            new SOAP_Value('outputInteger', 'int', $struct->varInt),
-            new SOAP_Value('outputFloat', 'float', $struct->varFloat)
+	# convert a SOAPStruct to an array
+	return array(
+	    new SOAP_Value('outputString','string',$struct->varString),
+	    new SOAP_Value('outputInteger','int',$struct->varInt),
+	    new SOAP_Value('outputFloat','float',$struct->varFloat)
 	    );
     }
-
+    
     function echoMimeAttachment($stuff)
     {
-        return new SOAP_Attachment('return',
-                                   'application/octet-stream',
-                                   null,
-                                   $stuff);
-    }
+        return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
+    }    
+}
 
-}
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/smtp.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/smtp.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/smtp.php	(revision 21410)
@@ -1,40 +1,32 @@
 <?
-/**
- * SMTP client.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: smtp.php,v 1.5 2005/03/10 23:16:40 yunosh Exp $
+//
+// include soap client class
+include("SOAP/Client.php");
 
-/* Include SOAP_Client class. */
-require_once 'SOAP/Client.php';
-$soapclient = new SOAP_Client('mailto:user@domain.com');
+$soapclient = new SOAP_Client("mailto:user@domain.com");
+$options = array('namespace'=>'http://soapinterop.org/','from'=>'user@domain.com','host'=>'localhost');
+$return = $soapclient->call("echoString",array("inputString"=>"this is a test"), $options);
+$return = $soapclient->call("echoStringArray",array('inputStringArray' => array('good','bad','ugly')), $options);
+// don't expect much of a result!
+print_r($return);
+print "<br>\n".$soapclient->wire;
+?>
 
-$options = array('namespace' => 'http://soapinterop.org/',
-                 'from' => 'user@domain.com',
-                 'host' => 'localhost');
-$return = $soapclient->call('echoString',
-                            array('inputString' => 'this is a test'),
-                            $options);
-$return = $soapclient->call('echoStringArray',
-                            array('inputStringArray' => array('good', 'bad', 'ugly')),
-                            $options);
-
-/* Don't expect much of a result! */
-print_r($return);
-echo $soapclient->wire;
-
Index: branches/version-2_11-dev/data/module/SOAP/example/tcp_client.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/tcp_client.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/tcp_client.php	(revision 21410)
@@ -1,41 +1,42 @@
 <?php
-/**
- * TCP client.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Hanna <iordy_at_iordy_dot_com>                        |
+// +----------------------------------------------------------------------+
+//
+// $Id: tcp_client.php,v 1.5 2007/01/22 11:33:27 yunosh Exp $
+//
 
-require_once 'SOAP/Client.php';
+require_once('SOAP/Client.php');
 
-/* Client. */
-$soapclient = new SOAP_Client('tcp://127.0.0.1:82');
+// client
+$soapclient = new SOAP_Client("tcp://127.0.0.1:82");
 
-/* Namespace. */
+// namespace
 $options = array('namespace' => 'urn:SOAP_Example_Server', 'trace' => true);
 
-/* One. */
-$params = array('string' => 'this is string 1');
-$ret1 = $soapclient->call('echoString', $params, $options);
-echo "WIRE: \n" . $soapclient->getWire();
+// one
+$params = array("string" => "this is string 1");
+$ret1 = $soapclient->call("echoString", $params, $options);
+// echo "WIRE: \n".$soapclient->getWire();
 print_r($ret1);
+echo "<br />\n";
 
-/* Two. */
-$params = array('string' => 'this is string 2');
-$ret2 = $soapclient->call('echoString', $params, $options);
-echo "WIRE: \n" . $soapclient->getWire();
+// two
+$params = array("string" => "this is string 2");
+$ret2 = $soapclient->call("echoString", $params, $options);
+// echo "WIRE: \n".$soapclient->getWire();
 print_r($ret2);
+echo "<br />\n";
Index: branches/version-2_11-dev/data/module/SOAP/example/email_client.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/email_client.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/email_client.php	(revision 21410)
@@ -1,46 +1,50 @@
 <?php
-/**
- * This reads a message from stdin, and calls the SOAP server defined. You can
- * use this from qmail by creating a .qmail-soaptest file with:
- * <code>
- * | /usr/bin/php /path/to/email_server.php
- * </code>
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
+// +----------------------------------------------------------------------+
+//
+// $Id: email_client.php,v 1.4 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/** SOAP_Server_Email */
+/*
+This reads a message from stdin, and calls the soap server defined
+
+You can use this from qmail by creating a .qmail-soaptest file with:
+    | /usr/bin/php /path/to/email_server.php
+*/
+
+# include the email server class
 require_once 'SOAP/Server/Email.php';
+
 $server = new SOAP_Server_Email;
 
-/* Read stdin. */
-$fin = fopen('php://stdin', 'rb');
-if (!$fin) {
-    exit(1);
-}
+# read stdin
+$fin = fopen('php://stdin','rb');
+if (!$fin) exit(0);
 
 $email = '';
 while (!feof($fin) && $data = fread($fin, 8096)) {
-    $email .= $data;
+  $email .= $data;
 }
 
 fclose($fin);
 
+
 $response = $server->client($email);
 
 print_r($response);
+
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/email_pop_gateway.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/email_pop_gateway.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/email_pop_gateway.php	(revision 21410)
@@ -1,61 +1,70 @@
 <?php
-/**
- * POP3 gateway.
- *
- * PHP versions 4 and 5
- *
- * license: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
+// +----------------------------------------------------------------------+
+//
+// $Id: email_pop_gateway.php,v 1.6 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* SOAP_Server_Email_Gateway */
+/* include the Email server class, which knows how to
+   parse a standard email as a soap message */
+
 require_once 'SOAP/Server/Email_Gateway.php';
 
-/* Include a class to access POP3. */
+/* include a class to access POP3 */
+
 require_once 'Net/POP3.php';
 
-/* Create the SOAP Server object. */
+/* create the SOAP Server object */
+
 $server = new SOAP_Server_Email_Gateway('http://localhost/soap_interop/server_round2.php');
 
-/* Tell the server to translate to classes we provide if possible. */
+/* tell server to translate to classes we provide if possible */
 $server->_auto_translation = true;
 
-require_once './example_server.php';
+require_once 'example_server.php';
+
 $soapclass = new SOAP_Example_Server();
 $server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
 
-/* Connect to a POP3 server and read the messages. */
-$pop3 = new Net_POP3();
+
+/* Connect to a POP3 server and read the messages */
+
+$pop3 =& new Net_POP3();
 if ($pop3->connect('localhost', 110)) {
     if ($pop3->login('username', 'password')) {
         $listing = $pop3->getListing();
 
-        /* Now loop through each message, and call the SOAP server with that
-         * message. */
+	/* now loop through each message, and call the 
+           SOAP server with that message */
+
         foreach ($listing as $msg) {
+
             $email = $pop3->getMsg($msg['msg_id']);
 
-            /* This is where we actually handle the SOAP response.  The
-             * SOAP::Server::Email class we are using will send the SOAP
-             * response to the sender via email. */
-            if ($email) {
-                $server->service($email);
-            }
+            /* this is where we actually handle the SOAP
+               response.  The SOAP::Server::Email class we
+               are using will send the SOAP response to 
+               the sender via email. */
 
-            // $pop3->deleteMsg($msg['msg_id']);
+            if ($email) $server->service($email);
+
+            #$pop3->deleteMsg($msg['msg_id']);
         }
     }
     $pop3->disconnect();
 }
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/disco_server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/disco_server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/disco_server.php	(revision 21410)
@@ -1,204 +1,238 @@
 <?php
-/**
- * This example shows how to mark up a server object so that WSDL files may be
- * dynamicaly generated by the SOAP server.  This also provides access to a
- * generated DISCO document.  The fact that this example has an MP3 class is
- * in no way related to DISCO. ;)
- *
- * DISCO: http://msdn.microsoft.com/msdnmag/issues/02/02/xml/default.aspx
- *
- * Urls accessing this server would look like:
- * - http://localhost/disco_server.php?wsdl (generate WSDL file)
- * - http://localhost/disco_server.php (GET request generates DISCO)
- * - http://localhost/disco_server.php (POST for normal SOAP requests)
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Dmitri Vinogradov <dimitri@vinogradov.de>                    |
+// +----------------------------------------------------------------------+
+//
+// $Id: disco_server.php,v 1.6 2006/12/27 10:50:39 arnaud Exp $
+
+/*
+  This example shows how to mark up a server object so that
+  wsdl files may be dynamicaly generated by the soap
+  server.  This also provides access to a generated DISCO document.
+  The fact that this example has an MP3 class is in no way
+  related to DISCO. ;)
+  
+  DISCO: http://msdn.microsoft.com/msdnmag/issues/02/02/xml/default.aspx
+  
+  A url accessing this server would look like:
+  
+  http://localhost/disco_server.php?wsdl (generate WSDL file)
+  http://localhost/disco_server.php (GET request generates DISCO)
+  http://localhost/disco_server.php (POST for normal soap requests)
+*/
 
 error_reporting(E_ALL);
-
-/** SOAP_Server */
 require_once 'SOAP/Server.php';
 
-/**
- * MP3 database class.
- *
- * @package SOAP
- */
-class MP3DB_Class
-{
-
+class MP3DB_Class {
     var $__dispatch_map = array();
-    var $__typedef = array();
-
-    function MP3DB_Class()
-    {
-        /* The only way to describe all methods in WSDL (messages,
-         * PortType-operations and bindings) is to use __dispatch_map to
-         * describe every method (even methods using simple data types in 'in'
-         * and 'out' parameters...) */
+    var $__typedef     = array();
+    
+    function MP3DB_Class () {
+        /**
+        * the only way to describe all methods in WSDL (messages,
+        * PortType-operations and bindings) is to use __dispatch_map
+        * to describe every method (even methods using simple data 
+        * types in 'in' and 'out' parameters...)
+        */
+        
         $this->__dispatch_map['SayHallo'] =
-            array('in' => array('input' => 'string'),
-                  'out' => array('return' => 'string'));
+                    array(
+                        'in' => array('input' => 'string'),
+                        'out' => array('return' => 'string')
+                    );
+                    
         $this->__dispatch_map['SayThisNTimes'] =
-            array('in' => array('SayThis'=>'string','NTimes' => 'int'),
-                  'out' => array('return' => '{urn:MP3DB}ArrayOfStrings'));
+                    array(
+                        'in' => array('SayThis'=>'string','NTimes' => 'int'),
+                        'out' => array('return' => '{urn:MP3DB}ArrayOfStrings')
+                    );
+                    
         $this->__dispatch_map['GetMP3Tracks'] =
-            array('in' => array('query' => 'string'),
-                  'out' => array('return' => '{urn:MP3DB}GetMP3TracksResult'));
+                    array(
+                        'in' => array('query' => 'string'),
+                        'out' => array('return' => '{urn:MP3DB}GetMP3TracksResult')
+                    );
+                    
         $this->__dispatch_map['AddMP3Track'] =
-            array('in' => array('MP3Track' => '{urn:MP3DB}MP3Track'),
-                  'out' => array('return' => '{urn:MP3DB}AddMP3TrackResult'));
-
-        /* Use __typedef to describe userdefined Types in WSDL.  Structs and
-         * one-dimensional arrays are supported.
-         *
-         * Struct example:
-         * $this->__typedef['TypeName'] = array('VarName' => 'xsdType', ... );
-         * or
-         * $this->__typedef['TypeName'] = array('VarName' => '{namespace}SomeOtherType');
-         *
-         * Array example:
-         * $this->__typedef['TypeName'] = array(array('item' => 'xsdType'));
-         * or
-         * $this->__typedef['TypeName'] = array(array('item' => '{namespace}SomeOtherType'));
-         */
-
-        /* Struct 'MP3Track'. */
-        $this->__typedef['MP3Track'] =
-            array('Title' => 'string',
-                  'Artist' => 'string',
-                  'Album' => 'string',
-                  'Year' => 'int',
-                  'Genre' => 'int',
-                  'Comment' => 'string',
-                  'Composer' => 'string',
-                  'Orig_Artist' => 'string',
-                  'URL' => 'string',
-                  'Encoded_by' => 'string');
-
-        /* MP3TracksArray - array of 'MP3Track' structs. */
-        $this->__typedef['MP3TracksArray'] =
-            array(array('item' => '{urn:MP3DB}MP3Track'));
-
-        /* Struct 'MethodDebug'. */
-        $this->__typedef['MethodDebug'] =
-            array('rc' => 'boolean',
-                  'ErrNo' => 'int',
-                  'Error' => 'string');
-
-        /* Return Struct of method GetMP3Tracks. */
-        $this->__typedef['GetMP3TracksResult'] =
-            array('MethodDebug' => '{urn:MP3DB}MethodDebug',
-                  'MP3Tracks' => '{urn:MP3DB}MP3TracksArray');
-
-        /* Return Struct of method AddMP3Track. */
-        $this->__typedef['AddMP3TrackResult'] =
-            array('MethodDebug' => '{urn:MP3DB}MethodDebug');
-
-        /* Array of strings. */
-        $this->__typedef['ArrayOfStrings'] =
-            array(array('item'=>'string'));
-    }
-
-    function SayHallo($name)
-    {
-        return 'Hello, ' . $name;
-    }
-
-
-    function SayThisNTimes($SayThis, $NTimes)
-    {
+                    array(
+                        'in' => array('MP3Track' => '{urn:MP3DB}MP3Track'),
+                        'out' => array('return' => '{urn:MP3DB}AddMP3TrackResult')
+                    );
+
+        /**
+        * I use __typedef to describe userdefined Types in WSDL.
+        * Structs and one-dimensional arrays are supported:
+        * Struct example: $this->__typedef['TypeName'] = array('VarName' => 'xsdType', ... );
+        *    or $this->__typedef['TypeName'] = array('VarName' => '{namespace}SomeOtherType');
+        * Array example: $this->__typedef['TypeName'] = array(array('item' => 'xsdType'));
+        *    or $this->__typedef['TypeName'] = array(array('item' => '{namespace}SomeOtherType'));
+        */
+    
+        /**
+        * Struct 'MP3Track'
+        */
+        $this->__typedef['MP3Track'] = 
+                    array(
+                        'Title' => 'string',
+                        'Artist' => 'string', 
+                        'Album' => 'string', 
+                        'Year' => 'int', 
+                        'Genre' => 'int',
+                        'Comment' => 'string',
+                        'Composer' => 'string',
+                        'Orig_Artist' => 'string',
+                        'URL' => 'string',
+                        'Encoded_by' => 'string'
+                    );
+                    
+                    
+                    
+        /**
+        * MP3TracksArray - array of 'MP3Track' structs
+        */
+        $this->__typedef['MP3TracksArray'] = 
+                    array(
+                        array(
+                            'item' => '{urn:MP3DB}MP3Track'
+                        )
+                    );
+                    
+        /**
+        * Struct 'MethodDebug'
+        */
+        $this->__typedef['MethodDebug'] = 
+                    array(
+                        'rc' => 'boolean',
+                        'ErrNo' => 'int', 
+                        'Error' => 'string'
+                    );
+                    
+        /**
+        * return Struct of method GetMP3Tracks
+        */
+        $this->__typedef['GetMP3TracksResult'] = 
+                    array(
+                        'MethodDebug' => '{urn:MP3DB}MethodDebug',
+                        'MP3Tracks' => '{urn:MP3DB}MP3TracksArray'
+                    );
+                    
+        /**
+        * return Struct of method AddMP3Track
+        */
+        $this->__typedef['AddMP3TrackResult'] = 
+                    array(
+                        'MethodDebug' => '{urn:MP3DB}MethodDebug'
+                    );
+                    
+        /**
+        * Array of strings
+        */
+        $this->__typedef['ArrayOfStrings'] = 
+                    array(
+                        array('item'=>'string')
+                    );
+    
+    }
+    
+    
+    function SayHallo($name) {
+        return "Hallo, " . $name;
+    }
+    
+    
+    function SayThisNTimes($SayThis,$NTimes) {
         for ($i = 0; $i < $NTimes; $i++) {
-            $return[$i] = $SayThis . ' ' . $i;
+            $return[$i] = $SayThis . " $i";
         }
-        return new SOAP_Value('return', '{urn:MP3DB}ArrayOfStrings', $return);
-    }
-
-    function GetMP3Tracks($query = '')
-    {
-        for ($i = 0; $i < 5; $i++) {
+        return new SOAP_Value('return','{urn:MP3DB}ArrayOfStrings',$return);
+    }
+    
+    
+    function GetMP3Tracks($query = "") {
+        for($i = 0; $i < 5; $i++) {
             $this->MP3Tracks[$i] = new SOAP_Value(
-                'item',
-                '{urn:MP3DB}MP3Track',
-                array('Title'       => new SOAP_Value('Title', 'string', 'some track $i'),
-                      'Artist'      => new SOAP_Value('Artist', 'string', 'some artist $i'),
-                      'Album'       => new SOAP_Value('Album', 'string', 'some album $i'),
-                      'Year'        => new SOAP_Value('Year', 'int', 1999),
-                      'Genre'       => new SOAP_Value('Genre', 'int', 100),
-                      'Comment'     => new SOAP_Value('Comment', 'string', 'blabla $i'),
-                      'Composer'    => new SOAP_Value('Composer', 'string', ''),
-                      'Orig_Artist' => new SOAP_Value('Orig_Artist', 'string', ''),
-                      'URL'         => new SOAP_Value('URL', 'string', ''),
-                      'Encoded_by'  => new SOAP_Value('Encoded_by', 'string', '')));
+                    'item',
+                    '{urn:MP3DB}MP3Track',
+                    array(
+                        "Title"         => new SOAP_Value("Title","string","some track $i"),
+                        "Artist"        => new SOAP_Value("Artist","string","some artist $i"),
+                        "Album"         => new SOAP_Value("Album","string","some album $i"),
+                        "Year"          => new SOAP_Value("Year","int",(integer)1999),
+                        "Genre"         => new SOAP_Value("Genre","int",(integer)100),
+                        "Comment"       => new SOAP_Value("Comment","string","blabla $i"),
+                        "Composer"      => new SOAP_Value("Composer","string",""),
+                        "Orig_Artist"   => new SOAP_Value("Orig_Artist","string",""),
+                        "URL"           => new SOAP_Value("URL","string",""),
+                        "Encoded_by"    => new SOAP_Value("Encoded_by","string","")
+                        )
+                );
         }
-
-        $MethodDebug['rc']    = new SOAP_Value('rc', 'boolean', true);
-        $MethodDebug['ErrNo'] = new SOAP_Value('ErrNo', 'int', 0);
-        $MethodDebug['Error'] = new SOAP_Value('Error', 'string', '');
-
-        return new SOAP_Value(
-            'return',
-            '{urn:MP3DB}GetMP3TracksResult',
-            array('MethodDebug' => new SOAP_Value('MethodDebug', '{urn:MP3DB}MethodDebug',$MethodDebug),
-                  'MP3Tracks'   => new SOAP_Value('MP3Tracks', '{urn:MP3DB}MP3TracksArray',$this->MP3Tracks)));
-    }
-
-    function AddMP3Track($MP3Track)
-    {
-        /* Well, let's imagine here some code for adding given mp3track to db
-         * or whatever... */
-        $MethodDebug['rc']    = new SOAP_Value('rc', 'boolean', true);
-        $MethodDebug['ErrNo'] = new SOAP_Value('ErrNo', 'int', 0);
-        $MethodDebug['Error'] = new SOAP_Value('Error', 'string', '');
-
-        return new SOAP_Value(
-            'return',
-            '{urn:MP3DB}AddMP3TrackResult',
-            array('MethodDebug' => new SOAP_Value('MethodDebug', '{urn:MP3DB}MethodDebug', $MethodDebug)));
-    }
-
-    function __dispatch($methodname)
-    {
-        if (isset($this->__dispatch_map[$methodname])) {
+        
+        $MethodDebug["rc"]    = new SOAP_Value("rc","boolean",true);
+        $MethodDebug["ErrNo"] = new SOAP_Value("ErrNo","int",(integer)0);
+        $MethodDebug["Error"] = new SOAP_Value("Error","string","");
+            
+        return new SOAP_Value('return','{urn:MP3DB}GetMP3TracksResult',array(
+                    "MethodDebug" => new SOAP_Value('MethodDebug','{urn:MP3DB}MethodDebug',$MethodDebug),
+                    "MP3Tracks"   => new SOAP_Value('MP3Tracks','{urn:MP3DB}MP3TracksArray',$this->MP3Tracks)
+                    )
+                );
+    }
+    
+    
+    function AddMP3Track($MP3Track) {
+        # well, lets imagine here some code for adding given mp3track to db or whatever...
+        $MethodDebug["rc"]    = new SOAP_Value("rc","boolean",true);
+        $MethodDebug["ErrNo"] = new SOAP_Value("ErrNo","int",(integer)0);
+        $MethodDebug["Error"] = new SOAP_Value("Error","string","");
+        
+        return new SOAP_Value('return','{urn:MP3DB}AddMP3TrackResult',array(
+                    "MethodDebug" => new SOAP_Value('MethodDebug','{urn:MP3DB}MethodDebug',$MethodDebug)
+                    )
+                );
+    }
+    
+    
+    function __dispatch($methodname) {
+        if (isset($this->__dispatch_map[$methodname]))
             return $this->__dispatch_map[$methodname];
-        }
-        return null;
-    }
-
+        return NULL;
+    }
 }
 
-$server = new SOAP_Server();
+$server = new SOAP_Server;
 $server->_auto_translation = true;
 $MP3DB_Class = new MP3DB_Class();
-$server->addObjectMap($MP3DB_Class, 'urn:MP3DB');
+$server->addObjectMap($MP3DB_Class,'urn:MP3DB');
+
 
 if (isset($_SERVER['REQUEST_METHOD']) &&
-    $_SERVER['REQUEST_METHOD'] == 'POST') {
+    $_SERVER['REQUEST_METHOD']=='POST') {
     $server->service($HTTP_RAW_POST_DATA);
 } else {
     require_once 'SOAP/Disco.php';
-    $disco = new SOAP_DISCO_Server($server, 'MP3DB');
-    header('Content-type: text/xml');
+    $disco = new SOAP_DISCO_Server($server,"MP3DB");
+    header("Content-type: text/xml");
     if (isset($_SERVER['QUERY_STRING']) &&
-        strpos($_SERVER['QUERY_STRING'], 'wsdl') !== false) {
+       strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
         echo $disco->getWSDL();
     } else {
         echo $disco->getDISCO();
     }
+    exit;
 }
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/attachment.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/attachment.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/attachment.php	(revision 21410)
@@ -1,8 +1,3 @@
 <?php
-/**
- * @category Web Services
- * @package SOAP
- */
-
 require_once("SOAP/Client.php");
 require_once("SOAP/test/test.utility.php");
Index: branches/version-2_11-dev/data/module/SOAP/example/server2.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/server2.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/server2.php	(revision 21410)
@@ -1,60 +1,64 @@
 <?php
-/**
- * Server endpoint.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id: server2.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* First, include the SOAP_Server class. */
+// first, include the SOAP/Server class
 require_once 'SOAP/Server.php';
+
 $server = new SOAP_Server;
-
-/* Tell server to translate to classes we provide if possible. */
+/* tell server to translate to classes we provide if possible */
 $server->_auto_translation = true;
 
-/* This is a simple example of implementing a custom call handler.  If you do
- * this, the SOAP server will ignore objects or functions added to it, and
- * will call your handler for **ALL** SOAP calls the server receives, whether
- * the call is defined in your WSDL or not.  The handler receives two
- * arguments, the method name being called, and the arguments sent for that
- * call. */
+/* This is a simple example of implementing a custom
+   call handler.  If you do this, the soap server will ignore
+   objects or functions added to it, and will call your handler
+   for **ALL** soap calls the server receives, wether the call
+   is defined in your WSDL or not.  The handler receives two
+   arguments, the method name being called, and the arguments
+   sent for that call.
+*/
 function myCallHandler($methodname, $args)
 {
     global $soapclass;
-    return call_user_func_array(array($soapclass, $methodname), $args);
+    return @call_user_func_array(array($soapclass, $methodname),$args);
 }
-$server->setCallHandler('myCallHandler', false);
+$server->setCallHandler('myCallHandler',false);
 
-require_once dirname(__FILE__) . '/example_server.php';
+require_once 'example_server.php';
+
 $soapclass = new SOAP_Example_Server();
-$server->addObjectMap($soapclass, 'urn:SOAP_Example_Server');
+$server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
 
 if (isset($_SERVER['REQUEST_METHOD']) &&
-    $_SERVER['REQUEST_METHOD'] == 'POST') {
+    $_SERVER['REQUEST_METHOD']=='POST') {
     $server->service($HTTP_RAW_POST_DATA);
 } else {
     require_once 'SOAP/Disco.php';
-    $disco = new SOAP_DISCO_Server($server, 'ServerExample');
-    header('Content-type: text/xml');
+    $disco = new SOAP_DISCO_Server($server,'ServerExample');
+    header("Content-type: text/xml");
     if (isset($_SERVER['QUERY_STRING']) &&
-       strpos($_SERVER['QUERY_STRING'], 'wsdl') !== false) {
+       strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
         echo $disco->getWSDL();
     } else {
         echo $disco->getDISCO();
     }
+    exit;
 }
+?>
Index: branches/version-2_11-dev/data/module/SOAP/example/email_pop_server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/example/email_pop_server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/example/email_pop_server.php	(revision 21410)
@@ -1,55 +1,67 @@
 <?php
-/**
- * POP3 server.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
- * @author     Jan Schneider <jan@horde.org>       Maintenance
- * @copyright  2003-2007 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
+// +----------------------------------------------------------------------+
+//
+// $Id: email_pop_server.php,v 1.6 2005/03/10 23:16:40 yunosh Exp $
+//
 
-/* SOAP_Server_Email */
+/* include the Email server class, which knows how to
+   parse a standard email as a soap message */
+
 require_once 'SOAP/Server/Email.php';
 
-/* Include a class to access POP3. */
+/* include a class to access POP3 */
+
 require_once 'Net/POP3.php';
 
-/* Create the SOAP Server object. */
+/* create the SOAP Server object */
+
 $server = new SOAP_Server_Email;
 
-/* Tell the server to translate to classes we provide if possible. */
+/* tell server to translate to classes we provide if possible */
 $server->_auto_translation = true;
 
-require_once './example_server.php';
+require_once 'example_server.php';
+
 $soapclass = new SOAP_Example_Server();
 $server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
 
-/* Connect to a POP3 server and read the messages. */
-$pop3 = new Net_POP3();
+
+/* Connect to a POP3 server and read the messages */
+
+$pop3 =& new Net_POP3();
 if ($pop3->connect('localhost', 110)) {
     if ($pop3->login('username', 'password')) {
         $listing = $pop3->getListing();
 
-        /* Now loop through each message, and call the SOAP server with that
-         * message. */
+	/* now loop through each message, and call the 
+           SOAP server with that message */
+
         foreach ($listing as $msg) {
+
             $email = $pop3->getMsg($msg['msg_id']);
-            /* This is where we actually handle the SOAP response.  The
-             * SOAP_Server_Email class we are using will send the SOAP
-             * response to the sender via email. */
+
+            /* this is where we actually handle the SOAP
+               response.  The SOAP::Server::Email class we
+               are using will send the SOAP response to 
+               the sender via email. */
+
             if ($email) {
                 $server->client($email);
+
                 $pop3->deleteMsg($msg['msg_id']);
             }
@@ -58,2 +70,3 @@
     $pop3->disconnect();
 }
+?>
Index: branches/version-2_11-dev/data/module/SOAP/Server.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Server.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Server.php	(revision 21410)
@@ -176,5 +176,5 @@
             /* We'll try to build our endpoint. */
             $this->endpoint = 'http://' . $_SERVER['SERVER_NAME'];
-            if (isset($_SERVER['SERVER_PORT'])) {
+            if ($_SERVER['SERVER_PORT']) {
                 $this->endpoint .= ':' . $_SERVER['SERVER_PORT'];
             }
@@ -186,5 +186,5 @@
         if (isset($_SERVER['CONTENT_TYPE'])) {
             if (strcasecmp($_SERVER['CONTENT_TYPE'], 'application/dime') == 0) {
-                $this->_decodeDIMEMessage($data, $this->headers, $attachments);
+                $this->_decodeDIMEMessage($data, $headers, $attachments);
                 $useEncoding = 'DIME';
             } elseif (stristr($_SERVER['CONTENT_TYPE'], 'multipart/related')) {
@@ -193,12 +193,12 @@
                     stripslashes($_SERVER['CONTENT_TYPE']) .
                     "\r\n\r\n" . $data;
-                $this->_decodeMimeMessage($data, $this->headers, $attachments);
+                $this->_decodeMimeMessage($data, $headers, $attachments);
                 $useEncoding = 'Mime';
             }
-            if (!isset($this->headers['content-type'])) {
-                $this->headers['content-type'] = stripslashes($_SERVER['CONTENT_TYPE']);
+            if (!isset($headers['content-type'])) {
+                $headers['content-type'] = stripslashes($_SERVER['CONTENT_TYPE']);
             }
             if (!$this->fault &&
-                !$this->_getContentEncoding($this->headers['content-type'])) {
+                !$this->_getContentEncoding($headers['content-type'])) {
                 $this->xml_encoding = SOAP_DEFAULT_ENCODING;
                 /* Found encoding we don't understand; return a fault. */
@@ -210,12 +210,9 @@
          * WSDL file. */
         if (!$this->fault && !$test &&
-            ((isset($_SERVER['REQUEST_METHOD']) &&
-              $_SERVER['REQUEST_METHOD'] != 'POST') ||
-             (isset($this->headers['content-type']) &&
-              strncmp($this->headers['content-type'], 'text/xml', 8) != 0))) {
+            ($_SERVER['REQUEST_METHOD'] != 'POST' ||
+             strncmp($headers['content-type'], 'text/xml', 8) != 0)) {
             /* This is not possibly a valid SOAP request, try to return a WSDL
              * file. */
-            $got = isset($this->headers['content-type']) ? $this->headers['content-type'] : 'Nothing!';
-            $this->_raiseSoapFault('Invalid SOAP request, must be POST with content-type: text/xml, got: ' . $got, '', '', 'Server');
+            $this->_raiseSoapFault('Invalid SOAP request, must be POST with content-type: text/xml, got: ' . (isset($headers['content-type']) ? $headers['content-type'] : 'Nothing!'), '', '', 'Server');
         }
 
@@ -383,14 +380,8 @@
     {
         /* Parse response, get SOAP_Parser object. */
-        $parser = new SOAP_Parser($data, $this->xml_encoding, $attachments);
-
+        $parser =& new SOAP_Parser($data, $this->xml_encoding, $attachments);
+        /* If fault occurred during message parsing. */
         if ($parser->fault) {
-            /* Fault occurred during message parsing. */
             $this->fault = $parser->fault;
-            return null;
-        }
-        if (!count($parser->root_struct_name)) {
-            /* No method specified. */
-            $this->_raiseSoapFault('No method specified in request.');
             return null;
         }
@@ -553,5 +544,5 @@
         if (is_array($requestArray)) {
             if (isset($requestArray['faultcode']) ||
-                isset($requestArray[SOAP_BASE::SOAPENVPrefix().':faultcode'])) {
+                isset($requestArray['SOAP-ENV:faultcode'])) {
                 $faultcode = $faultstring = $faultdetail = $faultactor = '';
                 foreach ($requestArray as $k => $v) {
@@ -809,5 +800,5 @@
      * @return void
      */
-    function addObjectWSDL($wsdl_obj, $targetNamespace, $service_name,
+    function addObjectWSDL(&$wsdl_obj, $targetNamespace, $service_name,
                            $service_desc = '')
     {
Index: branches/version-2_11-dev/data/module/SOAP/Transport/HTTP.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Transport/HTTP.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Transport/HTTP.php	(revision 21410)
@@ -25,5 +25,5 @@
  *
  * @package  SOAP
- * @category Web Services
+ * @category Web_Services
  */
 
@@ -327,82 +327,78 @@
     function _parseResponse()
     {
-        if (!preg_match("/^(.*?)\r?\n\r?\n(.*)/s",
+        if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s",
                        $this->incoming_payload,
                        $match)) {
-            $this->_raiseSoapFault('Invalid HTTP Response');
-            return false;
-        }
-
-        $this->response = $match[2];
-        // Find the response error, some servers response with 500 for
-        // SOAP faults.
-        $this->_parseHeaders($match[1]);
-
-        list(, $code, $msg) = sscanf($this->result_headers[0], '%s %s %s');
-        unset($this->result_headers[0]);
-
-        switch($code) {
-            case 100: // Continue
-                $this->incoming_payload = $match[2];
-                return $this->_parseResponse();
-            case 200:
-            case 202:
-                $this->incoming_payload = trim($match[2]);
-                if (!strlen($this->incoming_payload)) {
-                    /* Valid one-way message response. */
-                    return true;
+            $this->response = $match[2];
+            // Find the response error, some servers response with 500 for
+            // SOAP faults.
+            $this->_parseHeaders($match[1]);
+
+            list(, $code, $msg) = sscanf($this->result_headers[0], '%s %s %s');
+            unset($this->result_headers[0]);
+
+            switch($code) {
+                case 100: // Continue
+                    $this->incoming_payload = $match[2];
+                    return $this->_parseResponse();
+                case 400:
+                    $this->_raiseSoapFault("HTTP Response $code Bad Request");
+                    return false;
+                    break;
+                case 401:
+                    $this->_raiseSoapFault("HTTP Response $code Authentication Failed");
+                    return false;
+                    break;
+                case 403:
+                    $this->_raiseSoapFault("HTTP Response $code Forbidden");
+                    return false;
+                    break;
+                case 404:
+                    $this->_raiseSoapFault("HTTP Response $code Not Found");
+                    return false;
+                    break;
+                case 407:
+                    $this->_raiseSoapFault("HTTP Response $code Proxy Authentication Required");
+                    return false;
+                    break;
+                case 408:
+                    $this->_raiseSoapFault("HTTP Response $code Request Timeout");
+                    return false;
+                    break;
+                case 410:
+                    $this->_raiseSoapFault("HTTP Response $code Gone");
+                    return false;
+                    break;
+                default:
+                    if ($code >= 400 && $code < 500) {
+                        $this->_raiseSoapFault("HTTP Response $code Not Found, Server message: $msg");
+                        return false;
+                    }
+            }
+
+            $this->_parseEncoding($match[1]);
+
+            if ($this->result_content_type == 'application/dime') {
+                // XXX quick hack insertion of DIME
+                if (PEAR::isError($this->_decodeDIMEMessage($this->response, $this->headers, $this->attachments))) {
+                    // _decodeDIMEMessage already raised $this->fault
+                    return false;
                 }
-                break;
-            case 400:
-                $this->_raiseSoapFault("HTTP Response $code Bad Request");
+                $this->result_content_type = $this->headers['content-type'];
+            } elseif (stristr($this->result_content_type, 'multipart/related')) {
+                $this->response = $this->incoming_payload;
+                if (PEAR::isError($this->_decodeMimeMessage($this->response, $this->headers, $this->attachments))) {
+                    // _decodeMimeMessage already raised $this->fault
+                    return false;
+                }
+            } elseif ($this->result_content_type != 'text/xml') {
+                $this->_raiseSoapFault($this->response);
                 return false;
-            case 401:
-                $this->_raiseSoapFault("HTTP Response $code Authentication Failed");
-                return false;
-            case 403:
-                $this->_raiseSoapFault("HTTP Response $code Forbidden");
-                return false;
-            case 404:
-                $this->_raiseSoapFault("HTTP Response $code Not Found");
-                return false;
-            case 407:
-                $this->_raiseSoapFault("HTTP Response $code Proxy Authentication Required");
-                return false;
-            case 408:
-                $this->_raiseSoapFault("HTTP Response $code Request Timeout");
-                return false;
-            case 410:
-                $this->_raiseSoapFault("HTTP Response $code Gone");
-                return false;
-            default:
-                if ($code >= 400 && $code < 500) {
-                    $this->_raiseSoapFault("HTTP Response $code Not Found, Server message: $msg");
-                    return false;
-                }
-                break;
-        }
-
-        $this->_parseEncoding($match[1]);
-
-        if ($this->result_content_type == 'application/dime') {
-            // XXX quick hack insertion of DIME
-            if (PEAR::isError($this->_decodeDIMEMessage($this->response, $this->headers, $this->attachments))) {
-                // _decodeDIMEMessage already raised $this->fault
-                return false;
-            }
-            $this->result_content_type = $this->headers['content-type'];
-        } elseif (stristr($this->result_content_type, 'multipart/related')) {
-            $this->response = $this->incoming_payload;
-            if (PEAR::isError($this->_decodeMimeMessage($this->response, $this->headers, $this->attachments))) {
-                // _decodeMimeMessage already raised $this->fault
-                return false;
-            }
-        } elseif ($this->result_content_type != 'text/xml') {
-            $this->_raiseSoapFault($this->response);
-            return false;
-        }
-
-        // if no content, return false
-        return strlen($this->response) > 0;
+            }
+            // if no content, return false
+            return strlen($this->response) > 0;
+        }
+        $this->_raiseSoapFault('Invalid HTTP Response');
+        return false;
     }
 
@@ -562,16 +558,16 @@
         }
 
-        $headers = array();
-        $action = isset($options['soapaction']) ? $options['soapaction'] : '';
-        $headers['Content-Type'] = "text/xml; charset=$this->encoding";
-        $headers['SOAPAction'] = '"' . $action . '"';
-        if (isset($options['headers'])) {
-            $headers = array_merge($headers, $options['headers']);
-        }
-        foreach ($headers as $header => $value) {
-            $headers[$header] = $header . ': ' . $value;
-        }
-        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
-        curl_setopt($ch, CURLOPT_USERAGENT, $this->_userAgent);
+        if (!isset($options['soapaction'])) {
+            $options['soapaction'] = '';
+        }
+        if (!isset($options['headers']['Content-Type'])) {
+           $options['headers']['Content-Type'] = 'text/xml';
+        }
+        curl_setopt($ch, CURLOPT_HTTPHEADER,
+                    array('Content-Type: ' . $options['headers']['Content-Type']
+                         . ';charset=' . $this->encoding,
+                          'SOAPAction: "' . $options['soapaction'] . '"'));
+        curl_setopt($ch, CURLOPT_USERAGENT,
+                    $this->_userAgent);
 
         if ($this->timeout) {
Index: branches/version-2_11-dev/data/module/SOAP/Transport/SMTP.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Transport/SMTP.php	(revision 21318)
+++ branches/version-2_11-dev/data/module/SOAP/Transport/SMTP.php	(revision 21410)
@@ -152,5 +152,5 @@
             $val = new SOAP_Value('Message-ID', 'string', $headers['Message-ID']);
         } else {
-            $sval[] = new SOAP_Value('faultcode', 'QName', SOAP_BASE::SOAPENVPrefix().':Client');
+            $sval[] = new SOAP_Value('faultcode', 'QName', 'SOAP-ENV:Client');
             $sval[] = new SOAP_Value('faultstring', 'string', "couldn't send SMTP message to {$this->urlparts['path']}");
             $val = new SOAP_Value('Fault', 'Struct', $sval);
Index: branches/version-2_11-dev/data/module/SOAP/Transport/TEST.php
===================================================================
--- branches/version-2_11-dev/data/module/SOAP/Transport/TEST.php	(revision 21318)
+++ 	(revision )
@@ -1,54 +1,0 @@
-<?php
-/**
- * This file contains the code for a local transport layer for testing
- * purposes.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 2.02 of the PHP license,
- * that is bundled with this package in the file LICENSE, and is available at
- * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
- * did not receive a copy of the PHP license and are unable to obtain it
- * through the world-wide-web, please send a note to license@php.net so we can
- * mail you a copy immediately.
- *
- * @category   Web Services
- * @package    SOAP
- * @author     Jan Schneider <jan@horde.org>
- * @copyright  2008 The PHP Group
- * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
- * @link       http://pear.php.net/package/SOAP
- */
-
-require_once 'SOAP/Transport.php';
-
-/**
- * Test transport for SOAP.
- *
- * @access  public
- * @package SOAP
- * @author  Jan Schneider <jan@horde.org>
- */
-class SOAP_Transport_TEST extends SOAP_Transport
-{
-    /**
-     * Sends and receives SOAP data.
-     *
-     * @param string $msg     Outgoing SOAP data.
-     * @param array $options  Options.
-     *
-     * @return string|SOAP_Fault
-     */
-    function send($msg, $options = array())
-    {
-        $_SERVER['REQUEST_METHOD'] = 'POST';
-        $this->outgoing_payload = $msg;
-        ob_start();
-        $server = clone($options['server']);
-        $server->service($msg);
-        $this->incoming_payload = ob_get_contents();
-        ob_end_clean();
-        return $this->incoming_payload;
-    }
-
-}
Index: branches/version-2_11-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 21403)
+++ branches/version-2_11-dev/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 21410)
@@ -169,5 +169,5 @@
         }
         // 在庫無し商品の非表示
-        if (NOSTOCK_HIDDEN) {
+        if (NOSTOCK_HIDDEN === true) {
             $where .= ' AND (stock_max >= 1 OR stock_unlimited_max = 1)';
         }
Index: branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 21319)
+++ branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 21410)
@@ -583,5 +583,5 @@
 
         // 在庫無し商品の非表示対応
-        if (NOSTOCK_HIDDEN) {
+        if (NOSTOCK_HIDDEN === true) {
             // 件数カウントバッチ実行
             $objDb = new SC_Helper_DB_Ex();
Index: branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php	(revision 21405)
+++ branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php	(revision 21410)
@@ -48,5 +48,5 @@
         parent::init();
         $this->tpl_maintitle = '商品管理';
-        $this->tpl_subtitle = 'カテゴリ登録';
+        $this->tpl_subtitle = 'カテゴリー登録';
         $this->tpl_mainpage = 'products/category.tpl';
         $this->tpl_mainno = 'products';
@@ -80,5 +80,5 @@
 
         switch($this->getMode()) {
-        // カテゴリ登録/編集実行
+        // カテゴリー登録/編集実行
         case 'edit':
             $category_id = $objFormParam->getValue('category_id');
@@ -296,5 +296,5 @@
      * 下記の場合は, 登録を実行せず、エラーメッセージを表示する
      *
-     * - カテゴリ登録数の上限を超える場合
+     * - カテゴリー登録数の上限を超える場合
      * - 階層登録数の上限を超える場合
      * - カテゴリ名がすでに使用されている場合
@@ -341,5 +341,5 @@
         }
 
-        // カテゴリ登録
+        // カテゴリー登録
         $this->registerCategory($objFormParam->getValue('parent_category_id'),
                                 $objFormParam->getValue('category_name'),
Index: branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php	(revision 21402)
+++ branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php	(revision 21410)
@@ -27,5 +27,5 @@
 
 /**
- * カテゴリ登録CSVのページクラス
+ * カテゴリー登録CSVのページクラス
  *
  * LC_Page_Admin_Products_UploadCSV をカスタマイズする場合はこのクラスを編集する.
@@ -73,5 +73,5 @@
         $this->tpl_subno    = 'upload_csv_category';
         $this->tpl_maintitle = '商品管理';
-        $this->tpl_subtitle = 'カテゴリ登録CSV';
+        $this->tpl_subtitle = 'カテゴリー登録CSV';
         $this->csv_id = '5';
 
@@ -350,5 +350,5 @@
 
     /**
-     * カテゴリ登録を行う.
+     * カテゴリー登録を行う.
      *
      * FIXME: 登録の実処理自体は、LC_Page_Admin_Products_Categoryと共通化して欲しい。
Index: branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 21402)
+++ branches/version-2_11-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 21410)
@@ -414,5 +414,5 @@
         }
 
-        // カテゴリ登録
+        // カテゴリー登録
         if($arrList['category_ids'] != "") {
             $arrCategory_id = explode(',', $arrList['category_ids']);
Index: branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php	(revision 21317)
+++ branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php	(revision 21410)
@@ -65,5 +65,5 @@
         switch ( SC_Display_Ex::detectDevice() ) {
             case DEVICE_TYPE_MOBILE:
-                // メインカテゴリの取得
+                // メインカテゴリーの取得
                 $this->arrCat = $this->lfGetMainCat(true);
                 break;
@@ -117,5 +117,5 @@
      * @param array $arrParentCategoryId 親カテゴリの配列
      * @param boolean $count_check 登録商品数をチェックする場合はtrue
-     * @return array $arrRet カテゴリツリーの配列を返す
+     * @return array $arrRet カテゴリーツリーの配列を返す
      */
     function lfGetCatTree($arrParentCategoryId, $count_check = false) {
@@ -166,8 +166,8 @@
 
     /**
-     * メインカテゴリの取得.
+     * メインカテゴリーの取得.
      *
      * @param boolean $count_check 登録商品数をチェックする場合はtrue
-     * @return array $arrMainCat メインカテゴリの配列を返す
+     * @return array $arrMainCat メインカテゴリーの配列を返す
      */
     function lfGetMainCat($count_check = false) {
@@ -175,5 +175,5 @@
         $col = '*';
         $from = 'dtb_category left join dtb_category_total_count using (category_id)';
-        // メインカテゴリとその直下のカテゴリを取得する。
+        // メインカテゴリーとその直下のカテゴリーを取得する。
         $where = 'level <= 2 AND del_flg = 0';
         // 登録商品数のチェック
@@ -183,5 +183,5 @@
         $objQuery->setOption('ORDER BY rank DESC');
         $arrRet = $objQuery->select($col, $from, $where);
-        // メインカテゴリを抽出する。
+        // メインカテゴリーを抽出する。
         $arrMainCat = array();
         foreach ($arrRet as $cat) {
@@ -189,5 +189,5 @@
                 continue;
             }
-            // 子カテゴリを持つかどうかを調べる。
+            // 子カテゴリーを持つかどうかを調べる。
             $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray(
                 $arrRet,
Index: branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php	(revision 21401)
+++ branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php	(revision 21410)
@@ -107,5 +107,8 @@
             }
             // 取得
-            $arrProductList = $objProduct->getListByProductIds($objQuery, $arrProductId);
+            $arrTmp = $objProduct->getListByProductIds($objQuery, $arrProductId);
+            foreach ($arrTmp as $key => $arrRow) {
+                $arrProductList[$arrRow['product_id']] = $arrRow;
+            }
             // おすすめ商品情報にマージ
             foreach (array_keys($arrBestProducts) as $key) {
Index: branches/version-2_11-dev/data/class/pages/LC_Page_Sitemap.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/LC_Page_Sitemap.php	(revision 21317)
+++ branches/version-2_11-dev/data/class/pages/LC_Page_Sitemap.php	(revision 21410)
@@ -212,5 +212,5 @@
     function getAllProducts() {
 
-        // XXX: 商品登録の無いカテゴリは除外する方が良い気もする
+        // XXX: 商品登録の無いカテゴリーは除外する方が良い気もする
         $objQuery = SC_Query_Ex::getSingletonInstance();
         $sql = "SELECT category_id FROM dtb_category WHERE del_flg = 0";
Index: branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 21400)
+++ branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 21410)
@@ -311,4 +311,14 @@
         $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
 
+        //取得している並び順で並び替え
+        $arrProducts2 = array();
+        foreach($arrProducts as $item) {
+            $arrProducts2[ $item['product_id'] ] = $item;
+        }
+        $arrProducts = array();
+        foreach($arrProductId as $product_id) {
+            $arrProducts[] = $arrProducts2[$product_id];
+        }
+
         // 規格を設定
         $objProduct->setProductsClassByProductIds($arrProductId);
@@ -373,5 +383,5 @@
         $objQuery   =& SC_Query_Ex::getSingletonInstance();
         $arrSearch  = array('category' => '指定なし', 'maker' => '指定なし', 'name' => '指定なし');
-        // カテゴリ検索条件
+        // カテゴリー検索条件
         if ($arrSearchData['category_id'] > 0) {
             $arrSearch['category']  = $objQuery->get('category_name', 'dtb_category', 'category_id = ?', array($arrSearchData['category_id']));
@@ -398,5 +408,5 @@
         // 検索結果対象となる商品の数を取得
         $objQuery   =& SC_Query_Ex::getSingletonInstance();
-        $objQuery->setWhere($searchCondition['where_for_count']);
+        $objQuery->setWhere($searchCondition['where']);
         $objProduct = new SC_Product_Ex();
         return $objProduct->findProductCount($objQuery, $searchCondition['arrval']);
@@ -423,4 +433,9 @@
         // 商品検索条件の作成（未削除、表示）
         $searchCondition['where'] = "alldtl.del_flg = 0 AND alldtl.status = 1 ";
+
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $searchCondition['where'] .= ' AND (stock >= 1 OR stock_unlimited = 1)';
+        }
 
         if (strlen($searchCondition["where_category"]) >= 1) {
@@ -450,13 +465,4 @@
             $searchCondition['arrval'][] = $arrSearchData['maker_id'];
         }
-
-        $searchCondition['where_for_count'] = $searchCondition['where'];
-
-        // 在庫無し商品の非表示
-        if (NOSTOCK_HIDDEN) {
-            $searchCondition['where'] .= ' AND (stock >= 1 OR stock_unlimited = 1)';
-            $searchCondition['where_for_count'] .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = alldtl.product_id AND del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))';
-        }
-
         return $searchCondition;
     }
Index: branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 21402)
+++ branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 21410)
@@ -453,4 +453,5 @@
         foreach($arrRecommendData as $recommend){
             $arrRecommendProductId[] = $recommend["recommend_product_id"];
+            $arrRecommendData[$recommend["recommend_product_id"]] = $recommend['comment'];
         }
 
@@ -458,10 +459,18 @@
         $arrProducts = $objProduct->getListByProductIds($objQuery, $arrRecommendProductId);
 
+        //取得している並び順で並び替え
+        // FIXME SC_Productあたりにソート処理はもってくべき
+        $arrProducts2 = array();
+        foreach($arrProducts as $item) {
+            $arrProducts2[ $item['product_id'] ] = $item;
+        }
+
         $arrRecommend = array();
-        foreach ($arrRecommendData as $key => $arrRow) {
-            $arrRecommendData[$key] = array_merge($arrRow, $arrProducts[$arrRow['recommend_product_id']]);
-        }
-
-        return $arrRecommendData;
+        foreach($arrRecommendProductId as $product_id) {
+            $arrProducts2[$product_id]['comment'] = $arrRecommendData[$product_id];
+            $arrRecommend[] = $arrProducts2[$product_id];
+        }
+
+        return $arrRecommend;
     }
 
Index: branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_CategoryList.php
===================================================================
--- branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_CategoryList.php	(revision 21317)
+++ branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_CategoryList.php	(revision 21410)
@@ -65,5 +65,5 @@
         $this->lfCheckCategoryId();
 
-        // カテゴリ情報を取得する。
+        // カテゴリー情報を取得する。
         $objFormParam = $this->lfInitParam($_REQUEST);
         $arrCategoryData = $this->lfGetCategories($objFormParam->getValue('category_id'), true, $this);
@@ -91,14 +91,14 @@
 
     /**
-     * 選択されたカテゴリとその子カテゴリの情報を取得し、
+     * 選択されたカテゴリーとその子カテゴリーの情報を取得し、
      * ページオブジェクトに格納する。
      *
-     * @param string $category_id カテゴリID
-     * @param boolean $count_check 有効な商品がないカテゴリを除くかどうか
+     * @param string $category_id カテゴリーID
+     * @param boolean $count_check 有効な商品がないカテゴリーを除くかどうか
      * @param object &$objPage ページオブジェクト
      * @return void
      */
     function lfGetCategories($category_id, $count_check = false, &$objPage) {
-        // カテゴリの正しいIDを取得する。
+        // カテゴリーの正しいIDを取得する。
         $category_id = $this->lfCheckCategoryId($category_id);
         if ($category_id == 0) {
@@ -106,10 +106,10 @@
         }
 
-        $arrCategory = null;    // 選択されたカテゴリ
-        $arrChildren = array(); // 子カテゴリ
+        $arrCategory = null;    // 選択されたカテゴリー
+        $arrChildren = array(); // 子カテゴリー
 
         $arrAll = SC_Helper_DB_Ex::sfGetCatTree($category_id, $count_check);
         foreach ($arrAll as $category) {
-            // 選択されたカテゴリの場合
+            // 選択されたカテゴリーの場合
             if ($category['category_id'] == $category_id) {
                 $arrCategory = $category;
@@ -117,10 +117,10 @@
             }
 
-            // 関係のないカテゴリはスキップする。
+            // 関係のないカテゴリーはスキップする。
             if ($category['parent_category_id'] != $category_id) {
                 continue;
             }
 
-            // 子カテゴリの場合は、孫カテゴリが存在するかどうかを調べる。
+            // 子カテゴリーの場合は、孫カテゴリーが存在するかどうかを調べる。
             $arrGrandchildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrAll, 'parent_category_id', 'category_id', $category['category_id']);
             $category['has_children'] = count($arrGrandchildrenID) > 0;
@@ -132,5 +132,5 @@
         }
 
-        // 子カテゴリの商品数を合計する。
+        // 子カテゴリーの商品数を合計する。
         $children_product_count = 0;
         foreach ($arrChildren as $category) {
@@ -138,7 +138,7 @@
         }
 
-        // 選択されたカテゴリに直属の商品がある場合は、子カテゴリの先頭に追加する。
+        // 選択されたカテゴリーに直属の商品がある場合は、子カテゴリーの先頭に追加する。
         if ($arrCategory['product_count'] > $children_product_count) {
-            $arrCategory['product_count'] -= $children_product_count; // 子カテゴリの商品数を除く。
+            $arrCategory['product_count'] -= $children_product_count; // 子カテゴリーの商品数を除く。
             $arrCategory['has_children'] = false; // 商品一覧ページに遷移させるため。
             array_unshift($arrChildren, $arrCategory);
Index: branches/version-2_11-dev/data/class/SC_CustomerList.php
===================================================================
--- branches/version-2_11-dev/data/class/SC_CustomerList.php	(revision 21407)
+++ branches/version-2_11-dev/data/class/SC_CustomerList.php	(revision 21410)
@@ -302,11 +302,11 @@
         }
 
-        // カテゴリを選択している場合のみ絞込検索を行う
+        // カテゴリーを選択している場合のみ絞込検索を行う
         if (!isset($this->arrSql['search_category_id'])) $this->arrSql['search_category_id'] = "";
         if ( strlen($this->arrSql['search_category_id']) > 0){
-            // カテゴリで絞込検索を行うSQL文生成
+            // カテゴリーで絞込検索を行うSQL文生成
             list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql['search_category_id']);
 
-            // カテゴリで絞込みが可能の場合
+            // カテゴリーで絞込みが可能の場合
             if($tmp_where != "") {
                 $this->setWhere( " customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_product_categories WHERE ".$tmp_where." ))) ");
Index: branches/version-2_11-dev/data/class/helper/SC_Helper_DB.php
===================================================================
--- branches/version-2_11-dev/data/class/helper/SC_Helper_DB.php	(revision 21409)
+++ branches/version-2_11-dev/data/class/helper/SC_Helper_DB.php	(revision 21410)
@@ -297,5 +297,5 @@
 
     /**
-     * カテゴリツリーの取得を複数カテゴリで行う.
+     * カテゴリツリーの取得を複数カテゴリーで行う.
      *
      * @param integer $product_id 商品ID
@@ -346,8 +346,8 @@
 
     /**
-     * 親カテゴリを連結した文字列を取得する.
+     * 親カテゴリーを連結した文字列を取得する.
      *
      * @param integer $category_id カテゴリID
-     * @return string 親カテゴリを連結した文字列
+     * @return string 親カテゴリーを連結した文字列
      */
     function sfGetCatCombName($category_id){
@@ -357,5 +357,5 @@
         $ConbName = "";
 
-        // カテゴリ名称を取得する
+        // カテゴリー名称を取得する
         foreach($arrCatID as $key => $val){
             $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
@@ -371,13 +371,13 @@
 
     /**
-     * 指定したカテゴリIDのカテゴリを取得する.
+     * 指定したカテゴリーIDのカテゴリーを取得する.
      *
      * @param integer $category_id カテゴリID
-     * @return array 指定したカテゴリIDのカテゴリ
+     * @return array 指定したカテゴリーIDのカテゴリー
      */
     function sfGetCat($category_id){
         $objQuery =& SC_Query_Ex::getSingletonInstance();
 
-        // カテゴリを取得する
+        // カテゴリーを取得する
         $arrVal = array($category_id);
         $res = $objQuery->select('category_id AS id, category_name AS name', 'dtb_category', 'category_id = ?', $arrVal);
@@ -387,8 +387,8 @@
 
     /**
-     * 指定したカテゴリIDの大カテゴリを取得する.
+     * 指定したカテゴリーIDの大カテゴリーを取得する.
      *
      * @param integer $category_id カテゴリID
-     * @return array 指定したカテゴリIDの大カテゴリ
+     * @return array 指定したカテゴリーIDの大カテゴリー
      */
     function sfGetFirstCat($category_id){
@@ -399,5 +399,5 @@
         $arrRet['id'] = $arrCatID[0];
 
-        // カテゴリ名称を取得する
+        // カテゴリー名称を取得する
         $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
         $arrVal = array($arrRet['id']);
@@ -448,5 +448,5 @@
 
     /**
-     * カテゴリツリーの取得を行う.
+     * カテゴリーツリーの取得を行う.
      *
      * 親カテゴリの Value=0 を対象とする
@@ -656,9 +656,9 @@
         $sql_where = 'alldtl.del_flg = 0 AND alldtl.status = 1';
         // 在庫無し商品の非表示
-        if (NOSTOCK_HIDDEN) {
-            $sql_where_dtl = '(stock >= 1 OR stock_unlimited = 1)';
+        if (NOSTOCK_HIDDEN === true) {
+            $sql_where_dtl = 'stock_max >= 1 OR stock_unlimited_max = 1';
             $from = $objProduct->alldtlSQL($sql_where_dtl);
         }else{
-            $from = 'dtb_products as alldtl';
+            $from = " dtb_products as alldtl ";
         }
 
@@ -773,10 +773,5 @@
             $where = "($sql_where) AND ($sql_where_product_ids)";
 
-            $where_products_class = '';
-            if (NOSTOCK_HIDDEN) {
-                $where_products_class .= '(stock >= 1 OR stock_unlimited = 1)';
-            }
-
-            $from = $objProduct->alldtlSQL($where_products_class);
+            $from = $objProduct->alldtlSQL($sql_where_product_ids);
             $sql = "SELECT count(*) FROM $from WHERE $where ";
             $arrUpdateData[ $category_id ] = $objQuery->getOne($sql, $arrval);
Index: branches/version-2_11-dev/data/class/SC_Product.php
===================================================================
--- branches/version-2_11-dev/data/class/SC_Product.php	(revision 21409)
+++ branches/version-2_11-dev/data/class/SC_Product.php	(revision 21410)
@@ -180,5 +180,5 @@
      * @param SC_Query $objQuery SC_Query インスタンス
      * @param array|int $arrProductId 商品ID
-     * @return array 商品一覧の配列 (キー: 商品ID)
+     * @return array 商品一覧の配列
      */
     function getListByProductIds(&$objQuery, $arrProductId = array()) {
@@ -191,25 +191,6 @@
 
         $objQuery->setWhere($where, $arrProductId);
-        $arrProducts = $this->lists($objQuery);
-
-        // 配列のキーを商品IDに
-        $arrTmp = array();
-        foreach($arrProducts as $arrProduct) {
-            $arrTmp[$arrProduct['product_id']] = $arrProduct;
-        }
-        $arrProducts =& $arrTmp;
-        unset($arrTmp);
-
-        // SC_Query::setOrder() の指定がない場合、$arrProductId で指定された商品IDの順に配列要素を並び替え
-        if (strlen($objQuery->order) === 0) {
-            $arrTmp = array();
-            foreach ($arrProductId as $product_id) {
-                $arrTmp[$product_id] = $arrProducts[$product_id];
-            }
-            $arrProducts =& $arrTmp;
-            unset($arrTmp);
-        }
-
-        return $arrProducts;
+        $arrRet = $this->lists($objQuery);
+        return $arrRet;
     }
 
@@ -683,11 +664,11 @@
      * 商品詳細の SQL を取得する.
      *
-     * @param string $where_products_class 商品規格情報の WHERE 句
+     * @param string $where 商品詳細の WHERE 句
      * @return string 商品詳細の SQL
      */
-    function alldtlSQL($where_products_class = '') {
-        $where_clause = '';
-        if (!SC_Utils_Ex::isBlank($where_products_class)) {
-            $where_clause = 'WHERE ' . $where_products_class;
+    function alldtlSQL($where = "") {
+        $where_clause = "";
+        if (!SC_Utils_Ex::isBlank($where)) {
+            $where_clause = " WHERE " . $where;
         }
         /*
Index: branches/version-2_11-dev/test/createEcCubeData-v25.php
===================================================================
--- branches/version-2_11-dev/test/createEcCubeData-v25.php	(revision 21402)
+++ branches/version-2_11-dev/test/createEcCubeData-v25.php	(revision 21410)
@@ -659,5 +659,5 @@
 
     /**
-    * 総カテゴリ数を計算し、dtb_categoryに代入するrankに使う
+    * 総カテゴリー数を計算し、dtb_categoryに代入するrankに使う
     */
     function lfGetTotalCategoryrank(){
