hi,

as you may know, i'm responsible for implementing input filtering in
the forthcoming symfony-1.2.

before starting to code anything, i would like to get some community
feedback about the different solutions i've came up with :

(in any case, the underlying filtering framework will be ext/filter[1])

 * first solution : extend the sfRequest::getParameter() semantics,
adding a simple ext/filter wrapper. eg. :

  // Signature
  public function getParameter($name, $default_value, $filter_name,
array $filter_options)

  // Usage
  $request->getParameter('foo', 'bar', FILTER_VALIDATE_INT,
array('min_range' => 5, 'max_range' => 10, 'flags' =>
FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX));

 * second solution : extend the sfRequest::getParameter() semantics,
abstracting the filtering logic. eg. :

  // Signature
  public function getParameter($name, $default_value, sfInputFilter
$filter_instance)

  // Usage
  $request->getParameter('foo', 'bar', new
sfExtFilterInputFilter(array('id' => FILTER_VALIDATE_INT, 'options' =>
array('min_range' => 5, 'max_range' => 10, 'flags' =>
FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_HEX)));

 * third solution : implement a complete input filtering framework
similar to what can be found in the zend framework[2]
 * fourth solution : something better that i've not thought about :)

looking forward to your insights.

++
tristan

[1] http://php.net/filter
[2] http://framework.zend.com/manual/en/zend.filter.input.html

-- 
Tristan Rivoallan
http://www.clever-age.com
Clever Age - conseil en architecture technique
GSM: +33 6 219 219 33 Tél: +33 1 53 34 66 10

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to