Skip to content

Commit 7dd769c

Browse files
committed
Update property handling
1 parent 52d60e6 commit 7dd769c

File tree

8 files changed

+283
-249
lines changed

8 files changed

+283
-249
lines changed

ext/soap/php_encoding.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -384,17 +384,17 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
384384
Z_OBJCE_P(data) == soap_var_class_entry) {
385385
zval *ztype, *zdata, *zns, *zstype, *zname, *znamens;
386386
encodePtr enc = NULL;
387-
HashTable *ht = Z_OBJPROP_P(data);
387+
zval rv;
388388

389-
if ((ztype = zend_hash_str_find_deref(ht, "enc_type", sizeof("enc_type")-1)) == NULL ||
390-
Z_TYPE_P(ztype) != IS_LONG) {
389+
ztype = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_type", sizeof("enc_type")-1, 1, &rv);
390+
if (ztype == NULL || Z_TYPE_P(ztype) != IS_LONG) {
391391
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
392392
}
393393

394-
if ((zstype = zend_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL &&
395-
Z_TYPE_P(zstype) == IS_STRING) {
396-
if ((zns = zend_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL &&
397-
Z_TYPE_P(zns) == IS_STRING) {
394+
zstype = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_stype", sizeof("enc_stype")-1, 1, &rv);
395+
if (zstype != NULL && Z_TYPE_P(zstype) == IS_STRING) {
396+
zns = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_ns", sizeof("enc_ns")-1, 1, &rv);
397+
if (zns != NULL && Z_TYPE_P(zns) == IS_STRING) {
398398
enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype));
399399
} else {
400400
zns = NULL;
@@ -420,27 +420,27 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
420420
enc = encode;
421421
}
422422

423-
zdata = zend_hash_str_find_deref(ht, "enc_value", sizeof("enc_value")-1);
423+
zdata = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_value", sizeof("enc_value")-1, 1, &rv);
424424
node = master_to_xml(enc, zdata, style, parent);
425425

426426
if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) {
427-
if ((zstype = zend_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL &&
428-
Z_TYPE_P(zstype) == IS_STRING) {
429-
if ((zns = zend_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL &&
430-
Z_TYPE_P(zns) == IS_STRING) {
427+
zstype = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_stype", sizeof("enc_stype")-1, 1, &rv);
428+
if (zstype != NULL && Z_TYPE_P(zstype) == IS_STRING) {
429+
zns = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_ns", sizeof("enc_ns")-1, 1, &rv);
430+
if (zns != NULL && Z_TYPE_P(zns) == IS_STRING) {
431431
set_ns_and_type_ex(node, Z_STRVAL_P(zns), Z_STRVAL_P(zstype));
432432
} else {
433433
set_ns_and_type_ex(node, NULL, Z_STRVAL_P(zstype));
434434
}
435435
}
436436
}
437437

438-
if ((zname = zend_hash_str_find_deref(ht, "enc_name", sizeof("enc_name")-1)) != NULL &&
439-
Z_TYPE_P(zname) == IS_STRING) {
438+
zname = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_name", sizeof("enc_name")-1, 1, &rv);
439+
if (zname != NULL && Z_TYPE_P(zname) == IS_STRING) {
440440
xmlNodeSetName(node, BAD_CAST(Z_STRVAL_P(zname)));
441441
}
442-
if ((znamens = zend_hash_str_find_deref(ht, "enc_namens", sizeof("enc_namens")-1)) != NULL &&
443-
Z_TYPE_P(znamens) == IS_STRING) {
442+
znamens = zend_read_property(soap_var_class_entry, Z_OBJ_P(data), "enc_namens", sizeof("enc_namens")-1, 1, &rv);
443+
if (znamens != NULL && Z_TYPE_P(znamens) == IS_STRING) {
444444
xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_P(znamens));
445445
xmlSetNs(node, nsp);
446446
}
@@ -3472,7 +3472,7 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type)
34723472
{
34733473
HashTable *ht;
34743474
int i, cur_type, prev_type, different;
3475-
zval *tmp;
3475+
zval *tmp, rv;
34763476
char *prev_stype = NULL, *cur_stype = NULL, *prev_ns = NULL, *cur_ns = NULL;
34773477

34783478
if (!array || Z_TYPE_P(array) != IS_ARRAY) {
@@ -3491,21 +3491,21 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type)
34913491
Z_OBJCE_P(tmp) == soap_var_class_entry) {
34923492
zval *ztype;
34933493

3494-
if ((ztype = zend_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL ||
3495-
Z_TYPE_P(ztype) != IS_LONG) {
3494+
ztype = zend_read_property(soap_var_class_entry, Z_OBJ_P(tmp), "enc_type", sizeof("enc_type")-1, 1, &rv);
3495+
if (ztype == NULL || Z_TYPE_P(ztype) != IS_LONG) {
34963496
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
34973497
}
34983498
cur_type = Z_LVAL_P(ztype);
34993499

3500-
if ((ztype = zend_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL &&
3501-
Z_TYPE_P(ztype) == IS_STRING) {
3500+
ztype = zend_read_property(soap_var_class_entry, Z_OBJ_P(tmp), "enc_stype", sizeof("enc_stype")-1, 1, &rv);
3501+
if (ztype != NULL && Z_TYPE_P(ztype) == IS_STRING) {
35023502
cur_stype = Z_STRVAL_P(ztype);
35033503
} else {
35043504
cur_stype = NULL;
35053505
}
35063506

3507-
if ((ztype = zend_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL &&
3508-
Z_TYPE_P(ztype) == IS_STRING) {
3507+
ztype = zend_read_property(soap_var_class_entry, Z_OBJ_P(tmp), "enc_ns", sizeof("enc_ns")-1, 1, &rv);
3508+
if (ztype != NULL && Z_TYPE_P(ztype) == IS_STRING) {
35093509
cur_ns = Z_STRVAL_P(ztype);
35103510
} else {
35113511
cur_ns = NULL;

0 commit comments

Comments
 (0)