After clearing my inputs, I'm wondering if an empty string is covered with this?
$ jinput = JFactory :: getApplication () - & gt; Input; $ This- & gt; Name = $ jinput- & gt; Get ('name', '', 'STRING'); Normally without joomla I will also check an empty string. If there is something like this:
Get the method looking at JInput (! ($ _ POST ['name'])) It checks to find the isset : public function ($ name, $ default = null, $ filter = 'cmd') {if (isset ($ this) -> Data [$ name]) {$ this- & gt; Filter-> Clear ($ - $ [$ name], $ filter); } $ Default return; } That's not the case, because isset will only check for the null, though this is the default value for using the received method. So if I specify an empty string for the second parameter, then have I covered it here? $ this-> Name = $ jinput- & gt; Get ('name', '', 'STRING'); To decide on Joomla is not dependent on whether your empty string is a valid value or not. They have to use isset () , because if they use empty () and you return the code to '0' , Which you consider to be normal, Joomla will return the default value instead of that '0' . So it is completely normal to use only isset () to check whether the variable is set, and it depends on you Accept the values. If the value is not set, and you set the second parameter to the empty string as '' , then return an empty string. In your example a blank string will be returned, which is expected behavior.
No comments:
Post a Comment