summaryrefslogtreecommitdiff
path: root/ext/soap/php_encoding.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-03-03 10:43:48 +0300
committerDmitry Stogov <dmitry@zend.com>2015-03-03 10:43:48 +0300
commitc8eaca013a3922e8383def6158ece2b63f6ec483 (patch)
tree11d42fe9a1539345622dcdc95b672e68ff2d2c4c /ext/soap/php_encoding.c
parent0c136a2abd49298b66acb0cad504f0f972f5bfe8 (diff)
downloadphp-git-c8eaca013a3922e8383def6158ece2b63f6ec483.tar.gz
Added type checks
Diffstat (limited to 'ext/soap/php_encoding.c')
-rw-r--r--ext/soap/php_encoding.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index fd9e367872..31f1f7c800 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -404,12 +404,15 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
encodePtr enc = NULL;
HashTable *ht = Z_OBJPROP_P(data);
- if (zend_hash_find(ht, "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
+ if (zend_hash_find(ht, "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE ||
+ Z_TYPE_PP(ztype) != IS_LONG) {
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
}
- if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
- if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
+ if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS &&
+ Z_TYPE_PP(zstype) == IS_STRING) {
+ if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS &&
+ Z_TYPE_PP(zns) == IS_STRING) {
enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
} else {
zns = NULL;
@@ -445,8 +448,10 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
}
if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) {
- if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
- if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
+ if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS &&
+ Z_TYPE_PP(zstype) == IS_STRING) {
+ if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS &&
+ Z_TYPE_PP(zns) == IS_STRING) {
set_ns_and_type_ex(node, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
} else {
set_ns_and_type_ex(node, NULL, Z_STRVAL_PP(zstype));
@@ -454,10 +459,12 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
}
}
- if (zend_hash_find(ht, "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS) {
+ if (zend_hash_find(ht, "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS &&
+ Z_TYPE_PP(zname) == IS_STRING) {
xmlNodeSetName(node, BAD_CAST(Z_STRVAL_PP(zname)));
}
- if (zend_hash_find(ht, "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS) {
+ if (zend_hash_find(ht, "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS &&
+ Z_TYPE_PP(zname) == IS_STRING) {
xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_PP(znamens));
xmlSetNs(node, nsp);
}