yiisoft / yii

Yii PHP Framework 1.1.x
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
4.84k stars 2.28k forks source link

Reset soap.wsdl_cache_enabled in CWebservice #3969

Closed tomtomsen closed 7 years ago

tomtomsen commented 9 years ago

I'm using a SoapClient in my Yii Webservice. When YII_DEBUG is active, soap.wsdl_cache_enabled becomes deactivated even for my SoapClient. (https://github.com/yiisoft/yii/blob/1.1.16/framework/web/services/CWebService.php#L164)

I think this is an unexpected behavior.

I would like to make a pull-request which resets the soap.wsdl_cache_enabled value after SoapServer gets initialized.

samdark commented 9 years ago

As far as I remember, it was always disabled on purpose. What are drawbacks? How do you propose refreshing WSDL cache?

tomtomsen commented 9 years ago

i dont think its wrong to disable the cache for the soapserver if YII_DEBUG is active.

but i think it should be reset afterwards, so that soapclients in a method do not get affected. i think it goes to far, because in that case YII_DEBUG affects a PHP class.

class ServerController extends CController
{
    public function actions()
    {
        return array(
            'service'=>array(
                'class'=>'CWebServiceAction',
            ),
        );
    }

    /**
     * @soap
     * @return string
     */
    public function sayHi() {
        $client = new SoapClient('http://example.com/soap/wsdl', array(
            // cache will be disabled, if YII_DEBUG is enabled
        ));

        $name = $client->getAName();

        return "Welcome $name!";
    }

If I use a SoapClient in a regular Web-Controller cache would be enabled, even if YII_DEBUG is active.

I think thats a diverging behavior.

samdark commented 7 years ago

Won't be fixed in 1.1.