Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.4
-
Fix Version/s: 1.7.5
-
Component/s: Zend_Soap_Wsdl
-
Labels:None
Description
Since the fix of job #5604, it's not possible to have recursive types.
The following code fails in ZF 1.7.4 (Fatal error: Maximum function nesting level of '100' reached, aborting!)
<?php
ini_set('include_path', dirname(__FILE__) . '/1.7.4');
require_once('Zend/Soap/AutoDiscover.php');
require_once('Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php');
class WebservicesTestClass
{
/**
* @var WebservicesTestClass[]
*/
public $children = array();
}
class WebservicesTest
{
/**
* @return WebservicesTestClass[]
*/
public function test()
{
return array();
}
}
$auto = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$auto->setClass('WebservicesTest');
$auto->handle();
?>
Note however when working in <= 1.7.3pl1, the type is incorrectly returned in the WSDL as WebservicesTestClass[] rather than ArrayOfWebservicesTestClass
Further testing indicates that if not specifying the types as arrays, it also fails in older versions
Sample code:
<?php
ini_set('include_path', dirname(_FILE_) . '/1.7.3');
require_once('Zend/Soap/AutoDiscover.php');
require_once('Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php');
class WebservicesTestClass
{ /** * @var WebservicesTestClass */ public $child; }class WebservicesTest
{
/**
*/
public function test() { return array(); }
}
$auto = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
{/code}$auto->setClass('WebservicesTest');
$auto->handle();
?>
The Zend_Soap_Wsdl_Strategy_DefaultComplexType->addComplexType() method needs to check what types are currently being added since it won't yet be available in $this->getContext()->getTypes()
- @return WebservicesTestClass
*/
public function test()
{
return array();
}
}
$auto = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex'); $auto->setClass('WebservicesTest'); $auto->handle(); ?> {/code} The Zend_Soap_Wsdl_Strategy_DefaultComplexType->addComplexType() method needs to check what types are currently being added since it won't yet be available in $this->getContext()->getTypes()