Skip to content

Commit c433f19

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Added type checks
2 parents 66c883c + b3ac352 commit c433f19

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

ext/soap/php_encoding.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

ext/soap/soap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3997,7 +3997,8 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
39973997
}
39983998

39993999
if (version == SOAP_1_1) {
4000-
if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS) {
4000+
if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS &&
4001+
Z_TYPE_PP(tmp) == IS_STRING) {
40014002
size_t new_len;
40024003
xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode"));
40034004
char *str = php_escape_html_entities((unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
@@ -4022,7 +4023,8 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
40224023
}
40234024
detail_name = "detail";
40244025
} else {
4025-
if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS) {
4026+
if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS &&
4027+
Z_TYPE_PP(tmp) == IS_STRING) {
40264028
size_t new_len;
40274029
xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL);
40284030
char *str = php_escape_html_entities((unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);

0 commit comments

Comments
 (0)