Yii Framework Forum: CJavascriptExpression breaks backward compatibility in 1.1.11 and is buggy... - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CJavascriptExpression breaks backward compatibility in 1.1.11 and is buggy... Rate Topic: -----

#1 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 791
  • Joined: 02-July 10
  • Location:Central Poland

Posted 07 August 2012 - 05:41 AM

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:

https://github.com/y...yii/issues/1158

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.
red
0

#2 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 791
  • Joined: 02-July 10
  • Location:Central Poland

Posted 07 August 2012 - 05:46 AM

related to: http://www.yiiframew...function-fails/
red
0

#3 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 07 August 2012 - 07:20 AM

Can you check with code from master branch? Thanks.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#4 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 791
  • Joined: 02-July 10
  • Location:Central Poland

Posted 07 August 2012 - 08:03 AM

master branch seems to work in both cases:
  • 'js:' prefix
  • CJavaScriptExpression

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?
red
0

#5 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 07 August 2012 - 08:24 AM

Very probable. Only few issues left: https://github.com/y...ne=3&state=open
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users