[fw-general] Zend_Filter_Input problem in Zend Framework 1.9
I've run into a problem with Zend_FIlter_Input and the ZF1.9 release. I have various controller actions that start by doing something like this: $input = new Zend_Filter_Input(array('lesson' = 'digits'), array('lesson' = 'int'), $this-getRequest()-getUserParams()); and then go on to use retrieved params like this: $input-lesson This code has worked fine on various versions of the Framework up until 1.9. Now, on 1.9 running on Production (PHP 5.2.1) $input-lesson is NULL. If I dump out $input, the debug output is identical under 1.8 and 1.9. (see below for output). And in either case I can see the correct value for lesson. But when I retrieve it, as above, I get NULL. Even more curiously, the code continues to work fine with 1.9 on my development machine (OS X 10.4.11, PHP 5.2.4). Obviously it is a show stopper for me as none of my controller actions can retrieve URL params any more! I'm a newbie, so this kind of system specific problem has me scratching my head. Nick DUMP OUTPUT object(Zend_Filter_Input)#58 (12) { [_data:protected] = array(4) { [controller] = string(6) lesson [action] = string(6) browse [lesson] = string(2) 44 [module] = string(7) default } [_filterRules:protected] = array(1) { [lesson] = string(6) digits } [_validatorRules:protected] = array(1) { [lesson] = string(3) int } [_validFields:protected] = array(0) { } [_invalidMessages:protected] = array(0) { } [_invalidErrors:protected] = array(0) { } [_missingFields:protected] = array(0) { } [_unknownFields:protected] = array(0) { } [_defaultEscapeFilter:protected] = NULL [_loaders:protected] = array(0) { } [_defaults:protected] = array(6) { [allowEmpty] = bool(false) [breakChainOnFailure] = bool(false) [escapeFilter] = string(12) HtmlEntities [missingMessage] = string(70) Field '%field%' is required by rule '%rule%', but the field is missing [notEmptyMessage] = string(51) You must give a non-empty value for field '%field%' [presence] = string(8) optional } [_processed:protected] = bool(false) } -- View this message in context: http://www.nabble.com/Zend_Filter_Input-problem-in-Zend-Framework-1.9-tp24853238p24853238.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Filter_Input problem in Zend Framework 1.9
-- nickt66 nick...@yahoo.com wrote (on Thursday, 06 August 2009, 12:52 PM -0700): I've run into a problem with Zend_FIlter_Input and the ZF1.9 release. I have various controller actions that start by doing something like this: $input = new Zend_Filter_Input(array('lesson' = 'digits'), array('lesson' = 'int'), $this-getRequest()-getUserParams()); and then go on to use retrieved params like this: $input-lesson This code has worked fine on various versions of the Framework up until 1.9. Now, on 1.9 running on Production (PHP 5.2.1) $input-lesson is NULL. If I dump out $input, the debug output is identical under 1.8 and 1.9. (see below for output). And in either case I can see the correct value for lesson. But when I retrieve it, as above, I get NULL. Even more curiously, the code continues to work fine with 1.9 on my development machine (OS X 10.4.11, PHP 5.2.4). Please note that ZF versions = 1.7.0 have a minimum required PHP version of 5.2.4. While a lot of functionality works fine with earlier versions of PHP, we cannot guarantee it will work correctly unless you are using at least version 5.2.4. If your production server is running PHP 5.2.1, you will either need to: * upgrade your PHP version to a 5.2.4 or greater * use a version of ZF 1.7.0 Obviously it is a show stopper for me as none of my controller actions can retrieve URL params any more! I'm a newbie, so this kind of system specific problem has me scratching my head. -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/
[fw-general] Zend_Filter_Input: problem with presence required and null values
Hi, $validators = array( 'requiredFieldName' = array('presence' = 'required', 'allowEmpty' = true) ) Before Zend Framework Version 1.8.2 this validator definition worked fine for me but in later versions it does not work with null values. Prior to r15646 the presence of a value was checked using array_key_exists() but now it is checked using isset(). This results in null values being recognized as not present. Is this intended? And if so, how can I check that a field is specified (but can be null, false, 0 etc.)? Has anybody a solution to this problem? Thanks in advance. Best regards, Jonas
[fw-general] Zend_Filter_Input: problem with presence required and null values
Hi, $validators = array( 'requiredFieldName' = array('presence' = 'required', 'allowEmpty' = true) ) Before Zend Framework Version 1.8.2 this validator definition worked fine for me but in later versions it does not work with null values. Prior to r15646 the presence of a value was checked using array_key_exists() but now it is checked using isset(). This results in null values being recognized as not present. Is this intended? And if so, how can I check that a field is specified (but can be null, false, 0 etc.)? Has anybody a solution to this problem? Thanks in advance. Best regards, Jonas
Re: [fw-general] Zend_Filter_Input: problem with presence required and null values
I created an issue in the issue tracker on June 26th, and there have been multiple emails on the mailing list about this BC break. http://framework.zend.com/issues/browse/ZF-7135 Unfortunately, it appears that nobody thinks it's significant enough to fix. On Mon, Jul 20, 2009 at 10:45 AM, Jonas Fischerjonas.fisc...@gmail.com wrote: Hi, $validators = array( 'requiredFieldName' = array('presence' = 'required', 'allowEmpty' = true) ) Before Zend Framework Version 1.8.2 this validator definition worked fine for me but in later versions it does not work with null values. Prior to r15646 the presence of a value was checked using array_key_exists() but now it is checked using isset(). This results in null values being recognized as not present. Is this intended? And if so, how can I check that a field is specified (but can be null, false, 0 etc.)? Has anybody a solution to this problem? Thanks in advance. Best regards, Jonas -- Jordan Ryan Moore
Re: [fw-general] Zend_Filter_Input: problem with presence required and null values
On Mon, Jul 20, 2009 at 2:04 PM, Jordan Moore jordanryanmo...@gmail.comwrote: I created an issue in the issue tracker on June 26th, and there have been multiple emails on the mailing list about this BC break. http://framework.zend.com/issues/browse/ZF-7135 Unfortunately, it appears that nobody thinks it's significant enough to fix. Meaning that it isn't slated for fixing in 1.9? My, that truly sucks. -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness
[fw-general] Zend_Filter_Input problem
Hello, I've got one problem with Zend_Filter_Input and I don't know how to solve it. I have: ?php $data = array( 'nick' = '', 'email' = '[EMAIL PROTECTED]', 'message' = 'my long message' ); $filters = array( '*' = new Zend_Filter_StringTrim(), 'nick' = new Zend_Filter_StripTags() ); $validators = array('email' = array( new Zend_Validate_EmailAddress(), Zend_Filter_Input::ALLOW_EMPTY = true ), 'nick' = array( Zend_Filter_Input::PRESENCE = Zend_Filter_Input::PRESENCE_REQUIRED, Zend_Filter_Input::ALLOW_EMPTY = false ) ); $input = new Zend_Filter_Input($filters, $validators, $data); if ($input-hasInvalid()) { $message = $input-getMessages(); } ? If I have empty string in nick field it can't pass but it doesn't work. I don't need to make any other validation on that field. Thanks for every help, Jakub Podhorský
RE: [fw-general] Zend_Filter_Input problem
Thanks for the issue report Jakub, I have logged it as http://framework.zend.com/issues/browse/ZF-1437 and I will begin working on it. Regards, Bill Karwin From: Jakub Podhorský [mailto:[EMAIL PROTECTED] Sent: Saturday, May 26, 2007 3:47 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Filter_Input problem Hello, I've got one problem with Zend_Filter_Input and I don't know how to solve it. I have: ?php $data = array( 'nick' = '', 'email' = '[EMAIL PROTECTED]', 'message' = 'my long message' ); $filters = array( '*' = new Zend_Filter_StringTrim(), 'nick' = new Zend_Filter_StripTags() ); $validators = array('email' = array( new Zend_Validate_EmailAddress(), Zend_Filter_Input::ALLOW_EMPTY = true ), 'nick' = array( Zend_Filter_Input::PRESENCE = Zend_Filter_Input::PRESENCE_REQUIRED, Zend_Filter_Input::ALLOW_EMPTY = false ) ); $input = new Zend_Filter_Input($filters, $validators, $data); if ($input-hasInvalid()) { $message = $input-getMessages(); } ? If I have empty string in nick field it can't pass but it doesn't work. I don't need to make any other validation on that field. Thanks for every help, Jakub Podhorský