Page MenuHomePhabricator

PHP Error in SMWQueryProcessor::processFunctionParams
Closed, ResolvedPublic

Description

I haven't examined the developer's wiki code to see if it is invalid, but regardless, SMW shouldn't allow the generation of a PHP error (or 3 in this case).

[03-Jun-2010 16:34:06] PHP Notice: Undefined variable: printmode in extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php on line 230
[03-Jun-2010 16:34:06] PHP Notice: Undefined variable: label in extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php on line 230
[03-Jun-2010 16:34:06] PHP Notice: Undefined variable: data in extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php on line 230

The error occurs on line 230 when the variables $printmode, $label, $data are not defined.

Program execution meets condition commented as: print property or check category

On line 230 SMWQueryProcessor::processFunctionParams::
printmode defined:false
label defined:false
data defined:false

Parameters passed were:

SMWQueryProcessor::processFunctionParams::rawparams: array(18) {

[0]=>
string(28) "[[Category:Assessment Form]]"
[1]=>
string(7) "?ASM:ID"
[2]=>
string(21) "?Client Date of Birth"
[3]=>
string(7) "?Gender"
[4]=>
string(5) "?Race"
[5]=>
string(9) "?Referred"
[6]=>
string(8) "?Charges"
[7]=>
string(8) "?in Jail"
[8]=>
string(6) "?AxisI"
[9]=>
string(7) "?AxisII"
[10]=>
string(8) "?AxisIII"
[11]=>
string(7) "?AxisIV"
[12]=>
string(6) "?AxisV"
[13]=>
string(9) "link=none"
[14]=>
string(15) "format=template"
[15]=>
string(20) "template=MHUserRow12"
[16]=>
string(5) "sort="
[17]=>
string(9) "limit=100"

}

SMWQueryProcessor::processFunctionParams::querystring: string(28) "[[Category:Assessment Form]]"

SMWQueryProcessor::processFunctionParams::params: array(0) {
}

SMWQueryProcessor::processFunctionParams::printouts: array(0) {
}

SMWQueryProcessor::processFunctionParams::showmode: bool(false)

SMWQueryProcessor::processFunctionParams::propparts: array(2) {

[0]=>
string(6) "ASM:ID"
[1]=>
bool(false)

}

MontCoBackTrace::(273)extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php::processFunctionParams args: 5
MontCoBackTrace::(216)extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php::getResultFromFunctionParams args: 2
MontCoBackTrace::(doAsk args: 19
MontCoBackTrace::(2920)includes/parser/Parser.php::call_user_func_array args: 2
MontCoBackTrace::(962)includes/parser/Preprocessor_DOM.php::braceSubstitution args: 2
MontCoBackTrace::(2728)includes/parser/Parser.php::expand args: 2
MontCoBackTrace::(930)includes/parser/Parser.php::replaceVariables args: 1
MontCoBackTrace::(330)includes/parser/Parser.php::internalParse args: 1
MontCoBackTrace::(4020)includes/Article.php::parse args: 6
MontCoBackTrace::(4002)includes/Article.php::getOutputFromWikitext args: 3
MontCoBackTrace::(1345)includes/Article.php::outputWikiText args: 3
MontCoBackTrace::(doViewParse args: 0
MontCoBackTrace::(59)includes/PoolCounter.php::call_user_func args: 1
MontCoBackTrace::(900)includes/Article.php::executeProtected args: 2
MontCoBackTrace::(493)includes/Wiki.php::view args: 0
MontCoBackTrace::(70)includes/Wiki.php::performAction args: 5
MontCoBackTrace::(117)index.php::performRequestForTitle args: 5


Version: unspecified
Severity: normal
Platform: PC
URL: http://wiki.montcopa.org/TestWiki/index.php?title=Assessment_Form_Info

Details

Reference
bz23781

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:05 PM
bzimport set Reference to bz23781.

I fixed the not being defined of the $data var, but am not quite sure how the other 2 should be fixed. Maybe there should be an else condition like indicated there might be in the comment?

I have now changed the code to interpret every printout that is not recognized as a Category as belonging to a property. I hope that this fixes the issue. (The change will soon be released in SMW 1.5.2).

My guess is that ASM is a registered namespace prefix in the above example. Writing ?Property:ASM:ID in the query could be a quick fix for the issue.