ZF-6234: The WSDL setComplexTypeStrategy function dont load the Strategy include

Issue Type: Bug Created: 2009-04-07T12:21:30.000+0000 Last Updated: 2009-04-15T01:14:53.000+0000 Status: Resolved Fix version(s): Reporter: Gabriel Vegas (gvegas) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Soap_Wsdl

Related issues: Attachments:


The param $strategy recive the values of:

Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex ...

but when you set the value for example "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex" the function try to create the class "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex" but without the include of the strategy files.

I just did a patch for my projects, but require a general solution.

<pre class="highlight">
     * Set a strategy for complex type detection and handling
     * @todo Boolean is for backwards compability with extractComplexType object var. Remove it in later versions.
     * @param boolean|string|Zend_Soap_Wsdl_Strategy_Interface $strategy
     * @return Zend_Soap_Wsdl
    public function setComplexTypeStrategy($strategy)
        if($strategy === true) {
            require_once "Zend/Soap/Wsdl/Strategy/DefaultComplexType.php";
            $strategy = new Zend_Soap_Wsdl_Strategy_DefaultComplexType();
        } else if($strategy === false) {
            require_once "Zend/Soap/Wsdl/Strategy/AnyType.php";
            $strategy = new Zend_Soap_Wsdl_Strategy_AnyType();
        } else if(is_string($strategy)) {
//----------- Here --------------
            require_once "Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php";
//----------- End Here --------------

            if(class_exists($strategy)) {
                $strategy = new $strategy();
            } else {
                require_once "Zend/Soap/Wsdl/Exception.php";
                throw new Zend_Soap_Wsdl_Exception(
                    sprintf("Strategy with name '%s does not exist.", $strategy

        if(!($strategy instanceof Zend_Soap_Wsdl_Strategy_Interface)) {
            require_once "Zend/Soap/Wsdl/Exception.php";
            throw new Zend_Soap_Wsdl_Exception("Set a strategy that is not of type 'Zend_Soap_Wsdl_Strategy_Interface'");
        $this->_strategy = $strategy;
        return $this;



Posted by Benjamin Eberlei (beberlei) on 2009-04-15T01:14:52.000+0000

There are several sides to this issue:

  1. class_exists triggers an autoload, if a handler is registered.

  2. i don't want to add an dependency to Zend_Loader which i would have to do to call:


at that point.

  1. require_once alone does not work, since you have to load a file and not a class.

The dependency between the strategy and the wsdl class has to be wired in userland code, since there it is made explicit:

<pre class="highlight">
require_once 'MyWsdlStrategy.php';
$wsdl  = new Zend_Soap_Wsdl();
$wsdl->setComplexTypeStrategy(new MyStrategy());

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.