Changeset 8885
- Timestamp:
- 05/09/08 23:37:08 (1 week ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/1.1/lib/form/sfForm.class.php
r8701 r8885 126 126 * @param array An array of uploaded files (in the $_FILES or $_GET format) 127 127 */ 128 public function bind(array $taintedValues = null, array $taintedFiles = array())128 public function bind(array $taintedValues = null, array $taintedFiles = null) 129 129 { 130 130 $this->taintedValues = $taintedValues; … … 136 136 { 137 137 $this->taintedValues = array(); 138 } 139 140 if (is_null($this->taintedFiles)) 141 { 142 if ($this->isMultipart()) 143 { 144 throw new InvalidArgumentException('This form is multipart, which means you need to supply a files array as the bind() method second argument.'); 145 } 146 147 $this->taintedFiles = array(); 138 148 } 139 149 branches/dwhittle/1.1/lib/helper/sfRichTextEditorFCK.class.php
r8851 r8885 45 45 // FCKEditor.php class is written with backward compatibility of PHP4. 46 46 // This reportings are to turn off errors with public properties and already declared constructor 47 $error_reporting = ini_get('error_reporting'); 48 error_reporting(E_ALL); 47 $error_reporting = error_reporting(E_ALL); 49 48 50 49 require_once(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$php_file); branches/dwhittle/1.1/test/unit/form/sfFormTest.php
r8770 r8885 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(8 7, new lime_output_color());13 $t = new lime_test(88, new lime_output_color()); 14 14 15 15 class FormTest extends sfForm … … 214 214 'file' => new sfValidatorFile(array('max_size' => 2)), 215 215 ))); 216 $f->bind(array( 217 1 => 'f', 218 2 => 'potencier', 219 'file' => array('name' => 'test1.txt', 'type' => 'text/plain', 'tmp_name' => '/tmp/test1.txt', 'error' => 0, 'size' => 100)) 220 ); 216 $f->setWidgetSchema(new sfWidgetFormSchema(array('file' => new sfWidgetFormInputFile()))); 217 $f->bind(array(1 => 'f', 2 => 'potencier'), array( 218 'file' => array('name' => 'test1.txt', 'type' => 'text/plain', 'tmp_name' => '/tmp/test1.txt', 'error' => 0, 'size' => 100) 219 )); 221 220 $t->is($f->getErrorSchema()->getCode(), '1 [min_length] file [max_size]', '->bind() behaves correctly with files'); 221 222 try 223 { 224 $f->bind(array(1 => 'f', 2 => 'potencier')); 225 $t->fail('->bind() second argument is mandatory if the form is multipart'); 226 } 227 catch (InvalidArgumentException $e) 228 { 229 $t->pass('->bind() second argument is mandatory if the form is multipart'); 230 } 222 231 223 232 // ->renderGlobalErrors()