Last modified: 2011-12-26 23:12:25 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32248, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30248 - With $smwgIgnoreQueryErrors = false, an #ask query with format=count and an empty property results in fatal error in SMW_QueryProcessor.php
With $smwgIgnoreQueryErrors = false, an #ask query with format=count and an e...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized major (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-05 13:28 UTC by Tomas Gradin
Modified: 2011-12-26 23:12 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tomas Gradin 2011-08-05 13:28:23 UTC
(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.
Comment 1 Tomas Gradin 2011-08-05 13:34:11 UTC
$res is not an integer but an object of course, but the result is the same.
Comment 2 Jeroen De Dauw 2011-08-05 14:23:30 UTC
I tried to reproduce this and was not able to. Also had a look at the code and did not see anything wrong there. So I'm guessing it has been fixed in SMW 1.6. You can try upgrading to get rid of the issue. Thanks for reporting though :)
Comment 3 badon 2011-12-26 23:12:25 UTC
Tomas, have you had anymore trouble with this? I saw the same error occur on my own wiki, but I haven't been able to set up a demo for it yet. Do you have more information that might help me reproduce this bug in a demo?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links