Development

Changeset 27989

You must first sign up to be able to contribute.

Changeset 27989

Show
Ignore:
Timestamp:
02/12/10 22:53:20 (2 years ago)
Author:
Kris.Wallsmith
Message:

[1.2] backported r27738 xss fix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2/lib/widget/sfWidgetFormSelectCheckbox.class.php

    r17068 r27989  
    112112      $inputs[] = array( 
    113113        'input' => $this->renderTag('input', array_merge($baseAttributes, $attributes)), 
    114         'label' => $this->renderContentTag('label', $option, array('for' => $id)), 
     114        'label' => $this->renderContentTag('label', self::escapeOnce($option), array('for' => $id)), 
    115115      ); 
    116116    } 
  • branches/1.2/lib/widget/sfWidgetFormSelectRadio.class.php

    r17068 r27989  
    107107      $inputs[] = array( 
    108108        'input' => $this->renderTag('input', array_merge($baseAttributes, $attributes)), 
    109         'label' => $this->renderContentTag('label', $option, array('for' => $id)), 
     109        'label' => $this->renderContentTag('label', self::escapeOnce($option), array('for' => $id)), 
    110110      ); 
    111111    } 
  • branches/1.2/test/unit/widget/sfWidgetFormSelectCheckboxTest.php

    r17068 r27989  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(10, new lime_output_color()); 
     13$t = new lime_test(11, new lime_output_color()); 
    1414 
    1515$dom = new DomDocument('1.0', 'utf-8'); 
     
    8383$t->is(count($css->matchAll('input[type="checkbox"]')->getNodes()), 3, '->render() accepts a sfCallable as a choices option'); 
    8484 
     85// choices are escaped 
     86$t->diag('choices are escaped'); 
     87 
     88$w = new sfWidgetFormSelectCheckbox(array('choices' => array('<b>Hello world</b>'))); 
     89$t->is($w->render('foo'), '<ul class="checkbox_list"><li><input name="foo[]" type="checkbox" value="0" id="foo_0" />&nbsp;<label for="foo_0">&lt;b&gt;Hello world&lt;/b&gt;</label></li></ul>', '->render() escapes the choices'); 
     90 
    8591// __clone() 
    8692$t->diag('__clone()'); 
  • branches/1.2/test/unit/widget/sfWidgetFormSelectRadioTest.php

    r17068 r27989  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(9, new lime_output_color()); 
     13$t = new lime_test(10, new lime_output_color()); 
    1414 
    1515$dom = new DomDocument('1.0', 'utf-8'); 
     
    7878$t->is(count($css->matchAll('input[type="radio"]')->getNodes()), 3, '->render() accepts a sfCallable as a choices option'); 
    7979 
     80// choices as escaped 
     81$t->diag('choices are escaped'); 
     82 
     83$w = new sfWidgetFormSelectRadio(array('choices' => array('<b>Hello world</b>'))); 
     84$t->is($w->render('foo'), '<ul class="radio_list"><li><input name="foo" type="radio" value="0" id="foo_0" />&nbsp;<label for="foo_0">&lt;b&gt;Hello world&lt;/b&gt;</label></li></ul>', '->render() escapes the choices'); 
     85 
    8086// __clone() 
    8187$t->diag('__clone()');