@@ -404,12 +404,15 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
404404 encodePtr enc = NULL ;
405405 HashTable * ht = Z_OBJPROP_P (data );
406406
407- if (zend_hash_find (ht , "enc_type" , sizeof ("enc_type" ), (void * * )& ztype ) == FAILURE ) {
407+ if (zend_hash_find (ht , "enc_type" , sizeof ("enc_type" ), (void * * )& ztype ) == FAILURE ||
408+ Z_TYPE_PP (ztype ) != IS_LONG ) {
408409 soap_error0 (E_ERROR , "Encoding: SoapVar has no 'enc_type' property" );
409410 }
410411
411- if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS ) {
412- if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS ) {
412+ if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS &&
413+ Z_TYPE_PP (zstype ) == IS_STRING ) {
414+ if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS &&
415+ Z_TYPE_PP (zns ) == IS_STRING ) {
413416 enc = get_encoder (SOAP_GLOBAL (sdl ), Z_STRVAL_PP (zns ), Z_STRVAL_PP (zstype ));
414417 } else {
415418 zns = NULL ;
@@ -445,19 +448,23 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
445448 }
446449
447450 if (style == SOAP_ENCODED || (SOAP_GLOBAL (sdl ) && encode != enc )) {
448- if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS ) {
449- if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS ) {
451+ if (zend_hash_find (ht , "enc_stype" , sizeof ("enc_stype" ), (void * * )& zstype ) == SUCCESS &&
452+ Z_TYPE_PP (zstype ) == IS_STRING ) {
453+ if (zend_hash_find (ht , "enc_ns" , sizeof ("enc_ns" ), (void * * )& zns ) == SUCCESS &&
454+ Z_TYPE_PP (zns ) == IS_STRING ) {
450455 set_ns_and_type_ex (node , Z_STRVAL_PP (zns ), Z_STRVAL_PP (zstype ));
451456 } else {
452457 set_ns_and_type_ex (node , NULL , Z_STRVAL_PP (zstype ));
453458 }
454459 }
455460 }
456461
457- if (zend_hash_find (ht , "enc_name" , sizeof ("enc_name" ), (void * * )& zname ) == SUCCESS ) {
462+ if (zend_hash_find (ht , "enc_name" , sizeof ("enc_name" ), (void * * )& zname ) == SUCCESS &&
463+ Z_TYPE_PP (zname ) == IS_STRING ) {
458464 xmlNodeSetName (node , BAD_CAST (Z_STRVAL_PP (zname )));
459465 }
460- if (zend_hash_find (ht , "enc_namens" , sizeof ("enc_namens" ), (void * * )& znamens ) == SUCCESS ) {
466+ if (zend_hash_find (ht , "enc_namens" , sizeof ("enc_namens" ), (void * * )& znamens ) == SUCCESS &&
467+ Z_TYPE_PP (zname ) == IS_STRING ) {
461468 xmlNsPtr nsp = encode_add_ns (node , Z_STRVAL_PP (znamens ));
462469 xmlSetNs (node , nsp );
463470 }
0 commit comments