cvs: php-src(PHP_5_1) / NEWS /ext/soap php_encoding.c php_soap.h soap.c /ext/soap/tests/bugs bug36226.phpt
| From: | Dmitry Stogov | Date: | Thu, 02 Feb 2006 11:41:45 +0000 |
| Subject: | cvs: php-src(PHP_5_1) / NEWS /ext/soap php_encoding.c php_soap.h soap.c /ext/soap/tests/bugs bug36226.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36725@lists.php.net to get a copy of this message | ||
dmitry Thu Feb 2 11:41:45 2006 UTC
Added files: (Branch: PHP_5_1)
/php-src/ext/soap/tests/bugs bug36226.phpt
Modified files:
/php-src NEWS
/php-src/ext/soap php_encoding.c php_soap.h soap.c
Log:
Bug #36226 Inconsistent handling when passing potential arrays
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.392&r2=1.2027.2.393&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.392 php-src/NEWS:1.2027.2.393
--- php-src/NEWS:1.2027.2.392 Thu Feb 2 08:17:23 2006
+++ php-src/NEWS Thu Feb 2 11:41:45 2006
@@ -22,6 +22,8 @@
- Fixed bug #36242 (Possible memory corruption in stream_select()). (Tony)
- Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch).
(Tony)
+- Fixed bug #36226 (Inconsistent handling when passing potential arrays).
+ (Dmitry)
- Fixed bug #36224 (date(DATE_ATOM) gives wrong results). (Derick, Hannes
Magnusson)
- Fixed bug #36222 (errorInfo in PDOException is always NULL). (Ilia)
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/php_encoding.c?r1=1.103.2.14&r2=1.103.2.15&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.103.2.14 php-src/ext/soap/php_encoding.c:1.103.2.15
--- php-src/ext/soap/php_encoding.c:1.103.2.14 Wed Feb 1 17:18:24 2006
+++ php-src/ext/soap/php_encoding.c Thu Feb 2 11:41:45 2006
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.103.2.14 2006/02/01 17:18:24 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.15 2006/02/02 11:41:45 dmitry Exp $ */
#include <time.h>
@@ -1157,6 +1157,14 @@
add_next_index_zval(array, val);
} while ((node = get_node(node->next, model->u.element->name)) != NULL);
val = array;
+ } else if ((SOAP_GLOBAL(features) & SOAP_SINGLE_ELEMENT_ARRAYS) &&
+ (model->max_occurs == -1 || model->max_occurs > 1)) {
+ zval *array;
+
+ MAKE_STD_ZVAL(array);
+ array_init(array);
+ add_next_index_zval(array, val);
+ val = array;
}
set_zval_property(ret, model->u.element->name, val TSRMLS_CC);
}
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/php_soap.h?r1=1.38.2.1&r2=1.38.2.2&diff_format=u
Index: php-src/ext/soap/php_soap.h
diff -u php-src/ext/soap/php_soap.h:1.38.2.1 php-src/ext/soap/php_soap.h:1.38.2.2
--- php-src/ext/soap/php_soap.h:1.38.2.1 Sun Jan 1 12:50:13 2006
+++ php-src/ext/soap/php_soap.h Thu Feb 2 11:41:45 2006
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_soap.h,v 1.38.2.1 2006/01/01 12:50:13 sniper Exp $ */
+/* $Id: php_soap.h,v 1.38.2.2 2006/02/02 11:41:45 dmitry Exp $ */
#ifndef PHP_SOAP_H
#define PHP_SOAP_H
@@ -119,6 +119,7 @@
char *uri;
xmlCharEncodingHandlerPtr encoding;
HashTable *class_map;
+ int features;
};
#define SOAP_CLASS 1
@@ -151,6 +152,8 @@
#define SOAP_AUTHENTICATION_BASIC 0
#define SOAP_AUTHENTICATION_DIGEST 1
+#define SOAP_SINGLE_ELEMENT_ARRAYS (1<<0)
+
ZEND_BEGIN_MODULE_GLOBALS(soap)
HashTable defEncNs; /* mapping of default namespaces to prefixes */
HashTable defEnc;
@@ -167,6 +170,7 @@
long cache_ttl;
xmlCharEncodingHandlerPtr encoding;
HashTable *class_map;
+ int features;
ZEND_END_MODULE_GLOBALS(soap)
#ifdef PHP_WIN32
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/soap.c?r1=1.156.2.11&r2=1.156.2.12&diff_format=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.156.2.11 php-src/ext/soap/soap.c:1.156.2.12
--- php-src/ext/soap/soap.c:1.156.2.11 Sun Jan 1 12:50:13 2006
+++ php-src/ext/soap/soap.c Thu Feb 2 11:41:45 2006
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.11 2006/01/01 12:50:13 sniper Exp $ */
+/* $Id: soap.c,v 1.156.2.12 2006/02/02 11:41:45 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -479,6 +479,7 @@
SOAP_GLOBAL(soap_version) = SOAP_1_1;
SOAP_GLOBAL(encoding) = NULL;
SOAP_GLOBAL(class_map) = NULL;
+ SOAP_GLOBAL(features) = 0;
return SUCCESS;
}
@@ -633,6 +634,8 @@
REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS |
CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS,
CONST_CS | CONST_PERSISTENT);
+
old_error_handler = zend_error_cb;
zend_error_cb = soap_error_handler;
@@ -957,6 +960,11 @@
zend_hash_copy(service->class_map, (*tmp)->value.ht, (copy_ctor_func_t) zval_add_ref,
(void *) &ztmp, sizeof(zval *));
}
+ if (zend_hash_find(ht, "features", sizeof("features"), (void**)&tmp) ==
SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG) {
+ service->features = Z_LVAL_PP(tmp);
+ }
+
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is
required in nonWSDL mode.");
}
@@ -1358,6 +1366,7 @@
int arg_len;
xmlCharEncodingHandlerPtr old_encoding;
HashTable *old_class_map;
+ int old_features;
SOAP_SERVER_BEGIN_CODE();
@@ -1503,6 +1512,8 @@
SOAP_GLOBAL(encoding) = service->encoding;
old_class_map = SOAP_GLOBAL(class_map);
SOAP_GLOBAL(class_map) = service->class_map;
+ old_features = SOAP_GLOBAL(features);
+ SOAP_GLOBAL(features) = service->features;
old_soap_version = SOAP_GLOBAL(soap_version);
function = deserialize_function_call(service->sdl, doc_request, service->actor,
&function_name, &num_params, ¶ms, &soap_version, &soap_headers TSRMLS_CC);
xmlFreeDoc(doc_request);
@@ -1773,6 +1784,7 @@
SOAP_GLOBAL(encoding) = old_encoding;
SOAP_GLOBAL(sdl) = old_sdl;
SOAP_GLOBAL(class_map) = old_class_map;
+ SOAP_GLOBAL(features) = old_features;
/* Free soap headers */
zval_dtor(&retval);
@@ -2189,6 +2201,11 @@
add_property_zval(this_ptr, "_classmap", class_map);
}
+ if (zend_hash_find(ht, "features", sizeof("features"), (void**)&tmp) ==
SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_ARRAY) {
+ add_property_long(this_ptr, "_features", Z_LVAL_PP(tmp));
+ }
+
if (zend_hash_find(ht, "connection_timeout", sizeof("connection_timeout"),
(void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_LONG && Z_LVAL_PP(tmp) > 0) {
add_property_long(this_ptr, "_connection_timeout", Z_LVAL_PP(tmp));
@@ -2313,6 +2330,7 @@
zval response;
xmlCharEncodingHandlerPtr old_encoding;
HashTable *old_class_map;
+ int old_features;
SOAP_CLIENT_BEGIN_CODE();
@@ -2358,6 +2376,13 @@
} else {
SOAP_GLOBAL(class_map) = NULL;
}
+ old_features = SOAP_GLOBAL(features);
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features"),
(void **) &tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG) {
+ SOAP_GLOBAL(features) = Z_LVAL_PP(tmp);
+ } else {
+ SOAP_GLOBAL(features) = 0;
+ }
if (sdl != NULL) {
fn = get_function(sdl, function);
@@ -2458,10 +2483,11 @@
zend_throw_exception_object(exception TSRMLS_CC);
}
#endif
- if (SOAP_GLOBAL(encoding) != NULL) {
+ if (SOAP_GLOBAL(encoding) != NULL) {
xmlCharEncCloseFunc(SOAP_GLOBAL(encoding));
- }
- SOAP_GLOBAL(class_map) = old_class_map;
+ }
+ SOAP_GLOBAL(features) = old_features;
+ SOAP_GLOBAL(class_map) = old_class_map;
SOAP_GLOBAL(encoding) = old_encoding;
SOAP_GLOBAL(sdl) = old_sdl;
SOAP_CLIENT_END_CODE();
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/tests/bugs/bug36226.phpt?view=markup&rev=1.1
Index: php-src/ext/soap/tests/bugs/bug36226.phpt
+++ php-src/ext/soap/tests/bugs/bug36226.phpt