diff --git a/NEWS b/NEWS
index 9865e76e671..e0cd294d5ad 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Nov 2005, PHP 5.1
- Fixed initializing and argument checking for posix_mknod(). (Derick)
+- Fixed bug #35142 (SOAP Client/Server Complex Object Support). (Dmitry)
- Fixed bug #35135 (PDOStatment without related PDO object may crash). (Ilia)
- Fixed bug #35091 (SoapClient leaks memory). (Dmitry)
- Fixed bug #35078 (configure does not find ldap_start_tls_s). (Jani)
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index bca17d4a59d..1162a417cb5 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -1223,6 +1223,10 @@ static zval *to_zval_object(encodeTypePtr type, xmlNodePtr data)
unset_zval_property(ret, "any" TSRMLS_CC);
redo_any = 1;
}
+ if (Z_TYPE_P(ret) == IS_OBJECT && ce != ZEND_STANDARD_CLASS_DEF_PTR) {
+ zend_object *zobj = zend_objects_get_address(ret TSRMLS_CC);
+ zobj->ce = ce;
+ }
} else {
zval *base;
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index d6183ffc939..565a7fb46b0 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -2192,9 +2192,25 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
}
break;
}
- case XSD_CONTENT_SEQUENCE:
- case XSD_CONTENT_ALL:
case XSD_CONTENT_CHOICE: {
+ if (model->max_occurs != 1) {
+ HashPosition pos;
+ sdlContentModelPtr *tmp;
+
+ zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
+ while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) {
+ (*tmp)->min_occurs = 0;
+ (*tmp)->max_occurs = model->max_occurs;
+ zend_hash_move_forward_ex(model->u.content, &pos);
+ }
+
+ model->kind = XSD_CONTENT_ALL;
+ model->min_occurs = 1;
+ model->max_occurs = 1;
+ }
+ }
+ case XSD_CONTENT_SEQUENCE:
+ case XSD_CONTENT_ALL: {
sdlContentModelPtr *tmp;
zend_hash_internal_pointer_reset(model->u.content);
diff --git a/ext/soap/tests/bugs/bug35142.phpt b/ext/soap/tests/bugs/bug35142.phpt
new file mode 100755
index 00000000000..b27d9bc6d96
--- /dev/null
+++ b/ext/soap/tests/bugs/bug35142.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Bug #35142 SOAP Client/Server Complex Object Support
+--SKIPIF--
+
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+server = new SoapServer($wsdl, $options);
+ $this->server->addFunction('PostEvents');
+ }
+
+ function __doRequest($request, $location, $action, $version) {
+ echo "$request\n";
+ $this->server->handle($request);
+ return $response;
+ }
+
+}
+
+$soapClient = new TestSoapClient($wsdl,
+ array('trace' => 1, 'exceptions' => 0,
+ 'classmap' => array('logOnEvent' => 'LogOnEvent',
+ 'logOffEvent' => 'LogOffEvent',
+ 'events' => 'IVREvents')));
+
+$logOnEvent = new LogOnEvent(34567, $timestamp);
+$logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked");
+$logOffEvents[] = new LogOffEvent(34568, $timestamp, "SmokeFree");
+$ivrEvents = new IVREvents("1.0", 101, 12345, 'IVR', $logOnEvent, $logOffEvents);
+
+$result = $soapClient->PostEvents($ivrEvents);
+
+class LogOffEvent {
+ public $audienceMemberId;
+ public $timestamp;
+ public $smokeStatus;
+ public $callInititator;
+
+ function __construct($audienceMemberId, $timestamp, $smokeStatus) {
+ $this->audienceMemberId = $audienceMemberId;
+ $this->timestamp = $timestamp;
+ $this->smokeStatus = $smokeStatus;
+ $this->callInitiator = "IVR";
+ }
+}
+
+class LogOnEvent {
+ public $audienceMemberId;
+ public $timestamp;
+
+ function __construct($audienceMemberId, $timestamp) {
+ $this->audienceMemberId = $audienceMemberId;
+ $this->timestamp = $timestamp;
+ }
+}
+
+class IVREvents {
+ public $version;
+ public $activityId;
+ public $messageId;
+ public $source;
+ public $logOnEvent;
+ public $logOffEvent;
+
+ function __construct($version, $activityId, $messageId, $source, $logOnEvent=NULL, $logOffEvent=NULL) {
+ $this->version = $version;
+ $this->activityId = $activityId;
+ $this->messageId = $messageId;
+ $this->source = $source;
+ $this->logOnEvent = $logOnEvent;
+ $this->logOffEvent = $logOffEvent;
+ }
+}
+?>
+--EXPECTF--
+
+
+
+object(IVREvents)#%d (6) {
+ ["version"]=>
+ string(3) "1.0"
+ ["activityId"]=>
+ int(101)
+ ["messageId"]=>
+ int(12345)
+ ["logOffEvent"]=>
+ array(2) {
+ [0]=>
+ object(LogOffEvent)#%d (4) {
+ ["audienceMemberId"]=>
+ int(34567)
+ ["timestamp"]=>
+ string(25) "2005-11-08T11:22:07+03:00"
+ ["smokeStatus"]=>
+ string(6) "Smoked"
+ ["callInitiator"]=>
+ string(3) "IVR"
+ }
+ [1]=>
+ object(LogOffEvent)#%d (4) {
+ ["audienceMemberId"]=>
+ int(34568)
+ ["timestamp"]=>
+ string(25) "2005-11-08T11:22:07+03:00"
+ ["smokeStatus"]=>
+ string(9) "SmokeFree"
+ ["callInitiator"]=>
+ string(3) "IVR"
+ }
+ }
+ ["logOnEvent"]=>
+ object(LogOnEvent)#%d (2) {
+ ["audienceMemberId"]=>
+ int(34567)
+ ["timestamp"]=>
+ string(25) "2005-11-08T11:22:07+03:00"
+ }
+ ["source"]=>
+ string(3) "IVR"
+}
diff --git a/ext/soap/tests/bugs/bug35142.wsdl b/ext/soap/tests/bugs/bug35142.wsdl
new file mode 100755
index 00000000000..2c712ec1087
--- /dev/null
+++ b/ext/soap/tests/bugs/bug35142.wsdl
@@ -0,0 +1,543 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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