Page MenuHomePhabricator

SMWQueryProcessor::createQuery() not adjusted to Changes in SMWQueryProcessor::getParameters() in 1.6.2
Closed, DeclinedPublic

Description

There have been some changes in Query parameters handling in SMW 1.6.2, the Validators Parameter class is used to define basic SMW parameters in SMWQueryProcessor::getParameters() now.
Parameter::setDefault() allows to set a default value for a parameter in case it was not user-defined in the query. Before the generated array with supplied params didn't contain a item for unset parameters, now it contains an array value with the default.
SMWQueryProcessor::createQuery() still handles the array with the delivered parameter values as if the default were unset array items, but in fact, they are set to the default.
So, in several places in SMWQueryProcessor::createQuery() array_key_exists() is still used to check whether the param was set by the user, while in most cases where the default is set to 'false' for example, "$params['param'] !== false" could be used.

I have not searched for actual buggy behavior resulting from this, but there certainly is some needless/confusing code here.


Version: unspecified
Severity: normal

Details

Reference
bz31085

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:47 PM
bzimport set Reference to bz31085.
bzimport added a subscriber: Unknown Object (MLST).

I'm aware of this, and it will eventually go. Right now there is still a lot of such old code around, in some places for compat reasons.

Aklapper subscribed.

The Semantic MediaWiki developers requested in https://phabricator.wikimedia.org/T64114 to move their task tracking to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues and to close remaining tasks in Wikimedia Phabricator. If you still face the problem reported in this task in a supported version of SMW, please feel free to transfer your report to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues . We are sorry for the inconvenience.