https://bugzilla.wikimedia.org/show_bug.cgi?id=30248

       Web browser: ---
             Bug #: 30248
           Summary: With $smwgIgnoreQueryErrors = false, an #ask query
                    with format=count and an empty property results in
                    fatal error in SMW_QueryProcessor.php
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: Unprioritized
         Component: Semantic MediaWiki
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


(Semantic MediaWiki 1.5.6 running on MediaWiki 1.17.0)

1. Have this in LocalSettings.php:

$smwgIgnoreQueryErrors = false

2. Create a page Test with these contents:
{{#ask:[[Has incorrect type::]]|format=count}}

(Any property works as long as the value is empty)

This will result in a catchable fatal error:

Object of class SMWQueryResult could not be converted to string in
/var/www/p13.itawiki.org/w/extensions/SemanticMediaWiki-1.5.6/includes/SMW_QueryProcessor.php
on line 319

The problem is that the code in SMWQueryProcessor::getResultFromQuery assumes
that the output of $store->getQueryResult( $query ) (line 293) is a string when
$query->querymode == SMWQuery::MODE_COUNT, and at line 319:

return $res . smwfEncodeMessages( $query->getErrors() );

$res is an integer here, so this obviously fails.

Obviously, it is a syntax error having an empty property value like that, but
it's going to happen in templates when people put {{{whatever|}}} as the value.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to