Hi Thomas,
Zend_Filter_Input has been deprecated and is no longer available - as you've
noticed the current methodology is to set up filter or validator chains and
pass in an element from $_POST, which of course means you need to run your
isset() check to avoid the index error. Other possible options are using
controller methods like Zend_Controller_Request_Http::getPost() which runs an
isset() check though it's still verbose.
In the future there should be proposals for improved chaining of $_POST so
there's less individual handling of $_POST elements such as this. I also hope
it's configurable so I can avoid the setup almost entirely - ;).
Until then however - we're all in the same boat. The new classes are a big
improvement design wise, so while it's making more work it opens vastly
superior solutions in the future not possible with Zend_Filter_Input. It should
be a price well paid for the long term gains.
Paddy
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com
- Original Message
From: Thomas Eriksson <[EMAIL PROTECTED]>
To: fw-general@lists.zend.com
Sent: Wednesday, March 21, 2007 10:29:59 PM
Subject: [fw-general] Question about Zend_Filter_Input
Hi
What happened with the Zend_Filter_Input functions?
I had this in my bootstrap file (index.php)
Zend::register('post', new Zend_Filter_Input($_POST),
false);
Zend::register('get', new Zend_Filter_Input($_GET),
false);
And then I used that to filter input made by the user
like this…
$imaId = trim($post->noTags('imaId'));
This was really good because if the imaId in the form
that was submitted were an unchecked checkbox I didn’t get an error…
But if I know use…
Zend_Loader::loadClass('Zend_Filter_Striptags');
$filterChain = new Zend_Filter();
$filterChain->addFilter(new
Zend_Filter_Striptags());
$imaId= $filterChain->filter($_POST['imaId']);
I get a error notice out of this…Notice:
undefined index imaId …and so on…
Anybody who can help how to do this without having to
use…isset($_POST[“…”]) everywhere?
Regards
/Thomas
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097