Hi all,while writing the testcases for the AgaviWebRequestDataHolder (see ticket #955), I discovered some inconstant behavior with the methods that check whether a parameter has been submitted by the client. The methods affected are
- isParameterValueEmpty() - isCookieValueEmpty() - isHeaderValueEmpty() - isFileValueEmpty()These methods are used to check whether a value has been provided by the client or not, mainly in validation to check for the "required" flags.
Currently the implementation for the parameter, header, cookie methods regards 'not set' and 'empty string' as empty values. This has a justification for parameters because forms submit unfilled fields as empty string. However, cookies and headers are not affected by this behavior. A cookie with an empty string value is still provided by the client, the same is true for a header. It's explicitly an empty string. However, null values cannot be passed by the client and should probably be regarded as empty in all cases.
The isFileValueEmpty() method seems quite ok, but I haven't written any test for that yet ;)
Another issue is that the methods are badly named - the name hints that they sort of behave like php's empty() but they don't. <int:0>, <boolean:false> as well as empty arrays are regarded as non-empty. We should think about a name that better reflects what the methods do - check whether a value has been provided by the client. David and me discussed the issue but so far had no real great idea. Something along the lines "has*ValueBeenProvided" might be a good choice, but we're open for ideas here (*)
If anybody has any thoughts on that, please feel free to chime in - any input will be appreciated.
cheers felix(') go, community, go! We're making a naming contest - your proposal might end up in agavi ;)
-- Felix Gilcher Bitextender GmbH Paul-Heyse-Str. 6 D-80336 München T: +49 89 57 08 15 16 F: +49 89 57 08 15 17 M: +49 172 840 88 28 [email protected] http://bitextender.com/ Amtsgericht München, HRB 174280 Geschäftsführer: David Zülke, Florian Clever
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Agavi Dev Mailing List [email protected] http://lists.agavi.org/mailman/listinfo/dev
