@@ -402,12 +402,15 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
402402 encodePtr enc = NULL ;
403403 HashTable * ht = Z_OBJPROP_P (data );
404404
405- if (zend_hash_find (ht , "enc_type" , sizeof ("enc_type" ), (void * * )& ztype ) == FAILURE ) {
405+ if (zend_hash_find (ht , "enc_type" , sizeof ("enc_type" ), (void * * )& ztype ) == FAILURE ||
406+ Z_TYPE_PP (ztype ) != IS_LONG ) {
406407 soap_error0 (E_ERROR , "Encoding: SoapVar has no 'enc_type' property" );
407408 }
408409
409- if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS ) {
410- if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS ) {
410+ if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS &&
411+ Z_TYPE_PP (zstype ) == IS_STRING ) {
412+ if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS &&
413+ Z_TYPE_PP (zns ) == IS_STRING ) {
411414 enc = get_encoder (SOAP_GLOBAL (sdl ), Z_STRVAL_PP (zns ), Z_STRVAL_PP (zstype ));
412415 } else {
413416 zns = NULL ;
@@ -443,19 +446,23 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
443446 }
444447
445448 if (style == SOAP_ENCODED || (SOAP_GLOBAL (sdl ) && encode != enc )) {
446- if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS ) {
447- if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS ) {
449+ if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS &&
450+ Z_TYPE_PP (zstype ) == IS_STRING ) {
451+ if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS &&
452+ Z_TYPE_PP (zns ) == IS_STRING ) {
448453 set_ns_and_type_ex (node , Z_STRVAL_PP (zns ), Z_STRVAL_PP (zstype ));
449454 } else {
450455 set_ns_and_type_ex (node , NULL , Z_STRVAL_PP (zstype ));
451456 }
452457 }
453458 }
454459
455- if (zend_hash_find (ht , "enc_name" , sizeof ("enc_name" ), (void * * )& zname ) == SUCCESS ) {
460+ if (zend_hash_find (ht , "enc_name" , sizeof ("enc_name" ), (void * * )& zname ) == SUCCESS &&
461+ Z_TYPE_PP (zname ) == IS_STRING ) {
456462 xmlNodeSetName (node , BAD_CAST (Z_STRVAL_PP (zname )));
457463 }
458- if (zend_hash_find (ht , "enc_namens" , sizeof ("enc_namens" ), (void * * )& znamens ) == SUCCESS ) {
464+ if (zend_hash_find (ht , "enc_namens" , sizeof ("enc_namens" ), (void * * )& znamens ) == SUCCESS &&
465+ Z_TYPE_PP (zname ) == IS_STRING ) {
459466 xmlNsPtr nsp = encode_add_ns (node , Z_STRVAL_PP (znamens ));
460467 xmlSetNs (node , nsp );
461468 }
0 commit comments