@@ -221,6 +221,8 @@ protected function build_msnode($objectarr){
221221 }else if (is_array ($ value )){
222222$ arrData ='' ;
223223
224+ reset ($ value );//Reset array cursor to beginning of array
225+
224226if (key ($ value ) ==='RecordType ' ){
225227$ arrData .='i:type="mem: ' .current ($ value ).'"> ' ;
226228foreach ($ valueas $ k =>$ v ){
@@ -232,7 +234,8 @@ protected function build_msnode($objectarr){
232234$ arrData .=' i:nil="true" /> ' ;
233235}
234236 }
235- }else if (is_array (reset ($ value )) &&key (reset ($ value )) =='ClassType ' ){
237+ // Check key of first element in $value array to see if $value is an array of MS Objects
238+ }else if (key ($ value ) =='ClassType ' ){
236239$ arrData .='i:type="mem:ArrayOfMemberSuiteObject"> ' ;
237240if (key ($ value ) ==='ClassType ' ){
238241$ arrData .='<mem:MemberSuiteObject> ' .$ this ->build_msnode ($ value ).'</mem:MemberSuiteObject> ' ;
@@ -349,4 +352,4 @@ protected function isAddressArray($arr) {
349352return array_key_exists ("bLine1 " ,$ arr )and array_key_exists ("bCity " ,$ arr )and array_key_exists ("bState " ,$ arr )and array_key_exists ("bPostalCode " ,$ arr );
350353 }
351354}
352- ?>
355+ ?>