Skip to content

Commit fa5d148

Browse files
committed
feedback
1 parent 0bd4a3e commit fa5d148

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

ext/soap/php_encoding.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,8 +1625,7 @@ static zval *to_zval_datetime(zval *ret, encodeTypePtr type, xmlNodePtr data)
16251625
return ret;
16261626
}
16271627

1628-
zend_string *str = zend_string_copy(Z_STR_P(ret));
1629-
zval_ptr_dtor_str(ret);
1628+
zend_string *str = Z_STR_P(ret);
16301629
php_date_instantiate(php_date_get_immutable_ce(), ret);
16311630
if (!php_date_initialize(Z_PHPDATE_P(ret), ZSTR_VAL(str), ZSTR_LEN(str), NULL, NULL, 0)) {
16321631
zval_ptr_dtor(ret);
@@ -1846,6 +1845,11 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo
18461845
return xmlParam;
18471846
}
18481847

1848+
if (data && (Z_TYPE_P(data) == IS_OBJECT &&
1849+
instanceof_function_slow(Z_OBJCE_P(data), php_date_get_interface_ce()))) {
1850+
return master_to_xml(get_conversion(XSD_DATETIME), data, style, parent);
1851+
}
1852+
18491853
if (Z_TYPE_P(data) == IS_OBJECT) {
18501854
prop = Z_OBJPROP_P(data);
18511855
} else if (Z_TYPE_P(data) == IS_ARRAY) {
@@ -2838,11 +2842,7 @@ static xmlNodePtr guess_xml_convert(encodeTypePtr type, zval *data, int style, x
28382842
xmlNodePtr ret;
28392843

28402844
if (data) {
2841-
if (Z_TYPE_P(data) == IS_OBJECT && instanceof_function_slow(Z_OBJCE_P(data), php_date_get_interface_ce())) {
2842-
enc = get_conversion(XSD_DATETIME);
2843-
} else {
2844-
enc = get_conversion(Z_TYPE_P(data));
2845-
}
2845+
enc = get_conversion(Z_TYPE_P(data));
28462846
} else {
28472847
enc = get_conversion(IS_NULL);
28482848
}

0 commit comments

Comments
 (0)