CJavascriptExpression breaks backward compatibility in 1.1.11 and is buggy...

Watch out when upgrading to 1.1.11 as new CJavaScriptExpression mechanizm breaks backward compatibility in cases like this:




echo $form->dropDownList( $model, 'language', CSLangChooser::getLanguages(), array( 'ajax' => array(

        'type'=>'POST',

        'url'=>$this->createUrl( 'dynamicSections' ),

        'success'=>'js:function(html){jQuery("#Content_id_section").html(html).change();}',

) ) );



problem is line with: ‘success’ and ‘js:’ prefix. in 1.1.11 it is deprecated but CJavaScriptExpression implementation has buggy backward compatibility code:

when you change above to:




echo $form->dropDownList( $model, 'language', CSLangChooser::getLanguages(), array( 'ajax' => array(

        'type'=>'POST',

        'url'=>$this->createUrl( 'dynamicSections' ),

        'success'=>new CJavaScriptExpression( 'function(html){jQuery("#Content_id_section").html(html).change();}' ),

) ) );



it will throw error "Method CJavaScriptExpression::__toString() must return a string value" because of double CJavaScriptExpression wrapping. CHtml::ajax wraps your CJavaScriptExpression with its own because of bug in logical expression whether to apply wrapper or not.

related to: http://www.yiiframework.com/forum/index.php/topic/34329-js-function-fails/

Can you check with code from master branch? Thanks.

master branch seems to work in both cases:

[list=1]

[*]‘js:’ prefix

[*]CJavaScriptExpression

[/list]

with my code.

When is the patching version expected? I have noticed somewhere that 1.1.12 should be at the end of this week - how probable is that?

Very probable. Only few issues left: https://github.com/yiisoft/yii/issues?milestone=3&state=open