Author: info
Description:
A bad query that returns something shows a warning tooltip with the error string, e.g.:
<ask>[[Help: ]][[Help:Annotation]]</ask>
But if a bad query returns nothing, you don't get a warning tooltips of errors from the query}}. E.g. we add a second page to the above query:
<ask>[[Help: ]][[Help:Annotation]][[Property:Climate]]</ask>
and see nothing.
The bug is in SMW_QueryPrinter.php's SMWResultPrinter->getResultHTML() method. There are several code paths that don't append $this->getErrorString($results). The one I hit is if count is 0 and no further results, then the result printer just returns the default text (usually none); but I think there are others. The patch below fixes this case but leaves others; maybe it would be better to replace the early returns with fall-through to a single append of the error string before returning.
Index: SMW_QueryPrinter.php
- . (revision 27065)
+++ . (working copy)
@@ -47,7 +47,8 @@
$this->readParameters($params); if ($results->getCount() == 0) { if (!$results->hasFurtherResults()) {
- return htmlspecialchars($this->mDefault);
+ $result = htmlspecialchars($this->mDefault);
+ $result .= $this->getErrorString($results); // just append error messages
} elseif ($this->mInline) { $label = $this->mSearchlabel; if ($label === NULL) { //apply defaults
Version: unspecified
Severity: normal
URL: http://ontoworld.org/wiki/Bugs#Inline_query_errors_not_shown_if_no_results