diff options
| author | Dmitry Stogov <dmitry@php.net> | 2007-12-27 13:10:20 +0000 | 
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2007-12-27 13:10:20 +0000 | 
| commit | 964b8bb30dc5e9fb0b9110ed8146e13cc0795cc1 (patch) | |
| tree | bc4543e6f0a5667cc15ab9199c661f318eca5f3a /ext/soap/php_encoding.c | |
| parent | 0d88ad9b96b71749d7b6279d72e11b6ba0618b93 (diff) | |
| download | php-git-964b8bb30dc5e9fb0b9110ed8146e13cc0795cc1.tar.gz | |
Added ability to use SplArrays instead of plain arrays in ext/soap. (Joshua Reese, Dmitry)
Diffstat (limited to 'ext/soap/php_encoding.c')
| -rw-r--r-- | ext/soap/php_encoding.c | 27 | 
1 files changed, 26 insertions, 1 deletions
| diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index df6b9cd6bd..d7dea05396 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -27,6 +27,10 @@  #include <libxml/parserInternals.h>  #include "zend_strtod.h" +#ifdef HAVE_SPL +# include "ext/spl/spl_array.h" +#endif +  /* zval type decode */  static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data);  static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data); @@ -2238,7 +2242,9 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod  	int dimension = 1;  	int* dims;  	int soap_version; - +#ifdef HAVE_SPL +	zval *array_copy = NULL; +#endif  	TSRMLS_FETCH();  	soap_version = SOAP_GLOBAL(soap_version); @@ -2258,6 +2264,18 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod  		return xmlParam;  	} +#ifdef HAVE_SPL +	if (Z_TYPE_P(data) == IS_OBJECT && (instanceof_function(Z_OBJCE_P(data), spl_ce_ArrayObject TSRMLS_CC) || instanceof_function(Z_OBJCE_P(data), spl_ce_ArrayIterator TSRMLS_CC))) { +		zval getArray; +             +		ZVAL_STRING(&getArray, "getArrayCopy", 0); +		call_user_function_ex(NULL, &data, &getArray, &array_copy, 0, 0, 0, NULL TSRMLS_CC);         +		if (Z_TYPE_P(array_copy) == IS_ARRAY) { +			data = array_copy; +		} +	} +#endif +  	if (Z_TYPE_P(data) == IS_ARRAY) {  		sdlAttributePtr *arrayType;  		sdlExtraAttributePtr *ext; @@ -2435,6 +2453,13 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod  			set_ns_and_type(xmlParam, type);  		}  	} + +#ifdef HAVE_SPL +	if (array_copy) { +		zval_ptr_dtor(&array_copy); +	} +#endif +  	return xmlParam;  } | 
