[pLog-svn] r5861 - plog/branches/lifetype-1.2/class/data
Oscar Renalias
oscar at renalias.net
Fri Aug 24 10:42:54 EDT 2007
I still don't understand :-)
What I am suggesting is:
class Request extends Properties
{
function Request( $request ) {
if( magic_quotes_gpc()) {
foreach( $request as $key => $value ) {
$request[$key] = strip_slashes($value);
}
}
parent::__construct( $request );
}
...
}
So after this point, we can call getValue(), getFilteredValue(), etc,
and we can be sure that all data has been filtered as expected. Or am
I missing something?
Oscar
On 8/24/07, Jon Daley <plogworld at jon.limedaley.com> wrote:
> On Fri, 24 Aug 2007, Oscar Renalias wrote:
> > We can remove the $filter parameter from Properties::getValue() if
> > it's true that it is not being used.
> The problem is that doesn't make a difference, since there is the
> "|| isset(filterclass) inside getValue()
>
> > We don't need to implement Properties::getUnfilteredValue() because we
> > already have the opposite, Properties::getFilteredValue().
> getValue and getFilteredValue are basically the same thing.
>
> > But what would you need Properties::filterData() for?
> Because the data should always be filtered, just after the
> stripslashes() call. So, request->getValue would look like:
>
> getunfilteredata();
> if(magic_quotes)
> stripslashes();
> filterData();
>
> > Why don't we just process all values in the request inside the Request
> > constructor, and perform the call to strip_slashes in there rather
> > than in the get[Filtered]Value() methods? In that case we wouldn't
> > need to worry about doing it later, and we could be sure that the data
> > has already been filtered.
> That sounds fine, it is just duplicating code from inside the
> parent class.
>
> I think you are proposing:
>
> function getValue( $key, $defaultValue = null)
> {
> if( !isset($this->_props[$key]) ) {
> $value = $defaultValue;
> } else {
> $value = $this->_props[$key];
> }
>
> if( get_magic_quotes_gpc() && !is_array( $value ))
> $value = stripslashes( $value );
>
> if(isset( $this->_keyFilters[$key] ))
> $value = $this->_keyFilters[$key]->filter($value);
>
> return( $value );
> }
>
>
> I think it would be better to not duplicate the code from properties and
> only reference the _props and _keyFilters from inside Properties with a
> getUnfilteredValue() and filterData() which would do the first and third
> blocks of the above code.
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>
More information about the pLog-svn
mailing list