mirror of
https://github.com/php/php-src.git
synced 2026-04-07 16:13:32 +02:00
Merge branch 'phpng' of git.php.net:php-src into phpng
# By Dmitry Stogov # Via Dmitry Stogov * 'phpng' of git.php.net:php-src: Fixed WSDL attibute parsing fixed reference counting and memory leak Partial fix for XML references handling Fixed handling of compressed SOAP requests Fixed support for SOAP_PERSISTENCE_SESSION Fixed support for empty strings Buffer has to be reallocated on each loop iteration Support for IS_INDIRECT Buffer has to be reallocated on each loop iteration
This commit is contained in:
@@ -355,7 +355,7 @@ static zval* soap_find_xml_ref(xmlNodePtr node TSRMLS_DC)
|
||||
zval *data_ptr;
|
||||
|
||||
if (SOAP_GLOBAL(ref_map) &&
|
||||
(data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (ulong)node)) != NULL) {
|
||||
(data_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (ulong)node)) != NULL) {
|
||||
//??? Z_SET_ISREF_PP(data_ptr);
|
||||
SEPARATE_ZVAL_TO_MAKE_IS_REF(data_ptr);
|
||||
Z_ADDREF_P(data_ptr);
|
||||
@@ -369,7 +369,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC)
|
||||
zval *data_ptr;
|
||||
|
||||
if (SOAP_GLOBAL(ref_map)) {
|
||||
if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (ulong)node)) != NULL) {
|
||||
if ((data_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (ulong)node)) != NULL) {
|
||||
if (data != data_ptr) {
|
||||
zval_ptr_dtor(data);
|
||||
ZVAL_COPY_VALUE(data, data_ptr);
|
||||
@@ -379,7 +379,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC)
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
zend_hash_index_update(SOAP_GLOBAL(ref_map), (ulong)node, data);
|
||||
zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (ulong)node, data);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -1199,14 +1199,14 @@ static void set_zval_property(zval* object, char* name, zval* val TSRMLS_DC)
|
||||
static zval* get_zval_property(zval* object, char* name, zval *rv TSRMLS_DC)
|
||||
{
|
||||
if (Z_TYPE_P(object) == IS_OBJECT) {
|
||||
zval member, rv;
|
||||
zval member;
|
||||
zval *data;
|
||||
zend_class_entry *old_scope;
|
||||
|
||||
ZVAL_STRING(&member, name);
|
||||
old_scope = EG(scope);
|
||||
EG(scope) = Z_OBJCE_P(object);
|
||||
data = Z_OBJ_HT_P(object)->read_property(object, &member, BP_VAR_IS, -1, &rv TSRMLS_CC);
|
||||
data = Z_OBJ_HT_P(object)->read_property(object, &member, BP_VAR_IS, -1, rv TSRMLS_CC);
|
||||
if (data == &EG(uninitialized_zval)) {
|
||||
/* Hack for bug #32455 */
|
||||
zend_property_info *property_info;
|
||||
@@ -1239,13 +1239,12 @@ static void unset_zval_property(zval* object, char* name TSRMLS_DC)
|
||||
zval member;
|
||||
zend_class_entry *old_scope;
|
||||
|
||||
//??? INIT_PZVAL(&member);
|
||||
//??? ZVAL_STRING(&member, name, 0);
|
||||
ZVAL_STRING(&member, name);
|
||||
old_scope = EG(scope);
|
||||
EG(scope) = Z_OBJCE_P(object);
|
||||
Z_OBJ_HT_P(object)->unset_property(object, &member, 0 TSRMLS_CC);
|
||||
EG(scope) = old_scope;
|
||||
zval_ptr_dtor(&member);
|
||||
} else if (Z_TYPE_P(object) == IS_ARRAY) {
|
||||
zend_hash_str_del(Z_ARRVAL_P(object), name, strlen(name));
|
||||
}
|
||||
@@ -1484,8 +1483,11 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
|
||||
sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
|
||||
sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
|
||||
|
||||
zval *ref;
|
||||
|
||||
CHECK_XML_NULL(data);
|
||||
if ((ret = soap_find_xml_ref(data TSRMLS_CC)) != NULL) {
|
||||
if ((ref = soap_find_xml_ref(data TSRMLS_CC)) != NULL) {
|
||||
ZVAL_COPY_VALUE(ret, ref);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1532,7 +1534,7 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
|
||||
}
|
||||
if (sdlType->model) {
|
||||
if (redo_any) {
|
||||
Z_ADDREF_P(redo_any);
|
||||
if (Z_REFCOUNTED_P(redo_any)) Z_ADDREF_P(redo_any);
|
||||
unset_zval_property(ret, "any" TSRMLS_CC);
|
||||
}
|
||||
model_to_zval_object(ret, sdlType->model, data, sdl TSRMLS_CC);
|
||||
@@ -1541,9 +1543,6 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
|
||||
|
||||
if (tmp == NULL) {
|
||||
model_to_zval_any(ret, data->children TSRMLS_CC);
|
||||
} else if (Z_REFCOUNT_P(tmp) == 0) {
|
||||
zval_dtor(tmp);
|
||||
efree(tmp);
|
||||
}
|
||||
zval_ptr_dtor(redo_any);
|
||||
}
|
||||
@@ -1992,6 +1991,13 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo
|
||||
|
||||
key_type = zend_hash_get_current_key_ex(prop, &str_key, &index, FALSE, &prop->nInternalPointer);
|
||||
zprop = zend_hash_get_current_data(prop);
|
||||
if (Z_TYPE_P(zprop) == IS_INDIRECT) {
|
||||
zprop = Z_INDIRECT_P(zprop);
|
||||
if (Z_TYPE_P(zprop) == IS_UNDEF) {
|
||||
zend_hash_move_forward(prop);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
property = master_to_xml(get_conversion(Z_TYPE_P(zprop)), zprop, style, xmlParam TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
master_to_zval(&details, NULL, tmp TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
add_soap_fault(this_ptr, faultcode, faultstring->val, faultactor->val, &details TSRMLS_CC);
|
||||
add_soap_fault(this_ptr, faultcode, faultstring ? faultstring->val : NULL, faultactor ? faultactor->val : NULL, &details TSRMLS_CC);
|
||||
if (faultstring) {
|
||||
STR_RELEASE(faultstring);
|
||||
}
|
||||
|
||||
@@ -2165,7 +2165,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
|
||||
}
|
||||
|
||||
zend_hash_get_current_key_ex(tmp->attributes, &_key, NULL, 0, &tmp->attributes->nInternalPointer);
|
||||
zend_hash_add_ptr(ht, _key, &newAttr);
|
||||
zend_hash_add_ptr(ht, _key, newAttr);
|
||||
|
||||
zend_hash_move_forward(tmp->attributes);
|
||||
} else {
|
||||
@@ -2273,7 +2273,6 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
|
||||
ZEND_HASH_FOREACH_KEY_PTR(type->attributes, index, str_key, attr) {
|
||||
if (str_key) {
|
||||
schema_attribute_fixup(ctx, attr);
|
||||
zend_hash_move_forward(type->attributes);
|
||||
} else {
|
||||
schema_attributegroup_fixup(ctx, attr, type->attributes);
|
||||
zend_hash_index_del(type->attributes, index);
|
||||
|
||||
@@ -1572,7 +1572,7 @@ PHP_METHOD(SoapServer, handle)
|
||||
zval filter_params;
|
||||
|
||||
array_init_size(&filter_params, 1);
|
||||
add_assoc_long_ex(&filter_params, ZEND_STRS("window"), 0x2f); /* ANY WBITS */
|
||||
add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */
|
||||
|
||||
zf = php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC);
|
||||
zval_dtor(&filter_params);
|
||||
@@ -1657,6 +1657,7 @@ PHP_METHOD(SoapServer, handle)
|
||||
/* If persistent then set soap_obj from from the previous created session (if available) */
|
||||
if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
|
||||
zval *tmp_soap;
|
||||
zval *session_vars;
|
||||
|
||||
if (PS(session_status) != php_session_active &&
|
||||
PS(session_status) != php_session_disabled) {
|
||||
@@ -1664,7 +1665,10 @@ PHP_METHOD(SoapServer, handle)
|
||||
}
|
||||
|
||||
/* Find the soap object and assign */
|
||||
if ((tmp_soap = zend_hash_str_find(Z_ARRVAL(PS(http_session_vars)), "_bogus_session_name", sizeof("_bogus_session_name")-1)) != NULL &&
|
||||
session_vars = &PS(http_session_vars);
|
||||
ZVAL_DEREF(session_vars);
|
||||
if (Z_TYPE_P(session_vars) == IS_ARRAY &&
|
||||
(tmp_soap = zend_hash_str_find(Z_ARRVAL_P(session_vars), "_bogus_session_name", sizeof("_bogus_session_name")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp_soap) == IS_OBJECT &&
|
||||
Z_OBJCE_P(tmp_soap) == service->soap_class.ce) {
|
||||
soap_obj = tmp_soap;
|
||||
@@ -1737,8 +1741,14 @@ PHP_METHOD(SoapServer, handle)
|
||||
/* If session then update session hash with new object */
|
||||
if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
|
||||
zval *tmp_soap_pp;
|
||||
if ((tmp_soap_pp = zend_hash_str_update(Z_ARRVAL(PS(http_session_vars)), "_bogus_session_name", sizeof("_bogus_session_name")-1, &tmp_soap)) != NULL) {
|
||||
zval *session_vars = &PS(http_session_vars);
|
||||
|
||||
ZVAL_DEREF(session_vars);
|
||||
if (Z_TYPE_P(session_vars) == IS_ARRAY &&
|
||||
(tmp_soap_pp = zend_hash_str_update(Z_ARRVAL_P(session_vars), "_bogus_session_name", sizeof("_bogus_session_name")-1, &tmp_soap)) != NULL) {
|
||||
soap_obj = tmp_soap_pp;
|
||||
} else {
|
||||
soap_obj = &tmp_soap;
|
||||
}
|
||||
} else {
|
||||
soap_obj = &tmp_soap;
|
||||
@@ -2954,7 +2964,8 @@ PHP_METHOD(SoapClient, __getFunctions)
|
||||
array_init(return_value);
|
||||
ZEND_HASH_FOREACH_PTR(&sdl->functions, function) {
|
||||
function_to_string(function, &buf);
|
||||
add_next_index_str(return_value, buf.s);
|
||||
add_next_index_stringl(return_value, buf.s->val, buf.s->len);
|
||||
smart_str_free(&buf);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
}
|
||||
@@ -2981,7 +2992,8 @@ PHP_METHOD(SoapClient, __getTypes)
|
||||
if (sdl->types) {
|
||||
ZEND_HASH_FOREACH_PTR(sdl->types, type) {
|
||||
type_to_string(type, &buf, 0);
|
||||
add_next_index_str(return_value, buf.s);
|
||||
add_next_index_stringl(return_value, buf.s->val, buf.s->len);
|
||||
smart_str_free(&buf);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user