Changeset 20298
- Timestamp:
- 07/19/09 12:43:11 (4 years ago)
- Files:
-
- branches/1.2/lib/form/sfForm.class.php (modified) (1 diff)
- branches/1.2/test/unit/form/sfFormTest.php (modified) (2 diffs)
- branches/1.3/lib/form/sfForm.class.php (modified) (1 diff)
- branches/1.3/test/unit/form/sfFormTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/form/sfForm.class.php
r17858 r20298 752 752 $this->defaults = is_null($defaults) ? array() : $defaults; 753 753 754 if ( self::$CSRFProtection)754 if ($this->isCSRFProtected()) 755 755 { 756 756 $this->setDefault(self::$CSRFFieldName, $this->getCSRFToken(self::$CSRFSecret)); branches/1.2/test/unit/form/sfFormTest.php
r19780 r20298 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(14 4, new lime_output_color());13 $t = new lime_test(145, new lime_output_color()); 14 14 15 15 class FormTest extends sfForm … … 123 123 $f->setDefaults(array('first_name' => 'Fabien')); 124 124 $t->is($f->getDefault('_csrf_token'), $f->getCSRFToken('*mygreatsecret*'), '->getDefaults() keeps the CSRF token default value'); 125 126 $f = new FormTest(array(), array(), false); 127 $f->setDefaults(array('first_name' => 'Fabien')); 128 $t->is(array_key_exists('_csrf_token', $f->getDefaults()), false, '->setDefaults() does not set the CSRF token if CSRF is disabled'); 125 129 sfForm::disableCSRFProtection(); 126 130 branches/1.3/lib/form/sfForm.class.php
r19162 r20298 762 762 $this->defaults = is_null($defaults) ? array() : $defaults; 763 763 764 if ( self::$CSRFProtection)764 if ($this->isCSRFProtected()) 765 765 { 766 766 $this->setDefault(self::$CSRFFieldName, $this->getCSRFToken(self::$CSRFSecret)); branches/1.3/test/unit/form/sfFormTest.php
r19780 r20298 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(14 6);13 $t = new lime_test(147); 14 14 15 15 class FormTest extends sfForm … … 123 123 $f->setDefaults(array('first_name' => 'Fabien')); 124 124 $t->is($f->getDefault('_csrf_token'), $f->getCSRFToken('*mygreatsecret*'), '->getDefaults() keeps the CSRF token default value'); 125 126 $f = new FormTest(array(), array(), false); 127 $f->setDefaults(array('first_name' => 'Fabien')); 128 $t->is(array_key_exists('_csrf_token', $f->getDefaults()), false, '->setDefaults() does not set the CSRF token if CSRF is disabled'); 125 129 sfForm::disableCSRFProtection(); 126 130