cvs: pear /SOAP Base.php

From: Date: Tue, 23 Jan 2007 17:29:08 +0000
Subject: cvs: pear /SOAP Base.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44362@lists.php.net to get a copy of this message
yunosh Tue Jan 23 17:29:08 2007 UTC Modified files: /pear/SOAP Base.php Log: Fix _isBase64(), simplify _multiArrayType(). http://cvs.php.net/viewvc.cgi/pear/SOAP/Base.php?r1=1.70&r2=1.71&diff_format=u Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.70 pear/SOAP/Base.php:1.71 --- pear/SOAP/Base.php:1.70 Mon Jan 22 14:53:51 2007 +++ pear/SOAP/Base.php Tue Jan 23 17:29:08 2007 @@ -757,32 +757,28 @@ return $type; } - function _multiArrayType(&$value, &$type, &$size, &$xml) + function _multiArrayType($value, &$type, &$size, &$xml) { - $sz = count($value); if (is_array($value)) { // Seems we have a multi dimensional array, figure it out if we // do. - $c = count($value); - for ($i = 0; $i < $c; $i++) { + for ($i = 0, $c = count($value); $i < $c; ++$i) { $this->_multiArrayType($value[$i], $type, $size, $xml); } + $sz = count($value); if ($size) { - $size = $sz. ',' . $size; + $size = $sz . ',' . $size; } else { $size = $sz; } - return 1; + } elseif (is_object($value)) { + $type = $value->type; + $xml .= $value->serialize($this); } else { - if (is_object($value)) { - $type = $value->type; - $xml .= $value->serialize($this); - } else { - $type = $this->_getType($value); - $xml .= $this->_serializeValue($value, 'item', $type); - } + $type = $this->_getType($value); + $xml .= $this->_serializeValue($value, 'item', $type); } $size = null; @@ -796,14 +792,12 @@ * * @return boolean True if the specified value seems to be base64 encoded. */ - function _isBase64(&$value) + function _isBase64($value) { $l = strlen($value); - if ($l) { - return $value[$l - 1] == '=' && - preg_match('/[A-Za-z=\/\+]+/', $value); - } - return false; + return $l && + !preg_match('|[^A-Za-z=/+]|', $value) && + base64_decode($value) !== false; } /**

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