Ignore:
Timestamp:
2011/10/25 00:02:55 (13 years ago)
Author:
Seasoft
Message:

#1521 (PEAR::SOAP 配布と異なる部分がある)

  • 新しいバージョンの配布ファイルを上書きすることで解決

#1522 (PEAR::SOAP をバージョンアップ)

  • 0.11.0 -> 0.12.0
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/module/SOAP/Base.php

    r20119 r21299  
    2525 */ 
    2626 
     27/** Define linebreak sequence for the Mail_Mime package. */ 
    2728define('MAIL_MIMEPART_CRLF', "\r\n"); 
     29 
    2830require_once 'PEAR.php'; 
    2931 
     
    3537} 
    3638 
    37 define('SOAP_LIBRARY_VERSION', '0.11.0'); 
    38 define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.11.0-beta'); 
     39define('SOAP_LIBRARY_VERSION', '0.12.0'); 
     40define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.12.0-beta'); 
    3941 
    4042// Set schema version. 
     
    6163define('SOAP_DEFAULT_ENCODING',  'UTF-8'); 
    6264 
     65/** 
     66 * @package SOAP 
     67 */ 
    6368class SOAP_Base_Object extends PEAR 
    6469{ 
     
    116121        $is_instance = isset($this) && is_a($this, 'SOAP_Base_Object'); 
    117122        if (is_object($str)) { 
    118             $fault =& $str; 
     123            $fault = $str; 
    119124        } else { 
    120125            if (!$code) { 
     
    122127            } 
    123128            require_once 'SOAP/Fault.php'; 
    124             $fault =& new SOAP_Fault($str, 
    125                                      $code, 
    126                                      $actorURI, 
    127                                      $detail, 
    128                                      $mode, 
    129                                      $options); 
     129            $fault = new SOAP_Fault($str, $code, $actorURI, $detail, $mode, 
     130                                    $options); 
    130131        } 
    131132        if ($is_instance) { 
    132             $this->fault =& $fault; 
     133            $this->fault = $fault; 
    133134        } 
    134135 
     
    241242     * Hash with used namespaces. 
    242243     * 
    243      * @array 
     244     * @var array 
    244245     */ 
    245246    var $_namespaces; 
     
    248249     * The default namespace. 
    249250     * 
    250      * @string 
     251     * @var string 
    251252     */ 
    252253    var $_namespace; 
     
    287288 
    288289    /** 
     290     * Sets the SOAP-ENV prefix and returns the current value. 
     291     * 
     292     * @access public 
     293     * 
     294     * @param string SOAP-ENV prefix 
     295     * 
     296     * @return string current SOAP-ENV prefix. 
     297     */ 
     298    function SOAPENVPrefix($prefix = null) 
     299    { 
     300        static $_soapenv_prefix = 'SOAP-ENV'; 
     301        if (!is_null($prefix)) { 
     302            $_soapenv_prefix = $prefix; 
     303        } 
     304        return $_soapenv_prefix; 
     305    } 
     306 
     307    /** 
     308     * Sets the SOAP-ENC prefix and returns the current value. 
     309     * 
     310     * @access public 
     311     * 
     312     * @param string SOAP-ENC prefix 
     313     * 
     314     * @return string current SOAP-ENC prefix. 
     315     */ 
     316    function SOAPENCPrefix($prefix = null) 
     317    { 
     318        static $_soapenv_prefix = 'SOAP-ENC'; 
     319        if (!is_null($prefix)) { 
     320            $_soapenv_prefix = $prefix; 
     321        } 
     322        return $_soapenv_prefix; 
     323    } 
     324 
     325    /** 
    289326     * Sets the default namespace. 
    290327     * 
     
    299336    { 
    300337        $this->_namespaces = array( 
    301             'http://schemas.xmlsoap.org/soap/envelope/' => 'SOAP-ENV', 
     338            'http://schemas.xmlsoap.org/soap/envelope/' => SOAP_BASE::SOAPENVPrefix(), 
    302339            'http://www.w3.org/2001/XMLSchema' => 'xsd', 
    303340            'http://www.w3.org/2001/XMLSchema-instance' => 'xsi', 
    304             'http://schemas.xmlsoap.org/soap/encoding/' => 'SOAP-ENC'); 
     341            'http://schemas.xmlsoap.org/soap/encoding/' => SOAP_BASE::SOAPENCPrefix()); 
    305342    } 
    306343 
     
    347384    } 
    348385 
    349     function _isSoapValue(&$value) 
    350     { 
    351         return is_a($value, 'SOAP_Value'); 
    352     } 
    353  
    354     function _serializeValue(&$value, $name = '', $type = false, 
    355                              $elNamespace = null, $typeNamespace = null, 
     386    /** 
     387     * Serializes a value, array or object according to the rules set by this 
     388     * object. 
     389     * 
     390     * @see SOAP_Value 
     391     * 
     392     * @param mixed $value       The actual value. 
     393     * @param QName $name        The value name. 
     394     * @param QName $type        The value type. 
     395     * @param array $options     A list of encoding and serialization options. 
     396     * @param array $attributes  A hash of additional attributes. 
     397     * @param string $artype     The type of any array elements. 
     398     */ 
     399    function _serializeValue($value, $name = null, $type = null, 
    356400                             $options = array(), $attributes = array(), 
    357401                             $artype = '') 
    358402    { 
    359         $namespaces = array(); 
    360         $arrayType = $array_depth = $xmlout_value = null; 
    361         $typePrefix = $elPrefix = $xmlout_offset = $xmlout_arrayType = ''; 
     403        $namespaces  = array(); 
     404        $arrayType   = $array_depth = $xmlout_value = null; 
     405        $typePrefix  = $elPrefix = $xmlout_arrayType = ''; 
    362406        $xmlout_type = $xmlns = $ptype = $array_type_ns = ''; 
    363407 
    364         if (!$name || is_numeric($name)) { 
    365             $name = 'item'; 
     408        if (!$name->name || is_numeric($name->name)) { 
     409            $name->name = 'item'; 
    366410        } 
    367411 
    368412        if ($this->_wsdl) { 
    369413            list($ptype, $arrayType, $array_type_ns, $array_depth) 
    370                 = $this->_wsdl->getSchemaType($type, $name, $typeNamespace); 
     414                = $this->_wsdl->getSchemaType($type, $name); 
    371415        } 
    372416 
     
    378422        } 
    379423        if (!$type) { 
    380             $type = $ptype; 
     424            $type = new QName($ptype); 
    381425        } 
    382426 
    383427        if (strcasecmp($ptype, 'Struct') == 0 || 
    384             strcasecmp($type, 'Struct') == 0) { 
     428            strcasecmp($type->name, 'Struct') == 0) { 
    385429            // Struct 
    386             $vars = null; 
    387             if (is_object($value)) { 
    388                 $vars = get_object_vars($value); 
    389             } else { 
    390                 $vars = &$value; 
    391             } 
     430            $vars = is_object($value) ? get_object_vars($value) : $value; 
    392431            if (is_array($vars)) { 
    393432                foreach (array_keys($vars) as $k) { 
     
    396435                        continue; 
    397436                    } 
     437 
    398438                    if (is_object($vars[$k])) { 
    399439                        if (is_a($vars[$k], 'SOAP_Value')) { 
     
    403443                            // converting to an array is more overhead than we 
    404444                            // should really do. 
    405                             $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5 ? null : $elNamespace); 
     445                            $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), new QName($k, $this->_section5 ? null : $name->namepace), null, $options); 
    406446                        } 
    407447                    } else { 
    408                         $xmlout_value .= $this->_serializeValue($vars[$k], $k, false, $this->_section5 ? null : $elNamespace); 
     448                        $xmlout_value .= $this->_serializeValue($vars[$k], new QName($k, $this->_section5 ? null : $name->namespace), false, $options); 
    409449                    } 
    410450                } 
    411451            } 
    412452        } elseif (strcasecmp($ptype, 'Array') == 0 || 
    413                   strcasecmp($type, 'Array') == 0) { 
     453                  strcasecmp($type->name, 'Array') == 0) { 
    414454            // Array. 
    415             $typeNamespace = SOAP_SCHEMA_ENCODING; 
    416             $orig_type = $type; 
    417             $type = 'Array'; 
     455            $type = new QName('Array', SOAP_SCHEMA_ENCODING); 
    418456            $numtypes = 0; 
    419457            $value = (array)$value; 
     
    439477                $ar_size = count($value); 
    440478                foreach ($value as $array_val) { 
    441                     if ($this->_isSoapValue($array_val)) { 
     479                    if (is_a($array_val, 'SOAP_Value')) { 
    442480                        $array_type = $array_val->type; 
    443481                        $array_types[$array_type] = 1; 
     
    447485                        $array_type = $this->_getType($array_val); 
    448486                        $array_types[$array_type] = 1; 
    449                         $xmlout_value .= $this->_serializeValue($array_val, 'item', $array_type, $this->_section5 ? null : $elNamespace); 
     487                        if (empty($options['keep_arrays_flat'])) { 
     488                            $xmlout_value .= $this->_serializeValue($array_val, new QName('item', $this->_section5 ? null : $name->namespace), new QName($array_type), $options); 
     489                        } else { 
     490                            $xmlout_value .= $this->_serializeValue($array_val, $name, new QName($array_type), $options, $attributes); 
     491                        } 
    450492                    } 
    451493                } 
    452494 
    453                 $xmlout_offset = ' SOAP-ENC:offset="[0]"'; 
    454495                if (!$arrayType) { 
    455496                    $numtypes = count($array_types); 
     
    478519                } elseif (isset($this->_typemap[$this->_XMLSchemaVersion][$arrayType])) { 
    479520                    $array_type_prefix = $this->_namespaces[$this->_XMLSchemaVersion]; 
     521                } elseif (isset($this->_typemap[SOAP_SCHEMA_ENCODING][$arrayType])) { 
     522                    $array_type_prefix = SOAP_BASE::SOAPENCPrefix(); 
    480523                } 
    481524                if ($array_type_prefix) { 
     
    484527            } 
    485528 
    486             $xmlout_arrayType = ' SOAP-ENC:arrayType="' . $arrayType; 
     529            $xmlout_arrayType = ' ' . SOAP_BASE::SOAPENCPrefix() 
     530                . ':arrayType="' . $arrayType; 
    487531            if ($array_depth != null) { 
    488532                for ($i = 0; $i < $array_depth; $i++) { 
     
    491535            } 
    492536            $xmlout_arrayType .= "[$ar_size]\""; 
    493         } elseif ($this->_isSoapValue($value)) { 
     537        } elseif (is_a($value, 'SOAP_Value')) { 
    494538            $xmlout_value = $value->serialize($this); 
    495         } elseif ($type == 'string') { 
     539        } elseif ($type->name == 'string') { 
    496540            $xmlout_value = htmlspecialchars($value); 
    497         } elseif ($type == 'rawstring') { 
    498             $xmlout_value =& $value; 
    499         } elseif ($type == 'boolean') { 
     541        } elseif ($type->name == 'rawstring') { 
     542            $xmlout_value = $value; 
     543        } elseif ($type->name == 'boolean') { 
    500544            $xmlout_value = $value ? 'true' : 'false'; 
    501545        } else { 
    502             $xmlout_value =& $value; 
     546            $xmlout_value = $value; 
    503547        } 
    504548 
    505549        // Add namespaces. 
    506         if ($elNamespace) { 
    507             $elPrefix = $this->_getNamespacePrefix($elNamespace); 
     550        if ($name->namespace) { 
     551            $elPrefix = $this->_getNamespacePrefix($name->namespace); 
    508552            if ($elPrefix) { 
    509                 $xmlout_name = "$elPrefix:$name"; 
     553                $xmlout_name = $elPrefix . ':' . $name->name; 
    510554            } else { 
    511                 $xmlout_name = $name; 
     555                $xmlout_name = $name->name; 
    512556            } 
    513557        } else { 
    514             $xmlout_name = $name; 
    515         } 
    516  
    517         if ($typeNamespace) { 
    518             $typePrefix = $this->_getNamespacePrefix($typeNamespace); 
     558            $xmlout_name = $name->name; 
     559        } 
     560 
     561        if ($type->namespace) { 
     562            $typePrefix = false; 
     563            if (empty($options['no_type_prefix'])) { 
     564                $typePrefix = $this->_getNamespacePrefix($type->namespace); 
     565            } 
    519566            if ($typePrefix) { 
    520                 $xmlout_type = "$typePrefix:$type"; 
     567                $xmlout_type = $typePrefix . ':' . $type->name; 
    521568            } else { 
    522                 $xmlout_type = $type; 
    523             } 
    524         } elseif ($type && 
    525                   isset($this->_typemap[$this->_XMLSchemaVersion][$type])) { 
     569                $xmlout_type = $type->name; 
     570            } 
     571        } elseif ($type->name && 
     572                  isset($this->_typemap[$this->_XMLSchemaVersion][$type->name])) { 
    526573            $typePrefix = $this->_namespaces[$this->_XMLSchemaVersion]; 
    527574            if ($typePrefix) { 
    528                 $xmlout_type = "$typePrefix:$type"; 
     575                $xmlout_type = $typePrefix . ':' . $type->name; 
    529576            } else { 
    530                 $xmlout_type = $type; 
     577                $xmlout_type = $type->name; 
    531578            } 
    532579        } 
     
    557604            } else { 
    558605                $xml = "\r\n<$xmlout_name$xmlout_type$xmlns$xmlout_arrayType" . 
    559                     "$xmlout_offset$xml_attr>$xmlout_value</$xmlout_name>"; 
    560             } 
     606                    "$xml_attr>$xmlout_value</$xmlout_name>"; 
     607            } 
     608        } elseif ($type->name == 'Array' && !empty($options['keep_arrays_flat'])) { 
     609            $xml = $xmlout_value; 
    561610        } else { 
    562611            if (is_null($xmlout_value)) { 
     
    574623     * Converts a PHP type to a SOAP type. 
    575624     * 
    576      * @access   private 
    577      * 
    578      * @param string $value  The value to inspect. 
     625     * @param mixed $value  The value to inspect. 
    579626     * 
    580627     * @return string  The value's SOAP type. 
    581628     */ 
    582     function _getType(&$value) 
     629    function _getType($value) 
    583630    { 
    584631        $type = gettype($value); 
     
    596643            if ($this->_isHash($value)) { 
    597644                $type = 'Struct'; 
    598             } else { 
    599                 $ar_size = count($value); 
     645                break; 
     646            } 
     647            if (count($value) > 1) { 
     648                // For non-wsdl structs that are all the same type 
    600649                reset($value); 
    601                 $key1 = key($value); 
    602                 if ($ar_size > 0 && is_a($key1, 'SOAP_Value')) { 
    603                     // FIXME: for non-wsdl structs that are all the same type 
    604                     $key2 = key($value); 
    605                     if ($ar_size > 1 && 
    606                         $this->_isSoapValue($key1) && 
    607                         $this->_isSoapValue($key2) && 
    608                         $key1->name != $key2->name) { 
    609                         // This is a struct, not an array. 
    610                         $type = 'Struct'; 
    611                     } else { 
    612                         $type = 'Array'; 
    613                     } 
    614                 } else { 
    615                     $type = 'Array'; 
     650                $value1 = next($value); 
     651                $value2 = next($value); 
     652                if (is_a($value1, 'SOAP_Value') && 
     653                    is_a($value2, 'SOAP_Value') && 
     654                    $value1->name != $value2->name) { 
     655                    // This is a struct, not an array. 
     656                    $type = 'Struct'; 
     657                    break; 
    616658                } 
    617659            } 
     660            $type = 'Array'; 
    618661            break; 
    619662 
     
    664707        } else { 
    665708            $type = $this->_getType($value); 
    666             $xml .= $this->_serializeValue($value, 'item', $type); 
     709            $xml .= $this->_serializeValue($value, new QName('item'), new QName($type)); 
    667710        } 
    668711        $size = null; 
     
    690733     * @return boolean  True if the specified array is a hash. 
    691734     */ 
    692     function _isHash(&$a) 
    693     { 
    694         // I really dislike having to loop through this in PHP code, really 
    695         // large arrays will be slow.  We need a C function to do this. 
    696         $it = 0; 
    697         foreach ($a as $k => $v) { 
     735    function _isHash($a) 
     736    { 
     737        foreach (array_keys($a) as $k) { 
    698738            // Checking the type is faster than regexp. 
    699739            if (!is_int($k)) { 
    700740                return true; 
    701741            } 
    702             // If someone has a large hash they should really be defining the 
    703             // type. 
    704             if ($it++ > 10) { 
    705                 $this->_raiseSoapFault('Large associative array passed where a SOAP_Value was expected'); 
    706                 return false; 
    707             } 
    708742        } 
    709743        return false; 
     
    718752 
    719753    /** 
    720     *   Converts a SOAP_Value object into a StdClass PHP object 
    721     */ 
    722     function &_decode(&$soapval) 
    723     { 
    724         if (!$this->_isSoapValue($soapval)) { 
     754     * Converts a SOAP_Value object into a PHP value. 
     755     */ 
     756    function _decode($soapval) 
     757    { 
     758        if (!is_a($soapval, 'SOAP_Value')) { 
    725759            return $soapval; 
    726         } elseif (is_array($soapval->value)) { 
    727             if ($soapval->type != 'Array') { 
     760        } 
     761 
     762        if (is_array($soapval->value)) { 
     763            $isstruct = $soapval->type != 'Array'; 
     764            if ($isstruct) { 
    728765                $classname = $this->_defaultObjectClassname; 
    729766                if (isset($this->_type_translation[$soapval->tqn->fqn()])) { 
     
    745782                    } 
    746783                } 
    747                 $return =& new $classname; 
     784                $return = new $classname; 
    748785            } else { 
    749786                $return = array(); 
    750787            } 
    751788 
    752             $counter = 1; 
    753             $isstruct = !is_array($return); 
    754789            foreach ($soapval->value as $item) { 
    755                 if (is_object($return)) { 
     790                if ($isstruct) { 
    756791                    if ($this->_wsdl) { 
    757792                        // Get this child's WSDL information. 
     
    766801                        } 
    767802                    } 
    768                     if (!$isstruct || $item->type == 'Array') { 
     803                    if ($item->type == 'Array') { 
    769804                        if (isset($return->{$item->name}) && 
    770805                            is_object($return->{$item->name})) { 
    771                             $return->{$item->name} =& $this->_decode($item); 
     806                            $return->{$item->name} = $this->_decode($item); 
    772807                        } elseif (isset($return->{$item->name}) && 
    773808                                  is_array($return->{$item->name})) { 
     
    779814                            ); 
    780815                        } elseif (is_array($return)) { 
    781                             $return[] =& $this->_decode($item); 
     816                            $return[] = $this->_decode($item); 
    782817                        } else { 
    783                             $return->{$item->name} =& $this->_decode($item); 
     818                            $return->{$item->name} = $this->_decode($item); 
    784819                        } 
    785820                    } elseif (isset($return->{$item->name})) { 
    786                         //$isstruct = false; 
     821                        $d = $this->_decode($item); 
    787822                        if (count(get_object_vars($return)) == 1) { 
    788                             $d =& $this->_decode($item); 
     823                            $isstruct = false; 
    789824                            $return = array($return->{$item->name}, $d); 
    790825                        } else { 
    791                             $d =& $this->_decode($item); 
    792826                            $return->{$item->name} = array($return->{$item->name}, $d); 
    793827                        } 
    794828                    } else { 
    795                         $return->{$item->name} =& $this->_decode($item); 
     829                        $return->{$item->name} = $this->_decode($item); 
    796830                    } 
    797831                    // Set the attributes as members in the class. 
     
    804838                    } 
    805839                } else { 
    806                     if ($soapval->arrayType && $this->_isSoapValue($item)) { 
     840                    if ($soapval->arrayType && is_a($item, 'SOAP_Value')) { 
    807841                        if ($this->_isBase64Type($item->type) && 
    808842                            !$this->_isBase64Type($soapval->arrayType)) { 
     
    813847                        $item->type = $soapval->arrayType; 
    814848                    } 
    815                     if (!$isstruct) { 
    816                         $return[] = $this->_decode($item); 
    817                     } elseif (isset($return[$item->name])) { 
    818                         $isstruct = false; 
    819                         $d =& $this->_decode($item); 
    820                         $return = array($return[$item->name], $d); 
    821                     } else { 
    822                         $return[$item->name] = $this->_decode($item); 
    823                     } 
     849                    $return[] = $this->_decode($item); 
    824850                } 
    825851            } 
     
    840866            settype($soapval->value, 
    841867                    $this->_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]); 
     868        } elseif ($soapval->type == 'Struct') { 
     869            $soapval->value = null; 
    842870        } 
    843871 
     
    848876     * Creates the SOAP envelope with the SOAP envelop data. 
    849877     * 
    850      * @param mixed $method 
    851      * @param array $headers 
    852      * @param string $encoding 
    853      * @param array $options 
    854      * 
    855      * @return string 
    856      */ 
    857     function makeEnvelope(&$method, &$headers, 
    858                           $encoding = SOAP_DEFAULT_ENCODING, 
     878     * @param SOAP_Value $method  SOAP_Value instance with the method name as 
     879     *                            the name, and the method arguments as the 
     880     *                            value. 
     881     * @param array $headers      A list of additional SOAP_Header objects. 
     882     * @param string $encoding    The charset of the SOAP message. 
     883     * @param array $options      A list of encoding/serialization options. 
     884     * 
     885     * @return string  The complete SOAP message. 
     886     */ 
     887    function makeEnvelope($method, $headers, $encoding = SOAP_DEFAULT_ENCODING, 
    859888                          $options = array()) 
    860889    { 
     
    862891 
    863892        if ($headers) { 
    864             $c = count($headers); 
    865             for ($i = 0; $i < $c; $i++) { 
     893            for ($i = 0, $c = count($headers); $i < $c; $i++) { 
    866894                $header_xml .= $headers[$i]->serialize($this); 
    867895            } 
    868             $header_xml = "<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n"; 
     896            $header_xml = sprintf("<%s:Header>\r\n%s\r\n</%s:Header>\r\n", 
     897                                  SOAP_BASE::SOAPENVPrefix(), $header_xml, 
     898                                  SOAP_BASE::SOAPENVPrefix()); 
    869899        } 
    870900 
    871901        if (!isset($options['input']) || $options['input'] == 'parse') { 
    872902            if (is_array($method)) { 
    873                 $c = count($method); 
    874                 for ($i = 0; $i < $c; $i++) { 
     903                for ($i = 0, $c = count($method); $i < $c; $i++) { 
    875904                    $smsg .= $method[$i]->serialize($this); 
    876905                } 
     
    881910            $smsg = $method; 
    882911        } 
    883         $body = "<SOAP-ENV:Body>\r\n" . $smsg . "\r\n</SOAP-ENV:Body>\r\n"; 
     912        $body = sprintf("<%s:Body>%s\r\n</%s:Body>\r\n", 
     913                        SOAP_BASE::SOAPENVPrefix(), $smsg, 
     914                        SOAP_BASE::SOAPENVPrefix()); 
    884915 
    885916        foreach ($this->_namespaces as $k => $v) { 
    886             $ns_string .= " xmlns:$v=\"$k\"\r\n"; 
     917            $ns_string .= "\r\n " . sprintf('xmlns:%s="%s"', $v, $k); 
    887918        } 
    888919        if ($this->_namespace) { 
    889             $ns_string .= " xmlns=\"{$this->_namespace}\"\r\n"; 
    890         } 
    891  
    892         /* If 'use' == 'literal', we do not put in the encodingStyle.  This is 
     920            $ns_string .= "\r\n " . sprintf('xmlns="%s"', $this->_namespace); 
     921        } 
     922 
     923        /* If 'use' == 'literal', do not put in the encodingStyle.  This is 
    893924         * denoted by $this->_section5 being false.  'use' can be defined at a 
    894925         * more granular level than we are dealing with here, so this does not 
    895926         * work for all services. */ 
    896         $xml = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n". 
    897             "<SOAP-ENV:Envelope $ns_string". 
    898             ($this->_section5 ? ' SOAP-ENV:encodingStyle="' . SOAP_SCHEMA_ENCODING . '"' : ''). 
    899             ">\r\n". 
    900             "$header_xml$body</SOAP-ENV:Envelope>\r\n"; 
     927        $xml = sprintf('<?xml version="1.0" encoding="%s"?>%s<%s:Envelope%s', 
     928                       $encoding, "\r\n", SOAP_BASE::SOAPENVPrefix(), 
     929                       $ns_string); 
     930        if ($this->_section5) { 
     931            $xml .= "\r\n " . sprintf('%s:encodingStyle="%s"', 
     932                                      SOAP_BASE::SOAPENVPrefix(), 
     933                                      SOAP_SCHEMA_ENCODING); 
     934        } 
     935        $xml .= sprintf('>%s%s%s</%s:Envelope>' . "\r\n", 
     936                        "\r\n", $header_xml, $body, SOAP_BASE::SOAPENVPrefix()); 
    901937 
    902938        return $xml; 
     
    917953        $params['content_type'] = 'text/xml'; 
    918954        $params['charset'] = $encoding; 
    919         $params['encoding'] = 'base64'; 
    920955        $msg->addSubPart($xml, $params); 
    921956 
     
    9661001 
    9671002        // Lame thing to have to do for decoding. 
    968         $decoder =& new Mail_mimeDecode($data); 
     1003        $decoder = new Mail_mimeDecode($data); 
    9691004        $structure = $decoder->decode($params); 
    9701005 
     
    9781013            $headers = array_merge($structure->headers, 
    9791014                                   $structure->parts[0]->headers); 
    980             if (count($structure->parts) > 1) { 
    981                 $mime_parts = array_splice($structure->parts,1); 
    982                 // Prepare the parts for the SOAP parser. 
    983  
    984                 $c = count($mime_parts); 
    985                 for ($i = 0; $i < $c; $i++) { 
    986                     $p =& $mime_parts[$i]; 
    987                     if (isset($p->headers['content-location'])) { 
    988                         // TODO: modify location per SwA note section 3 
    989                         // http://www.w3.org/TR/SOAP-attachments 
    990                         $attachments[$p->headers['content-location']] = $p->body; 
    991                     } else { 
    992                         $cid = 'cid:' . substr($p->headers['content-id'], 1, -1); 
    993                         $attachments[$cid] = $p->body; 
    994                     } 
     1015            if (count($structure->parts) <= 1) { 
     1016                return; 
     1017            } 
     1018 
     1019            $mime_parts = array_splice($structure->parts, 1); 
     1020            // Prepare the parts for the SOAP parser. 
     1021            for ($i = 0, $c = count($mime_parts); $i < $c; $i++) { 
     1022                $p = $mime_parts[$i]; 
     1023                if (isset($p->headers['content-location'])) { 
     1024                    // TODO: modify location per SwA note section 3 
     1025                    // http://www.w3.org/TR/SOAP-attachments 
     1026                    $attachments[$p->headers['content-location']] = $p->body; 
     1027                } else { 
     1028                    $cid = 'cid:' . substr($p->headers['content-id'], 1, -1); 
     1029                    $attachments[$cid] = $p->body; 
    9951030                } 
    9961031            } 
     
    10101045        // This SHOULD be moved to the transport layer, e.g. PHP itself should 
    10111046        // handle parsing DIME ;) 
    1012         $dime =& new Net_DIME_Message(); 
     1047        $dime = new Net_DIME_Message(); 
    10131048        $err = $dime->decodeData($data); 
    10141049        if (PEAR::isError($err)) { 
     
    10361071 
    10371072    /** 
    1038      * @deprecated Use setTypeTranslation(). 
    1039      */ 
    1040     function __set_type_translation($type, $class = null) 
    1041     { 
    1042         $this->setTypeTranslation($type, $class); 
    1043     } 
    1044  
    1045     /** 
    10461073     * Explicitly sets the translation for a specific class. 
    10471074     * 
     
    10661093 * Class used to handle QNAME values in XML. 
    10671094 * 
    1068  * @access   public 
    10691095 * @package  SOAP 
    10701096 * @author   Shane Caraveo <shane@php.net> Conversion to PEAR and updates 
     
    10741100    var $name = ''; 
    10751101    var $ns = ''; 
    1076     var $namespace=''; 
     1102    var $namespace = ''; 
    10771103 
    10781104    function QName($name, $namespace = '') 
Note: See TracChangeset for help on using the changeset viewer.